mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Fix sorting auto generated dashboard (#14707)
This commit is contained in:
parent
f204a163d4
commit
d74fb8717c
@ -491,9 +491,15 @@ export const generateDefaultViewConfig = (
|
||||
|
||||
const areaCards: LovelaceCardConfig[] = [];
|
||||
|
||||
for (const [areaId, areaEntities] of Object.entries(
|
||||
const sortedAreas = Object.entries(
|
||||
splittedByAreaDevice.areasWithEntities
|
||||
)) {
|
||||
).sort((a, b) => {
|
||||
const areaA = areaEntries[a[0]];
|
||||
const areaB = areaEntries[b[0]];
|
||||
return stringCompare(areaA.name, areaB.name);
|
||||
});
|
||||
|
||||
for (const [areaId, areaEntities] of sortedAreas) {
|
||||
const area = areaEntries[areaId];
|
||||
areaCards.push(
|
||||
...computeCards(
|
||||
@ -506,13 +512,20 @@ export const generateDefaultViewConfig = (
|
||||
);
|
||||
}
|
||||
|
||||
areaCards.sort((a, b) => stringCompare(a.title || "", b.title || ""));
|
||||
|
||||
const deviceCards: LovelaceCardConfig[] = [];
|
||||
|
||||
for (const [deviceId, deviceEntities] of Object.entries(
|
||||
const sortedDevices = Object.entries(
|
||||
splittedByAreaDevice.devicesWithEntities
|
||||
)) {
|
||||
).sort((a, b) => {
|
||||
const deviceA = deviceEntries[a[0]];
|
||||
const deviceB = deviceEntries[b[0]];
|
||||
return stringCompare(
|
||||
deviceA.name_by_user || deviceA.name || "",
|
||||
deviceB.name_by_user || deviceB.name || ""
|
||||
);
|
||||
});
|
||||
|
||||
for (const [deviceId, deviceEntities] of sortedDevices) {
|
||||
const device = deviceEntries[deviceId];
|
||||
deviceCards.push(
|
||||
...computeCards(
|
||||
@ -534,8 +547,6 @@ export const generateDefaultViewConfig = (
|
||||
);
|
||||
}
|
||||
|
||||
deviceCards.sort((a, b) => stringCompare(a.title || "", b.title || ""));
|
||||
|
||||
let energyCard: LovelaceCardConfig | undefined;
|
||||
|
||||
if (energyPrefs) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user