Add dashboard shell with sidebar nav and version header.

Replace the health-check stub UI with a left menu and content panel so section navigation and frontend/backend versions are visible in the shell.
This commit is contained in:
2026-07-16 20:57:47 +02:00
parent 38b4e8fd43
commit d2b92401f1
7 changed files with 351 additions and 70 deletions
+33 -1
View File
@@ -1,5 +1,5 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { fetchHealth, getApiBaseUrl } from './client'
import { fetchHealth, fetchStatus, getApiBaseUrl } from './client'
describe('getApiBaseUrl', () => {
it('defaults to localhost:8080 when unset', () => {
@@ -36,3 +36,35 @@ describe('fetchHealth', () => {
)
})
})
describe('fetchStatus', () => {
afterEach(() => {
vi.restoreAllMocks()
})
it('returns parsed status payload', async () => {
const fetchMock = vi.fn().mockResolvedValue({
ok: true,
json: async () => ({ service: 'clustercanvas', version: '0.1.0' }),
})
const status = await fetchStatus(fetchMock)
expect(fetchMock).toHaveBeenCalledWith(
'http://localhost:8080/api/v1/status',
)
expect(status).toEqual({ service: 'clustercanvas', version: '0.1.0' })
})
it('throws when the response is not ok', async () => {
const fetchMock = vi.fn().mockResolvedValue({
ok: false,
status: 503,
json: async () => ({}),
})
await expect(fetchStatus(fetchMock)).rejects.toThrow(
'status check failed: 503',
)
})
})