feat: dynamic line stroke settings
This commit is contained in:
@@ -325,6 +325,12 @@ func (sr *scrutinyRepository) Migrate(ctx context.Context) error {
|
|||||||
SettingDataType: "bool",
|
SettingDataType: "bool",
|
||||||
SettingValueBool: false,
|
SettingValueBool: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
SettingKeyName: "line_stroke",
|
||||||
|
SettingKeyDescription: "Temperature chart line stroke ('smooth' | 'straight' | 'stepline')",
|
||||||
|
SettingDataType: "string",
|
||||||
|
SettingValueString: "smooth",
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
SettingKeyName: "metrics.notify_level",
|
SettingKeyName: "metrics.notify_level",
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ type Settings struct {
|
|||||||
DashboardSort string `json:"dashboard_sort" mapstructure:"dashboard_sort"`
|
DashboardSort string `json:"dashboard_sort" mapstructure:"dashboard_sort"`
|
||||||
TemperatureUnit string `json:"temperature_unit" mapstructure:"temperature_unit"`
|
TemperatureUnit string `json:"temperature_unit" mapstructure:"temperature_unit"`
|
||||||
FileSizeSIUnits bool `json:"file_size_si_units" mapstructure:"file_size_si_units"`
|
FileSizeSIUnits bool `json:"file_size_si_units" mapstructure:"file_size_si_units"`
|
||||||
|
LineStroke string `json:"line_stroke" mapstructure:"line_stroke"`
|
||||||
|
|
||||||
Metrics struct {
|
Metrics struct {
|
||||||
NotifyLevel int `json:"notify_level" mapstructure:"notify_level"`
|
NotifyLevel int `json:"notify_level" mapstructure:"notify_level"`
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ export type DashboardSort = 'status' | 'title' | 'age'
|
|||||||
|
|
||||||
export type TemperatureUnit = 'celsius' | 'fahrenheit'
|
export type TemperatureUnit = 'celsius' | 'fahrenheit'
|
||||||
|
|
||||||
|
export type LineStroke = 'smooth' | 'straight' | 'stepline'
|
||||||
|
|
||||||
|
|
||||||
export enum MetricsNotifyLevel {
|
export enum MetricsNotifyLevel {
|
||||||
Warn = 1,
|
Warn = 1,
|
||||||
@@ -45,6 +47,8 @@ export interface AppConfig {
|
|||||||
|
|
||||||
file_size_si_units?: boolean;
|
file_size_si_units?: boolean;
|
||||||
|
|
||||||
|
line_stroke?: LineStroke;
|
||||||
|
|
||||||
// Settings from Scrutiny API
|
// Settings from Scrutiny API
|
||||||
|
|
||||||
metrics?: {
|
metrics?: {
|
||||||
@@ -73,6 +77,8 @@ export const appConfig: AppConfig = {
|
|||||||
temperature_unit: 'celsius',
|
temperature_unit: 'celsius',
|
||||||
file_size_si_units: false,
|
file_size_si_units: false,
|
||||||
|
|
||||||
|
line_stroke: 'smooth',
|
||||||
|
|
||||||
metrics: {
|
metrics: {
|
||||||
notify_level: MetricsNotifyLevel.Fail,
|
notify_level: MetricsNotifyLevel.Fail,
|
||||||
status_filter_attributes: MetricsStatusFilterAttributes.All,
|
status_filter_attributes: MetricsStatusFilterAttributes.All,
|
||||||
|
|||||||
+11
@@ -53,6 +53,17 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<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>Line stroke</mat-label>
|
||||||
|
<mat-select [(ngModel)]="lineStroke">
|
||||||
|
<mat-option value="smooth">Smooth</mat-option>
|
||||||
|
<mat-option value="straight">Straight</mat-option>
|
||||||
|
<mat-option value="stepline">Stepline</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col mt-5 gt-md:flex-row">
|
<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-form-field class="flex-auto gt-xs:pr-3 gt-md:pr-3">
|
||||||
<mat-label>Device Status - Thresholds</mat-label>
|
<mat-label>Device Status - Thresholds</mat-label>
|
||||||
|
|||||||
+4
@@ -6,6 +6,7 @@ import {
|
|||||||
MetricsStatusFilterAttributes,
|
MetricsStatusFilterAttributes,
|
||||||
MetricsStatusThreshold,
|
MetricsStatusThreshold,
|
||||||
TemperatureUnit,
|
TemperatureUnit,
|
||||||
|
LineStroke,
|
||||||
Theme
|
Theme
|
||||||
} from 'app/core/config/app.config';
|
} from 'app/core/config/app.config';
|
||||||
import {ScrutinyConfigService} from 'app/core/config/scrutiny-config.service';
|
import {ScrutinyConfigService} from 'app/core/config/scrutiny-config.service';
|
||||||
@@ -23,6 +24,7 @@ export class DashboardSettingsComponent implements OnInit {
|
|||||||
dashboardSort: string;
|
dashboardSort: string;
|
||||||
temperatureUnit: string;
|
temperatureUnit: string;
|
||||||
fileSizeSIUnits: boolean;
|
fileSizeSIUnits: boolean;
|
||||||
|
lineStroke: string;
|
||||||
theme: string;
|
theme: string;
|
||||||
statusThreshold: number;
|
statusThreshold: number;
|
||||||
statusFilterAttributes: number;
|
statusFilterAttributes: number;
|
||||||
@@ -48,6 +50,7 @@ export class DashboardSettingsComponent implements OnInit {
|
|||||||
this.dashboardSort = config.dashboard_sort;
|
this.dashboardSort = config.dashboard_sort;
|
||||||
this.temperatureUnit = config.temperature_unit;
|
this.temperatureUnit = config.temperature_unit;
|
||||||
this.fileSizeSIUnits = config.file_size_si_units;
|
this.fileSizeSIUnits = config.file_size_si_units;
|
||||||
|
this.lineStroke = config.line_stroke;
|
||||||
this.theme = config.theme;
|
this.theme = config.theme;
|
||||||
|
|
||||||
this.statusFilterAttributes = config.metrics.status_filter_attributes;
|
this.statusFilterAttributes = config.metrics.status_filter_attributes;
|
||||||
@@ -63,6 +66,7 @@ export class DashboardSettingsComponent implements OnInit {
|
|||||||
dashboard_sort: this.dashboardSort as DashboardSort,
|
dashboard_sort: this.dashboardSort as DashboardSort,
|
||||||
temperature_unit: this.temperatureUnit as TemperatureUnit,
|
temperature_unit: this.temperatureUnit as TemperatureUnit,
|
||||||
file_size_si_units: this.fileSizeSIUnits,
|
file_size_si_units: this.fileSizeSIUnits,
|
||||||
|
line_stroke: this.lineStroke as LineStroke,
|
||||||
theme: this.theme as Theme,
|
theme: this.theme as Theme,
|
||||||
metrics: {
|
metrics: {
|
||||||
status_filter_attributes: this.statusFilterAttributes as MetricsStatusFilterAttributes,
|
status_filter_attributes: this.statusFilterAttributes as MetricsStatusFilterAttributes,
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy
|
|||||||
},
|
},
|
||||||
series : this._deviceDataTemperatureSeries(),
|
series : this._deviceDataTemperatureSeries(),
|
||||||
stroke : {
|
stroke : {
|
||||||
curve: 'straight',
|
curve: this.config.line_stroke,
|
||||||
width: 2
|
width: 2
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
|
|||||||
Reference in New Issue
Block a user