mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-04 14:33:41 +01:00
change calculation of passed devices
This commit is contained in:
parent
cbf72eedab
commit
90cb395dc6
@ -9,7 +9,10 @@ export default function Component({ service }) {
|
|||||||
passed: 0,
|
passed: 0,
|
||||||
failed_smart: 1,
|
failed_smart: 1,
|
||||||
failed_scrutiny: 2,
|
failed_scrutiny: 2,
|
||||||
failed_both: 3
|
failed_both: 3,
|
||||||
|
|
||||||
|
isFailed: function ( s ) { return s > this.passed && s <= this.failed_both},
|
||||||
|
isUnknown: function ( s ) { return s < this.passed || s > this.failed_both}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @see https://github.com/AnalogJ/scrutiny/blob/d8d56f77f9e868127c4849dac74d65512db658e8/webapp/frontend/src/app/core/config/app.config.ts
|
// @see https://github.com/AnalogJ/scrutiny/blob/d8d56f77f9e868127c4849dac74d65512db658e8/webapp/frontend/src/app/core/config/app.config.ts
|
||||||
@ -42,9 +45,9 @@ export default function Component({ service }) {
|
|||||||
const deviceIds = Object.values(scrutinyData.data.summary);
|
const deviceIds = Object.values(scrutinyData.data.summary);
|
||||||
const statusThreshold = scrutinySettings.settings.metrics.status_threshold;
|
const statusThreshold = scrutinySettings.settings.metrics.status_threshold;
|
||||||
|
|
||||||
const failed = deviceIds.filter(deviceId => (deviceId.device.device_status > 0 && statusThreshold === DeviceStatusThreshold.both) || [statusThreshold, DeviceStatus.failed_both].includes(deviceId.device.device_status))?.length || 0;
|
const failed = deviceIds.filter(deviceId => (DeviceStatus.isFailed(deviceId.device.device_status) && statusThreshold === DeviceStatusThreshold.both) || [statusThreshold, DeviceStatus.failed_both].includes(deviceId.device.device_status))?.length || 0;
|
||||||
const unknown = deviceIds.filter(deviceId => deviceId.device.device_status < DeviceStatus.passed || deviceId.device.device_status > DeviceStatus.failed_both)?.length || 0;
|
const unknown = deviceIds.filter(deviceId => DeviceStatus.isUnknown(deviceId.device.device_status))?.length || 0;
|
||||||
const passed = deviceIds.filter(deviceId => deviceId.device.device_status === 0 || (deviceId.device.device_status > statusThreshold && deviceId.device.device_status < DeviceStatus.failed_both))?.length || 0;
|
const passed = deviceIds.length - (failed + unknown);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
@ -52,7 +55,7 @@ export default function Component({ service }) {
|
|||||||
<Block label="scrutiny.failed" value={failed} />
|
<Block label="scrutiny.failed" value={failed} />
|
||||||
<Block label="scrutiny.unknown" value={unknown} />
|
<Block label="scrutiny.unknown" value={unknown} />
|
||||||
</Container>
|
</Container>
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user