Adds display unit preference (#938)

* Adds temperature unit preference

* add unit preferences for networking

* adds options for MB/s and bps.

* supports disk throughput unit preferences
This commit is contained in:
Anish Chanda
2025-07-14 13:46:13 -05:00
committed by GitHub
parent 926e807020
commit 6576141f54
9 changed files with 268 additions and 18 deletions

View File

@@ -17,6 +17,9 @@ type UserSettings struct {
ChartTime string `json:"chartTime"`
NotificationEmails []string `json:"emails"`
NotificationWebhooks []string `json:"webhooks"`
TemperatureUnit string `json:"temperatureUnit"` // "celsius" or "fahrenheit"
NetworkUnit string `json:"networkUnit"` // "mbps" (MB/s) or "bps"
DiskUnit string `json:"diskUnit"` // "mbps" (MB/s) or "bps"
// Language string `json:"lang"`
}
@@ -43,6 +46,9 @@ func (um *UserManager) InitializeUserSettings(e *core.RecordEvent) error {
ChartTime: "1h",
NotificationEmails: []string{},
NotificationWebhooks: []string{},
TemperatureUnit: "celsius",
NetworkUnit: "mbps",
DiskUnit: "mbps",
}
record.UnmarshalJSONField("settings", &settings)
if len(settings.NotificationEmails) == 0 {