entity dispay

This commit is contained in:
ari committed 2022-06-19 02:11:25 -04:00
1 parent dde8d76772
commit ae352ff244
2 files changed
+13 -6

No files matched your search

@@ -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