diff --git a/webapp/backend/pkg/database/scrutiny_repository_migrations.go b/webapp/backend/pkg/database/scrutiny_repository_migrations.go index e1b948b..829c833 100644 --- a/webapp/backend/pkg/database/scrutiny_repository_migrations.go +++ b/webapp/backend/pkg/database/scrutiny_repository_migrations.go @@ -332,6 +332,12 @@ func (sr *scrutinyRepository) Migrate(ctx context.Context) error { SettingDataType: "string", SettingValueString: "smooth", }, + { + SettingKeyName: "powered_on_hours_unit", + SettingKeyDescription: "Presentation format for device powered on time ('humanize' | 'device-hours')", + SettingDataType: "string", + SettingValueString: "humanize", + }, { SettingKeyName: "metrics.notify_level", diff --git a/webapp/backend/pkg/models/settings.go b/webapp/backend/pkg/models/settings.go index e564301..d40e3e9 100644 --- a/webapp/backend/pkg/models/settings.go +++ b/webapp/backend/pkg/models/settings.go @@ -8,13 +8,14 @@ package models //} type Settings struct { - Theme string `json:"theme" mapstructure:"theme"` - Layout string `json:"layout" mapstructure:"layout"` - DashboardDisplay string `json:"dashboard_display" mapstructure:"dashboard_display"` - 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"` + Theme string `json:"theme" mapstructure:"theme"` + Layout string `json:"layout" mapstructure:"layout"` + DashboardDisplay string `json:"dashboard_display" mapstructure:"dashboard_display"` + 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"` + PoweredOnHoursUnit string `json:"powered_on_hours_unit" mapstructure:"powered_on_hours_unit"` 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 1b6dfe3..c5a1f6f 100644 --- a/webapp/frontend/src/app/core/config/app.config.ts +++ b/webapp/frontend/src/app/core/config/app.config.ts @@ -12,6 +12,8 @@ export type TemperatureUnit = 'celsius' | 'fahrenheit' export type LineStroke = 'smooth' | 'straight' | 'stepline' +export type DevicePoweredOnUnit = 'humanize' | 'device_hours' + export enum MetricsNotifyLevel { Warn = 1, @@ -47,6 +49,8 @@ export interface AppConfig { file_size_si_units?: boolean; + powered_on_hours_unit?: DevicePoweredOnUnit; + line_stroke?: LineStroke; // Settings from Scrutiny API @@ -77,6 +81,7 @@ export const appConfig: AppConfig = { temperature_unit: 'celsius', file_size_si_units: false, + powered_on_hours_unit: 'humanize', line_stroke: 'smooth', 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 0eb9a03..970044c 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 @@ -54,6 +54,14 @@