mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-02 05:57:54 +00:00
Sort ungrouped entities (#5047)
* Sort ungrouped entities * Console.bye
This commit is contained in:
parent
7e48b21767
commit
f3445d99cf
@ -42,6 +42,7 @@ import {
|
|||||||
} from "../../../data/entity_registry";
|
} from "../../../data/entity_registry";
|
||||||
import { processEditorEntities } from "../editor/process-editor-entities";
|
import { processEditorEntities } from "../editor/process-editor-entities";
|
||||||
import { SENSOR_DEVICE_CLASS_BATTERY } from "../../../data/sensor";
|
import { SENSOR_DEVICE_CLASS_BATTERY } from "../../../data/sensor";
|
||||||
|
import { compare } from "../../../common/string/compare";
|
||||||
|
|
||||||
const DEFAULT_VIEW_ENTITY_ID = "group.default_view";
|
const DEFAULT_VIEW_ENTITY_ID = "group.default_view";
|
||||||
const DOMAINS_BADGES = [
|
const DOMAINS_BADGES = [
|
||||||
@ -344,10 +345,17 @@ const generateViewConfig = (
|
|||||||
.forEach((domain) => {
|
.forEach((domain) => {
|
||||||
cards = cards.concat(
|
cards = cards.concat(
|
||||||
computeCards(
|
computeCards(
|
||||||
ungroupedEntitites[domain].map((entityId): [string, HassEntity] => [
|
ungroupedEntitites[domain]
|
||||||
entityId,
|
.sort((a, b) =>
|
||||||
entities[entityId],
|
compare(
|
||||||
]),
|
computeStateName(entities[a]),
|
||||||
|
computeStateName(entities[b])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.map((entityId): [string, HassEntity] => [
|
||||||
|
entityId,
|
||||||
|
entities[entityId],
|
||||||
|
]),
|
||||||
{
|
{
|
||||||
title: localize(`domain.${domain}`),
|
title: localize(`domain.${domain}`),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user