frontend, determine the device status by checking against the configured thresholds.
This commit is contained in:
+18
-54
@@ -43,63 +43,27 @@
|
||||
<mat-option value="fahrenheit">Fahrenheit</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="flex">
|
||||
<mat-tab-group mat-align-tabs="start">
|
||||
<mat-tab label="Ata">
|
||||
<div class="flex flex-col mt-5 gt-md:flex-row">
|
||||
<mat-form-field class="flex-auto gt-xs:pr-3 gt-md:pr-3">
|
||||
<mat-label>Device Status - Filter Attributes</mat-label>
|
||||
<mat-select [(ngModel)]=statusFilterAttributes>
|
||||
<mat-option [value]=0>All</mat-option>
|
||||
<mat-option [value]=1>Critical</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div matTooltip="not yet implemented" class="flex flex-col mt-5 gt-md:flex-row">
|
||||
<mat-form-field class="flex-auto gt-md:pr-3">
|
||||
<mat-label class="text-hint">Critical Error Threshold</mat-label>
|
||||
<input disabled matInput [value]="'10%'">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="flex-auto gt-md:pl-3">
|
||||
<mat-label class="text-hint">Critical Warning Threshold</mat-label>
|
||||
<input disabled matInput>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div matTooltip="not yet implemented" class="flex flex-col gt-md:flex-row">
|
||||
<mat-form-field class="flex-auto gt-md:pr-3">
|
||||
<mat-label class="text-hint">Error Threshold</mat-label>
|
||||
<input disabled matInput [value]="'20%'">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="flex-auto gt-md:pl-3">
|
||||
<mat-label class="text-hint">Warning Threshold</mat-label>
|
||||
<input disabled matInput [value]="'10%'">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</mat-tab>
|
||||
<mat-tab label="NVMe">
|
||||
|
||||
<div matTooltip="not yet implemented" class="flex flex-col mt-5 gt-md:flex-row">
|
||||
<mat-form-field class="flex-auto gt-md:pr-3">
|
||||
<mat-label class="text-hint">Critical Error Threshold</mat-label>
|
||||
<input disabled matInput [value]="'enabled'">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="flex-auto gt-md:pl-3">
|
||||
<mat-label class="text-hint">Critical Warning Threshold</mat-label>
|
||||
<input disabled matInput>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</mat-tab>
|
||||
<mat-tab label="SCSI">
|
||||
<div matTooltip="not yet implemented" class="flex flex-col mt-5 gt-md:flex-row">
|
||||
<mat-form-field class="flex-auto gt-md:pr-3">
|
||||
<mat-label class="text-hint">Critical Error Threshold</mat-label>
|
||||
<input disabled matInput [value]="'enabled'">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="flex-auto gt-md:pl-3">
|
||||
<mat-label class="text-hint">Critical Warning Threshold</mat-label>
|
||||
<input disabled matInput>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
<div class="flex flex-col mt-5 gt-md:flex-row">
|
||||
<mat-form-field class="flex-auto gt-xs:pr-3 gt-md:pr-3">
|
||||
<mat-label>Device Status - Thresholds</mat-label>
|
||||
<mat-select [(ngModel)]=statusThreshold>
|
||||
<mat-option [value]=1>Smart</mat-option>
|
||||
<mat-option [value]=2>Scrutiny</mat-option>
|
||||
<mat-option [value]=3>Both</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+19
-2
@@ -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)}`)
|
||||
|
||||
Reference in New Issue
Block a user