feat: add Dimension Lab seed model #19

Merged
vince merged 2 commits from codex/issue-11-dimension-lab-seed into main 2026-06-18 19:17:50 +02:00
2 changed files with 56 additions and 4 deletions
Showing only changes of commit 7afcb78e0e - Show all commits

View file

@ -30,6 +30,12 @@ describe("Dimension Lab dashboard seed", () => {
}); });
test("keeps icon, link, and datasource references in seed data", () => { test("keeps icon, link, and datasource references in seed data", () => {
const iconIds = [
...dimensionLabDashboardFixture.telemetry.map((card) => card.icon),
...allServices(dimensionLabDashboardFixture).map((service) => service.icon),
...(dimensionLabDashboardFixture.modules || []).map((module) => module.icon),
].filter((icon): icon is string => Boolean(icon));
expect( expect(
dimensionLabDashboardFixture.telemetry.every( dimensionLabDashboardFixture.telemetry.every(
(card) => card.icon && card.datasource, (card) => card.icon && card.datasource,
@ -50,24 +56,39 @@ describe("Dimension Lab dashboard seed", () => {
for (const service of allServices(dimensionLabDashboardFixture)) { for (const service of allServices(dimensionLabDashboardFixture)) {
expect(service.icon, `${service.id} must declare an Iconify id`).toBeTruthy(); expect(service.icon, `${service.id} must declare an Iconify id`).toBeTruthy();
expect(verifiedSeedIconIds.has(service.icon || ""), `${service.id} icon must be verified`).toBe(true);
expect(service.datasource, `${service.id} must declare health source`).toBeTruthy(); expect(service.datasource, `${service.id} must declare health source`).toBeTruthy();
if (service.link) { if (service.link) {
expect(service.link.label, `${service.id} link needs an accessible label`).toBeTruthy(); expect(service.link.label, `${service.id} link needs an accessible label`).toBeTruthy();
expect(service.link.external).toBe(true); expect(service.link.external).toBe(true);
} }
} }
for (const icon of iconIds) {
expect(verifiedSeedIconIds.has(icon), `${icon} must be verified`).toBe(true);
}
}); });
test("labels fallback values and unresolved adapters explicitly", () => { test("labels fallback values and unresolved adapters explicitly", () => {
const placeholders = collectDatasources(dimensionLabDashboardFixture).filter( const placeholders = collectDatasources(dimensionLabDashboardFixture).filter(
(datasource) => datasource.type === "placeholder", (datasource) => datasource.type === "placeholder",
); );
const details = [ const fallbackText = [
...dimensionLabDashboardFixture.telemetry.map((card) => card.detail || ""), ...dimensionLabDashboardFixture.telemetry.map((card) => card.detail || ""),
...allServices(dimensionLabDashboardFixture).map((service) => service.detail || ""),
...dimensionLabDashboardFixture.statusStrips.flatMap((strip) =>
strip.items.map((item) => item.value),
),
...(dimensionLabDashboardFixture.modules || []).map((module) => module.detail || ""), ...(dimensionLabDashboardFixture.modules || []).map((module) => module.detail || ""),
].join("\n").toLowerCase(); ].join("\n").toLowerCase();
expect(details).toContain("fallback"); expect(fallbackText).toContain("fallback");
for (const service of allServices(dimensionLabDashboardFixture)) {
expect(service.detail?.toLowerCase(), `${service.id} detail must label fallback state`).toContain("fallback");
}
for (const statusItem of dimensionLabDashboardFixture.statusStrips.flatMap((strip) => strip.items)) {
expect(statusItem.value.toLowerCase(), `${statusItem.id} value must label fallback state`).toContain("fallback");
}
expect(placeholders.length).toBeGreaterThan(0); expect(placeholders.length).toBeGreaterThan(0);
for (const datasource of placeholders) { for (const datasource of placeholders) {
expect(datasource.reason.toLowerCase()).toMatch(/fallback|pending|unresolved/); expect(datasource.reason.toLowerCase()).toMatch(/fallback|pending|unresolved/);
@ -92,3 +113,34 @@ function collectDatasources(document: DashboardDocument): DatasourceReference[]
return [...telemetry, ...services, ...modules]; return [...telemetry, ...services, ...modules];
} }
const verifiedSeedIconIds = new Set([
"mdi:account-hard-hat-outline",
"mdi:backup-restore",
"mdi:brain",
"mdi:cpu-64-bit",
"mdi:docker",
"mdi:expansion-card",
"mdi:fan",
"mdi:harddisk",
"mdi:image-edit-outline",
"mdi:memory",
"mdi:pulse",
"mdi:robot-outline",
"mdi:router-network",
"mdi:thermometer",
"mdi:web",
"mdi:weather-sunny",
"simple-icons:adminer",
"simple-icons:amazonwebservices",
"simple-icons:cockpit",
"simple-icons:forgejo",
"simple-icons:grafana",
"simple-icons:n8n",
"simple-icons:ollama",
"simple-icons:postgresql",
"simple-icons:prometheus",
"simple-icons:uptimekuma",
"simple-icons:vaultwarden",
"simple-icons:wikidotjs",
]);

View file

@ -323,7 +323,7 @@ export const dimensionLabDashboardFixture: DashboardDocument = {
id: "aws-start", id: "aws-start",
label: "AWS Start", label: "AWS Start",
description: "AWS access portal", description: "AWS access portal",
icon: "simple-icons:amazonaws", icon: "simple-icons:amazonwebservices",
href: "https://dimensionlab.awsapps.com/start", href: "https://dimensionlab.awsapps.com/start",
datasource: httpStatus("https://dimensionlab.awsapps.com/start"), datasource: httpStatus("https://dimensionlab.awsapps.com/start"),
}), }),
@ -375,7 +375,7 @@ export const dimensionLabDashboardFixture: DashboardDocument = {
id: "open-webui", id: "open-webui",
label: "Open WebUI", label: "Open WebUI",
description: "Chat and model interface", description: "Chat and model interface",
icon: "simple-icons:openwebui", icon: "mdi:web",
href: "https://webui.dimensionlab.net", href: "https://webui.dimensionlab.net",
datasource: httpStatus("https://webui.dimensionlab.net/health"), datasource: httpStatus("https://webui.dimensionlab.net/health"),
}), }),