Skip to content

Commit

Permalink
Sort filter-domains on translated name (#21116)
Browse files Browse the repository at this point in the history
  • Loading branch information
karwosts authored Jun 19, 2024
1 parent 62528b2 commit 8272bef
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/ha-filter-domains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,18 @@ export class HaFilterDomains extends LitElement {
});

return Array.from(domains.values())
.map((domain) => ({
domain,
name: domainToName(this.hass.localize, domain),
}))
.filter(
(entry) =>
!filter ||
entry.toLowerCase().includes(filter) ||
domainToName(this.hass.localize, entry).toLowerCase().includes(filter)
entry.domain.toLowerCase().includes(filter) ||
entry.name.toLowerCase().includes(filter)
)
.sort((a, b) => stringCompare(a, b, this.hass.locale.language));
.sort((a, b) => stringCompare(a.name, b.name, this.hass.locale.language))
.map((entry) => entry.domain);
});

protected updated(changed) {
Expand Down

0 comments on commit 8272bef

Please sign in to comment.