mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 18:56:39 +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,
|
||||
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 {
|
||||
...serviceDomains[domain][serviceName],
|
||||
fields,
|
||||
hasSelector: fields.length
|
||||
? fields.filter((field) => field.selector).map((field) => field.key)
|
||||
: [],
|
||||
hasSelector,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user