Status
-
{{ deviceStatusString(deviceSummary.device.device_status) | titlecase}}
+
{{ deviceStatusString(deviceSummary) | titlecase}}
No Data
diff --git a/webapp/frontend/src/app/layout/common/dashboard-device/dashboard-device.component.ts b/webapp/frontend/src/app/layout/common/dashboard-device/dashboard-device.component.ts
index 6262c4f..a8de9d5 100644
--- a/webapp/frontend/src/app/layout/common/dashboard-device/dashboard-device.component.ts
+++ b/webapp/frontend/src/app/layout/common/dashboard-device/dashboard-device.component.ts
@@ -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 {
diff --git a/webapp/frontend/src/app/layout/common/dashboard-settings/dashboard-settings.component.html b/webapp/frontend/src/app/layout/common/dashboard-settings/dashboard-settings.component.html
index a10d550..06cf800 100644
--- a/webapp/frontend/src/app/layout/common/dashboard-settings/dashboard-settings.component.html
+++ b/webapp/frontend/src/app/layout/common/dashboard-settings/dashboard-settings.component.html
@@ -43,63 +43,27 @@
Fahrenheit
-
-
diff --git a/webapp/frontend/src/app/layout/common/dashboard-settings/dashboard-settings.component.ts b/webapp/frontend/src/app/layout/common/dashboard-settings/dashboard-settings.component.ts
index 39110d8..21e8e8e 100644
--- a/webapp/frontend/src/app/layout/common/dashboard-settings/dashboard-settings.component.ts
+++ b/webapp/frontend/src/app/layout/common/dashboard-settings/dashboard-settings.component.ts
@@ -1,5 +1,13 @@
import {Component, OnInit} from '@angular/core';
-import {AppConfig, DashboardDisplay, DashboardSort, TemperatureUnit, Theme} from 'app/core/config/app.config';
+import {
+ AppConfig,
+ DashboardDisplay,
+ DashboardSort,
+ MetricsStatusFilterAttributes,
+ MetricsStatusThreshold,
+ TemperatureUnit,
+ Theme
+} from 'app/core/config/app.config';
import {ScrutinyConfigService} from 'app/core/config/scrutiny-config.service';
import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
@@ -15,6 +23,8 @@ export class DashboardSettingsComponent implements OnInit {
dashboardSort: string;
temperatureUnit: string;
theme: string;
+ statusThreshold: number;
+ statusFilterAttributes: number;
// Private
private _unsubscribeAll: Subject
;
@@ -38,6 +48,9 @@ export class DashboardSettingsComponent implements OnInit {
this.temperatureUnit = config.temperature_unit;
this.theme = config.theme;
+ this.statusFilterAttributes = config.metrics.status_filter_attributes;
+ this.statusThreshold = config.metrics.status_threshold;
+
});
}
@@ -47,7 +60,11 @@ export class DashboardSettingsComponent implements OnInit {
dashboard_display: this.dashboardDisplay as DashboardDisplay,
dashboard_sort: this.dashboardSort as DashboardSort,
temperature_unit: this.temperatureUnit as TemperatureUnit,
- theme: this.theme as Theme
+ theme: this.theme as Theme,
+ metrics: {
+ status_filter_attributes: this.statusFilterAttributes as MetricsStatusFilterAttributes,
+ status_threshold: this.statusThreshold as MetricsStatusThreshold
+ }
}
this._configService.config = newSettings
console.log(`Saved Settings: ${JSON.stringify(newSettings)}`)