mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-26 05:28:58 +03:00
* build out system health pane * tweaks * fixes * fix notice link so it opens the correct camera * tweak language
15 lines
592 B
TypeScript
15 lines
592 B
TypeScript
import type { HealthProblem } from "@/types/health";
|
|
|
|
const SEVERITY_ORDER = { error: 0, warning: 1, info: 2 } as const;
|
|
const SOURCE_ORDER = { registry: 0, live: 1, config: 2, stream: 3 } as const;
|
|
|
|
/** errors first, then warnings, then info; within a severity by source, then scope */
|
|
export function sortHealthProblems(problems: HealthProblem[]): HealthProblem[] {
|
|
return [...problems].sort(
|
|
(a, b) =>
|
|
SEVERITY_ORDER[a.severity] - SEVERITY_ORDER[b.severity] ||
|
|
SOURCE_ORDER[a.source] - SOURCE_ORDER[b.source] ||
|
|
(a.scope ?? "").localeCompare(b.scope ?? ""),
|
|
);
|
|
}
|