diff --git a/src/widgets/scrutiny/component.jsx b/src/widgets/scrutiny/component.jsx index 2450a95e0..dd870516a 100644 --- a/src/widgets/scrutiny/component.jsx +++ b/src/widgets/scrutiny/component.jsx @@ -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 = diff --git a/src/widgets/scrutiny/component.test.jsx b/src/widgets/scrutiny/component.test.jsx index 03e85c4b9..ba551a8fd 100644 --- a/src/widgets/scrutiny/component.test.jsx +++ b/src/widgets/scrutiny/component.test.jsx @@ -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(, { + settings: { hideErrors: false }, + }); + + expectBlockValue(container, "scrutiny.passed", 1); + expectBlockValue(container, "scrutiny.failed", 0); + expectBlockValue(container, "scrutiny.unknown", 0); + }); });