frontend, determine the device status by checking against the configured thresholds.

This commit is contained in:
Jason Kulatunga
2022-07-23 16:11:49 -07:00
parent 94594db20a
commit 7a68a68e76
5 changed files with 56 additions and 66 deletions
@@ -68,7 +68,15 @@ export class DashboardDeviceComponent implements OnInit {
}
}
deviceStatusString(deviceStatus: number): string {
deviceStatusString(deviceSummary: DeviceSummaryModel): string {
// no smart data, so treat the device status as unknown
if (!deviceSummary.smart) {
return 'unknown'
}
// determine the device status, by comparing it against the allowed threshold
// tslint:disable-next-line:no-bitwise
const deviceStatus = deviceSummary.device.device_status & this.config.metrics.status_threshold
if (deviceStatus === 0) {
return 'passed'
} else {