2024-06-20 08:59:41 +02:00
|
|
|
package wconfig
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
|
|
|
|
"github.com/wavetermdev/thenextwave/pkg/wavebase"
|
|
|
|
"github.com/wavetermdev/thenextwave/pkg/wstore"
|
|
|
|
)
|
|
|
|
|
|
|
|
const settingsFile = "settings.json"
|
|
|
|
|
|
|
|
var settingsAbsPath = filepath.Join(configDirAbsPath, settingsFile)
|
|
|
|
|
|
|
|
type WidgetsConfigType struct {
|
2024-06-20 22:03:50 +02:00
|
|
|
Icon string `json:"icon"`
|
|
|
|
Color string `json:"color,omitempty"`
|
|
|
|
Label string `json:"label,omitempty"`
|
|
|
|
Description string `json:"description,omitempty"`
|
|
|
|
BlockDef wstore.BlockDef `json:"blockdef"`
|
2024-06-20 08:59:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type SettingsConfigType struct {
|
|
|
|
Widgets []WidgetsConfigType `json:"widgets"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func getSettingsConfigDefaults() SettingsConfigType {
|
|
|
|
return SettingsConfigType{
|
|
|
|
Widgets: []WidgetsConfigType{
|
|
|
|
{
|
|
|
|
Icon: "fa fa-solid fa-files fa-fw",
|
|
|
|
BlockDef: wstore.BlockDef{
|
|
|
|
View: "preview",
|
|
|
|
Meta: map[string]any{"file": wavebase.GetHomeDir()},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Icon: "fa fa-solid fa-chart-simple fa-fw",
|
|
|
|
BlockDef: wstore.BlockDef{
|
|
|
|
View: "plot",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|