mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Fix service advanced options UI (#21925)
This commit is contained in:
parent
bde2fd8202
commit
c7cfbb5b6c
@ -240,12 +240,24 @@ export class HaServiceControl extends LitElement {
|
|||||||
...value,
|
...value,
|
||||||
selector: value.selector as Selector | undefined,
|
selector: value.selector as Selector | undefined,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const hasSelector: string[] = [];
|
||||||
|
fields.forEach((field) => {
|
||||||
|
if ((field as any).fields) {
|
||||||
|
Object.entries((field as any).fields).forEach(([key, subField]) => {
|
||||||
|
if ((subField as any).selector) {
|
||||||
|
hasSelector.push(key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (field.selector) {
|
||||||
|
hasSelector.push(field.key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...serviceDomains[domain][serviceName],
|
...serviceDomains[domain][serviceName],
|
||||||
fields,
|
fields,
|
||||||
hasSelector: fields.length
|
hasSelector,
|
||||||
? fields.filter((field) => field.selector).map((field) => field.key)
|
|
||||||
: [],
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user