diff --git a/webapp/backend/pkg/database/scrutiny_repository_migrations.go b/webapp/backend/pkg/database/scrutiny_repository_migrations.go index 015428cc..542677f5 100644 --- a/webapp/backend/pkg/database/scrutiny_repository_migrations.go +++ b/webapp/backend/pkg/database/scrutiny_repository_migrations.go @@ -325,6 +325,12 @@ func (sr *scrutinyRepository) Migrate(ctx context.Context) error { SettingDataType: "bool", SettingValueBool: false, }, + { + SettingKeyName: "line_stroke", + SettingKeyDescription: "Temperature chart line stroke ('smooth' | 'straight' | 'stepline')", + SettingDataType: "string", + SettingValueString: "smooth", + }, { SettingKeyName: "metrics.notify_level", @@ -348,6 +354,21 @@ func (sr *scrutinyRepository) Migrate(ctx context.Context) error { return tx.Create(&defaultSettings).Error }, }, + { + ID: "m20221115214900", // add line_stroke setting. + Migrate: func(tx *gorm.DB) error { + //add line_stroke setting default. + var defaultSettings = []m20220716214900.Setting{ + { + SettingKeyName: "line_stroke", + SettingKeyDescription: "Temperature chart line stroke ('smooth' | 'straight' | 'stepline')", + SettingDataType: "string", + SettingValueString: "smooth", + }, + } + return tx.Create(&defaultSettings).Error + }, + }, }) if err := m.Migrate(); err != nil { diff --git a/webapp/backend/pkg/models/settings.go b/webapp/backend/pkg/models/settings.go index f06db846..f5564ef6 100644 --- a/webapp/backend/pkg/models/settings.go +++ b/webapp/backend/pkg/models/settings.go @@ -14,6 +14,7 @@ type Settings struct { DashboardSort string `json:"dashboard_sort" mapstructure:"dashboard_sort"` TemperatureUnit string `json:"temperature_unit" mapstructure:"temperature_unit"` FileSizeSIUnits bool `json:"file_size_si_units" mapstructure:"file_size_si_units"` + LineStroke string `json:"line_stroke" mapstructure:"line_stroke"` Metrics struct { NotifyLevel int `json:"notify_level" mapstructure:"notify_level"` diff --git a/webapp/frontend/src/app/core/config/app.config.ts b/webapp/frontend/src/app/core/config/app.config.ts index 92f04512..c48d25a2 100644 --- a/webapp/frontend/src/app/core/config/app.config.ts +++ b/webapp/frontend/src/app/core/config/app.config.ts @@ -10,6 +10,8 @@ export type DashboardSort = 'status' | 'title' | 'age' export type TemperatureUnit = 'celsius' | 'fahrenheit' +export type LineStroke = 'smooth' | 'straight' | 'stepline' + export enum MetricsNotifyLevel { Warn = 1, @@ -45,6 +47,8 @@ export interface AppConfig { file_size_si_units?: boolean; + line_stroke?: LineStroke; + // Settings from Scrutiny API metrics?: { @@ -73,6 +77,8 @@ export const appConfig: AppConfig = { temperature_unit: 'celsius', file_size_si_units: false, + line_stroke: 'smooth', + metrics: { notify_level: MetricsNotifyLevel.Fail, status_filter_attributes: MetricsStatusFilterAttributes.All, 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 750d54db..69ebd76d 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 @@ -53,6 +53,17 @@