fix: complete model renderer states and ids

This commit is contained in:
vince 2026-06-18 19:29:30 +02:00
parent fede33e8a7
commit c2fb20b066
11 changed files with 84 additions and 7 deletions

View file

@ -44,7 +44,7 @@
{/each}
</section>
<StatusStrip items={dashboard.statusItems} />
<StatusStrip id={dashboard.statusStripId} items={dashboard.statusItems} />
</main>
<style>

View file

@ -7,11 +7,13 @@
let { group }: { group: UiServiceGroup } = $props();
</script>
<Panel title={group.title}>
<div class="service-panel" data-model-id={group.id}>
<Panel title={group.title}>
{#if group.summary?.length}
<StatusStrip items={group.summary} compact />
<StatusStrip id={`${group.id}:summary`} items={group.summary} compact />
{/if}
{#each group.services as service (service.id)}
<ServiceRow {service} />
{/each}
</Panel>
</Panel>
</div>

View file

@ -3,15 +3,17 @@
import FooterCell from "./FooterCell.svelte";
let {
id,
items,
compact = false,
}: {
id?: string;
items: UiStatusItem[];
compact?: boolean;
} = $props();
</script>
<section class="status-strip" data-compact={compact}>
<section class="status-strip" data-compact={compact} data-model-id={id}>
{#each items as item (item.id)}
<FooterCell {item} />
{/each}

View file

@ -70,6 +70,17 @@ describe("dashboard UI components", () => {
expect(footer.body).toContain("href=\"https://example.test/status\"");
});
test("renders stable model IDs on group and status containers", () => {
const { body } = render(DashboardFrame, {
props: {
dashboard: dashboardPreviewFixtures.primary,
},
});
expect(body).toContain("data-model-id=\"queue-workers\"");
expect(body).toContain("data-model-id=\"dashboard-status\"");
});
test("does not render progress bars for non-percent metrics without explicit progress", () => {
const withoutProgress = render(TelemetryCard, {
props: {