feat: refine widget interactions

This commit is contained in:
Thomas Camlong authored and ajnart committed 2026-08-14 11:07:08 +02:00
1 parent a8a7545f40
commit 842e86012d
107 files changed
+3144 -1233

No files matched your search

@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { aggregateUptimeKumaDashboards } from "./aggregate";
import { getCompactStatLimit, getCompactStatPriority } from "./component";
describe("aggregateUptimeKumaDashboards", () => {
it("weights uptime by monitors instead of integrations", () => {
@@ -29,3 +30,26 @@ describe("aggregateUptimeKumaDashboards", () => {
expect(combined.averageUptimePercent).toBe(25);
});
});
describe("getCompactStatLimit", () => {
it("reserves compact height for the uptime summary", () => {
expect(getCompactStatLimit(150, true, 4)).toBe(0);
expect(getCompactStatLimit(220, true, 4)).toBe(2);
});
it("uses the space for metrics when the summary is disabled", () => {
expect(getCompactStatLimit(100, false, 4)).toBe(2);
expect(getCompactStatLimit(240, false, 4)).toBe(4);
});
});
describe("getCompactStatPriority", () => {
it("puts active failures before healthy totals", () => {
expect(getCompactStatPriority("downCount", 2)).toBeLessThan(getCompactStatPriority("totalMonitors", 10));
expect(getCompactStatPriority("pausedCount", 1)).toBeLessThan(getCompactStatPriority("upCount", 8));
});
it("moves zero-value problem states behind healthy totals", () => {
expect(getCompactStatPriority("downCount", 0)).toBeGreaterThan(getCompactStatPriority("upCount", 8));
});
});