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
@@ -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<any>;
@@ -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)}`)