diff --git a/main.go b/main.go index 4e2e58e..b6fb4cc 100644 --- a/main.go +++ b/main.go @@ -30,7 +30,7 @@ import ( //go:embed static var staticFiles embed.FS -const version = "0.8.1" +const version = "0.8.2" // --------------------------------------------------------------------------- // Config structs @@ -100,6 +100,7 @@ type ModulesConfig struct { ShowIntelligence *bool `yaml:"show_intelligence,omitempty"` ShowAlarmTimeline *bool `yaml:"show_alarm_timeline,omitempty"` ShowGauges *bool `yaml:"show_gauges,omitempty"` + ShowGaugeDigital *bool `yaml:"show_gauge_digital,omitempty"` ShowTrendChart *bool `yaml:"show_trend_chart,omitempty"` } @@ -171,6 +172,7 @@ func defaultConfig() Config { ShowIntelligence: boolPtr(true), ShowAlarmTimeline: boolPtr(true), ShowGauges: boolPtr(true), + ShowGaugeDigital: boolPtr(false), ShowTrendChart: boolPtr(true), }, DB: DBConfig{ @@ -272,6 +274,7 @@ func normalizeConfig(cfg *Config) { setIfNilBool(&cfg.Modules.ShowIntelligence, boolValue(def.Modules.ShowIntelligence, true)) setIfNilBool(&cfg.Modules.ShowAlarmTimeline, boolValue(def.Modules.ShowAlarmTimeline, true)) setIfNilBool(&cfg.Modules.ShowGauges, boolValue(def.Modules.ShowGauges, true)) + setIfNilBool(&cfg.Modules.ShowGaugeDigital, boolValue(def.Modules.ShowGaugeDigital, false)) setIfNilBool(&cfg.Modules.ShowTrendChart, boolValue(def.Modules.ShowTrendChart, true)) setIfEmpty(&cfg.DB.Path, def.DB.Path) @@ -443,6 +446,7 @@ type PageData struct { ShowIntelligence bool ShowAlarmTimeline bool ShowGauges bool + ShowGaugeDigital bool ShowTrendChart bool } @@ -1608,6 +1612,7 @@ func initCachedUI() { ShowIntelligence: boolValue(cfg.Modules.ShowIntelligence, true), ShowAlarmTimeline: boolValue(cfg.Modules.ShowAlarmTimeline, true), ShowGauges: boolValue(cfg.Modules.ShowGauges, true), + ShowGaugeDigital: boolValue(cfg.Modules.ShowGaugeDigital, false), ShowTrendChart: boolValue(cfg.Modules.ShowTrendChart, true), } @@ -1857,14 +1862,60 @@ const uiHTML = ` .soft-glow-yellow { box-shadow: 0 0 0 1px rgba(234,179,8,0.28), 0 0 38px rgba(234,179,8,0.08); } .soft-glow-red { box-shadow: 0 0 0 1px rgba(239,68,68,0.28), 0 0 38px rgba(239,68,68,0.08); } + .gauge-header-row { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 24px; + margin-bottom: 10px; + } + + .gauge-head { + display: flex; + align-items: center; + justify-content: center; + gap: 16px; + text-align: center; + margin-bottom: 10px; + } + + .gauge-head.with-digital { + justify-content: flex-start; + text-align: left; + margin-bottom: 0; + } + + .gauge-head-copy { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + } + + .gauge-head-copy.with-digital { + align-items: flex-start; + } + + .gauge-digital { + text-align: right; + flex-shrink: 0; + } + .gauge-container { position: relative; width: 100%; - max-width: 500px; - height: 360px; + max-width: 720px; margin: 0 auto; } + .gauge-container.no-digital { + height: clamp(430px, 48vw, 560px); + } + + .gauge-container.with-digital { + height: clamp(360px, 42vw, 500px); + } + .gauge-canvas { width: 100%; height: 100%; @@ -2296,46 +2347,66 @@ const uiHTML = ` {{if .ShowGauges}}