mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-14 16:15:46 -07:00
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
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:
@@ -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 =
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user