сортировка алертов
This commit is contained in:
parent
8115324988
commit
50dc75b35f
1 changed files with 5 additions and 3 deletions
|
|
@ -85,9 +85,11 @@ export function AlertsPage() {
|
|||
}
|
||||
map.get(key)!.alerts.push(a)
|
||||
}
|
||||
return Array.from(map.values()).sort((a, b) =>
|
||||
(a.object_name ?? '').localeCompare(b.object_name ?? '', 'ru')
|
||||
)
|
||||
return Array.from(map.values()).sort((a, b) => {
|
||||
const latestA = Math.max(...a.alerts.map((x) => new Date(x.created_at).getTime()))
|
||||
const latestB = Math.max(...b.alerts.map((x) => new Date(x.created_at).getTime()))
|
||||
return latestB - latestA
|
||||
})
|
||||
}, [alerts])
|
||||
|
||||
const handleAcknowledge = async (id: number) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue