mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
Sort devices and services alphabetically in integration pages (#26231)
Co-authored-by: balloob <1444314+balloob@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
parent
98ed3bdd4d
commit
20dab92ad8
@ -22,6 +22,8 @@ import { css, html, LitElement, nothing } from "lit";
|
|||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
|
import { caseInsensitiveStringCompare } from "../../../common/string/compare";
|
||||||
|
import { computeDeviceNameDisplay } from "../../../common/entity/compute_device_name";
|
||||||
import { isDevVersion } from "../../../common/config/version";
|
import { isDevVersion } from "../../../common/config/version";
|
||||||
import {
|
import {
|
||||||
deleteApplicationCredential,
|
deleteApplicationCredential,
|
||||||
@ -491,18 +493,34 @@ class HaConfigEntryRow extends LitElement {
|
|||||||
);
|
);
|
||||||
|
|
||||||
private _getDevices = (): DeviceRegistryEntry[] =>
|
private _getDevices = (): DeviceRegistryEntry[] =>
|
||||||
Object.values(this.hass.devices).filter(
|
Object.values(this.hass.devices)
|
||||||
(device) =>
|
.filter(
|
||||||
device.config_entries.includes(this.entry.entry_id) &&
|
(device) =>
|
||||||
device.entry_type !== "service"
|
device.config_entries.includes(this.entry.entry_id) &&
|
||||||
);
|
device.entry_type !== "service"
|
||||||
|
)
|
||||||
|
.sort((a, b) =>
|
||||||
|
caseInsensitiveStringCompare(
|
||||||
|
computeDeviceNameDisplay(a, this.hass),
|
||||||
|
computeDeviceNameDisplay(b, this.hass),
|
||||||
|
this.hass.locale.language
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
private _getServices = (): DeviceRegistryEntry[] =>
|
private _getServices = (): DeviceRegistryEntry[] =>
|
||||||
Object.values(this.hass.devices).filter(
|
Object.values(this.hass.devices)
|
||||||
(device) =>
|
.filter(
|
||||||
device.config_entries.includes(this.entry.entry_id) &&
|
(device) =>
|
||||||
device.entry_type === "service"
|
device.config_entries.includes(this.entry.entry_id) &&
|
||||||
);
|
device.entry_type === "service"
|
||||||
|
)
|
||||||
|
.sort((a, b) =>
|
||||||
|
caseInsensitiveStringCompare(
|
||||||
|
computeDeviceNameDisplay(a, this.hass),
|
||||||
|
computeDeviceNameDisplay(b, this.hass),
|
||||||
|
this.hass.locale.language
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
private _toggleExpand() {
|
private _toggleExpand() {
|
||||||
this._expanded = !this._expanded;
|
this._expanded = !this._expanded;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user