Sort domains correctly, scroll to top on back (#19197)
This commit is contained in:
parent
721ec8e559
commit
ee57f26415
|
@ -254,9 +254,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
|
|||
return [];
|
||||
}
|
||||
const result: ListItem[] = [];
|
||||
Object.keys(services)
|
||||
.sort()
|
||||
.forEach((domain) => {
|
||||
Object.keys(services).forEach((domain) => {
|
||||
const manifest = manifests[domain];
|
||||
if (
|
||||
(type === undefined &&
|
||||
|
@ -265,9 +263,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
|
|||
(type === "helper" && manifest?.integration_type === "helper") ||
|
||||
(type === "other" &&
|
||||
(ENTITY_DOMAINS_OTHER.has(domain) ||
|
||||
!["helper", "entity"].includes(
|
||||
manifest?.integration_type || ""
|
||||
)))
|
||||
!["helper", "entity"].includes(manifest?.integration_type || "")))
|
||||
) {
|
||||
result.push({
|
||||
group: true,
|
||||
|
@ -278,7 +274,9 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
|
|||
});
|
||||
}
|
||||
});
|
||||
return result;
|
||||
return result.sort((a, b) =>
|
||||
stringCompare(a.name, b.name, this.hass.locale.language)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -515,6 +513,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
|
|||
}
|
||||
|
||||
private _back() {
|
||||
this._dialog!.scrollToPos(0, 0);
|
||||
if (this._filter) {
|
||||
this._filter = "";
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue