mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-29 12:16:39 +00:00
Sort persistent notifications ascending (#7195)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
02d37a369a
commit
288bf6805a
@ -176,7 +176,22 @@ export class HuiNotificationDrawer extends EventsMixin(
|
|||||||
.filter((entityId) => computeDomain(entityId) === "configurator")
|
.filter((entityId) => computeDomain(entityId) === "configurator")
|
||||||
.map((entityId) => hass.states[entityId]);
|
.map((entityId) => hass.states[entityId]);
|
||||||
|
|
||||||
return notificationsBackend.concat(configuratorEntities);
|
const notifications = notificationsBackend.concat(configuratorEntities);
|
||||||
|
|
||||||
|
notifications.sort(function (n1, n2) {
|
||||||
|
const d1 = new Date(n1.created_at);
|
||||||
|
const d2 = new Date(n2.created_at);
|
||||||
|
|
||||||
|
if (d1 < d2) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (d1 > d2) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
return notifications;
|
||||||
}
|
}
|
||||||
|
|
||||||
showDialog({ narrow }) {
|
showDialog({ narrow }) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user