entity dispay
This commit is contained in:
1 parent
dde8d76772
commit
ae352ff244
2 files changed
+13
-6
No files matched your search
@@ -52,11 +52,7 @@ export const InputEntity: FC<InputEntityProps> = (props) => {
|
||||
options={options}
|
||||
getID={entities.getID}
|
||||
getLabel={entities.getLabel}
|
||||
groupBy={(opt) =>
|
||||
typeof opt !== "string"
|
||||
? `${prettyName(opt.integration)}/ ${prettyName(opt.domain)}`
|
||||
: ""
|
||||
}
|
||||
groupBy={(opt) => (typeof opt !== "string" ? prettyName(opt.domain) : "")}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -24,11 +24,15 @@ export type ServiceEditorTargetProps = {
|
||||
export const ServiceEditorTarget: FC<ServiceEditorTargetProps> = (props) => {
|
||||
const value = cleanUpValue(props.value ?? {});
|
||||
const domainRestrictions: string[] = [];
|
||||
const integrationRestrictions: string[] = [];
|
||||
|
||||
if (props.defn.entity) {
|
||||
if (typeof props.defn.entity.domain === "string") {
|
||||
domainRestrictions.push(props.defn.entity.domain);
|
||||
}
|
||||
if (typeof props.defn.entity.integration === "string") {
|
||||
integrationRestrictions.push(props.defn.entity.integration);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -42,7 +46,14 @@ export const ServiceEditorTarget: FC<ServiceEditorTargetProps> = (props) => {
|
||||
entity_id,
|
||||
})
|
||||
}
|
||||
restrictToDomain={domainRestrictions}
|
||||
restrictToDomain={
|
||||
domainRestrictions.length === 0 ? undefined : domainRestrictions
|
||||
}
|
||||
restrictedIntegrations={
|
||||
integrationRestrictions.length === 0
|
||||
? undefined
|
||||
: integrationRestrictions
|
||||
}
|
||||
multiple
|
||||
/>
|
||||
<InputDevice
|
||||
|
||||
Reference in new issue
Block a user