Standardize UI typography, charts and empty states

This commit is contained in:
2026-10-07 19:40:02 -04:00
parent 05bdeaf624
commit 0ed3cd6b47
57 changed files with 417 additions and 382 deletions
+21
View File
@@ -30,6 +30,27 @@ beforeEach(async () => {
afterEach(async () => { await fixture.cleanup(); vi.useRealTimers(); vi.restoreAllMocks(); });
describe('fleet and server response scope', () => {
it('counts unattached hosts needing attention and rechecks heartbeat age with each snapshot', async () => {
const hosts = await import('../../src/lib/server/hosts/index.js');
const { fleetSnapshot } = await import('../../src/lib/server/fleet/snapshot.js');
const base: import('../../src/lib/hosts.js').Host = { id: 'empty-host', name: 'Empty host', hostname: 'empty-host',
portMin: 28960, portMax: 28980, bindAddress: '0.0.0.0', publicAddress: '', minimumFreeBytes: 1024, createdAt: iso(),
connected: true, connectionState: 'online', lastHeartbeat: iso(),
enrolled: true, credentialActive: true, mode: 'active', readiness: 'ready', readinessReasons: [],
inventory: {}, decommission: null };
vi.spyOn(hosts, 'listHosts').mockReturnValue([
base,
{ ...base, id: 'offline', connected: false },
{ ...base, id: 'degraded', readiness: 'degraded' },
{ ...base, id: 'disabled', connected: false, mode: 'disabled' },
{ ...base, id: 'unenrolled', connected: false, enrolled: false }
]);
expect(fleetSnapshot().hostAttention).toBe(2);
vi.setSystemTime(now + 91_000);
expect(fleetSnapshot().hostAttention).toBe(3);
// None of these hosts has an assigned instance in this fixture.
expect(fleetSnapshot().servers.every(server => !server.host_id)).toBe(true);
});
it('omits completed history from fleet REST and SSR responses', async () => {
const { GET } = await import('../../src/routes/api/fleet/+server.js');
const { load } = await import('../../src/routes/+page.server.js');