Fix: ignore archived drives in Scrutiny widget (#6903)
Docker CI / Docker Build & Push (push) Has been cancelled
Lint / Linting Checks (push) Has been cancelled
Release Drafter / Update Release Draft (push) Has been cancelled
Release Drafter / Auto Label PR (push) Has been cancelled
Tests / vitest (1) (push) Has been cancelled
Tests / vitest (2) (push) Has been cancelled
Tests / vitest (3) (push) Has been cancelled
Tests / vitest (4) (push) Has been cancelled

This commit is contained in:
Martin Fournier
2026-07-27 09:19:50 -04:00
committed by GitHub
parent b55da10ae9
commit 70f3b1165a
2 changed files with 32 additions and 1 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ export default function Component({ service }) {
);
}
const deviceIds = Object.values(scrutinyData.data.summary);
const deviceIds = Object.values(scrutinyData.data.summary).filter(({ device }) => !device.archived);
const statusThreshold = scrutinySettings.settings.metrics.status_threshold;
const failed =
+31
View File
@@ -60,4 +60,35 @@ describe("widgets/scrutiny/component", () => {
expectBlockValue(container, "scrutiny.failed", 1);
expectBlockValue(container, "scrutiny.unknown", 1);
});
it("excludes archived devices", () => {
useWidgetAPI.mockImplementation((_widget, endpoint) => {
if (endpoint === "settings") {
return { data: { settings: { metrics: { status_threshold: 2 } } }, error: undefined };
}
if (endpoint === "summary") {
return {
data: {
data: {
summary: {
active: { device: { archived: false, device_status: 0 } },
archivedPassed: { device: { archived: true, device_status: 0 } },
archivedFailed: { device: { archived: true, device_status: 2 } },
},
},
},
error: undefined,
};
}
return { data: undefined, error: undefined };
});
const { container } = renderWithProviders(<Component service={{ widget: { type: "scrutiny" } }} />, {
settings: { hideErrors: false },
});
expectBlockValue(container, "scrutiny.passed", 1);
expectBlockValue(container, "scrutiny.failed", 0);
expectBlockValue(container, "scrutiny.unknown", 0);
});
});