|
|
@ -1,5 +1,13 @@
|
|
|
|
import {Component, OnInit} from '@angular/core';
|
|
|
|
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 {ScrutinyConfigService} from 'app/core/config/scrutiny-config.service';
|
|
|
|
import {Subject} from 'rxjs';
|
|
|
|
import {Subject} from 'rxjs';
|
|
|
|
import {takeUntil} from 'rxjs/operators';
|
|
|
|
import {takeUntil} from 'rxjs/operators';
|
|
|
@ -15,6 +23,8 @@ export class DashboardSettingsComponent implements OnInit {
|
|
|
|
dashboardSort: string;
|
|
|
|
dashboardSort: string;
|
|
|
|
temperatureUnit: string;
|
|
|
|
temperatureUnit: string;
|
|
|
|
theme: string;
|
|
|
|
theme: string;
|
|
|
|
|
|
|
|
statusThreshold: number;
|
|
|
|
|
|
|
|
statusFilterAttributes: number;
|
|
|
|
|
|
|
|
|
|
|
|
// Private
|
|
|
|
// Private
|
|
|
|
private _unsubscribeAll: Subject<any>;
|
|
|
|
private _unsubscribeAll: Subject<any>;
|
|
|
@ -38,6 +48,9 @@ export class DashboardSettingsComponent implements OnInit {
|
|
|
|
this.temperatureUnit = config.temperature_unit;
|
|
|
|
this.temperatureUnit = config.temperature_unit;
|
|
|
|
this.theme = config.theme;
|
|
|
|
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_display: this.dashboardDisplay as DashboardDisplay,
|
|
|
|
dashboard_sort: this.dashboardSort as DashboardSort,
|
|
|
|
dashboard_sort: this.dashboardSort as DashboardSort,
|
|
|
|
temperature_unit: this.temperatureUnit as TemperatureUnit,
|
|
|
|
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
|
|
|
|
this._configService.config = newSettings
|
|
|
|
console.log(`Saved Settings: ${JSON.stringify(newSettings)}`)
|
|
|
|
console.log(`Saved Settings: ${JSON.stringify(newSettings)}`)
|
|
|
|