perf(web): queue dashboard tile hydration
This commit is contained in:
parent
83c2c0f4a4
commit
fd0559a143
4 changed files with 194 additions and 6 deletions
|
|
@ -82,4 +82,42 @@ describe("React app dashboard state view", () => {
|
|||
id: "auto-refresh",
|
||||
});
|
||||
});
|
||||
|
||||
test("prioritizes status, telemetry, modules, then services for hydration", () => {
|
||||
const tiles = dashboardHydrationTiles(dimensionLabDashboardFixture);
|
||||
const kinds = tiles.map((tile) => tile.kind);
|
||||
const firstServiceIndex = kinds.indexOf("service");
|
||||
|
||||
expect(kinds.slice(0, 5)).toEqual([
|
||||
"status",
|
||||
"status",
|
||||
"status",
|
||||
"status",
|
||||
"status",
|
||||
]);
|
||||
expect(kinds.lastIndexOf("telemetry")).toBeLessThan(kinds.indexOf("module"));
|
||||
expect(kinds.lastIndexOf("module")).toBeLessThan(firstServiceIndex);
|
||||
expect(
|
||||
tiles.filter((tile) => tile.kind === "telemetry").map((tile) => tile.id),
|
||||
).toEqual(
|
||||
dimensionLabDashboardFixture.telemetry
|
||||
.filter((card) => card.datasource?.type === "external")
|
||||
.map((card) => card.id),
|
||||
);
|
||||
expect(
|
||||
tiles.filter((tile) => tile.kind === "service").map((tile) => ({
|
||||
groupId: tile.groupId,
|
||||
id: tile.id,
|
||||
})),
|
||||
).toEqual(
|
||||
dimensionLabDashboardFixture.serviceGroups.flatMap((group) =>
|
||||
group.services
|
||||
.filter((service) => service.datasource?.type === "external")
|
||||
.map((service) => ({
|
||||
groupId: group.id,
|
||||
id: service.id,
|
||||
}))
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue