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
|
|
|
}
|
|
|
|
|
2024-06-21 22:23:07 +02:00
|
|
|
type TerminalConfigType struct {
|
|
|
|
FontSize int `json:"fontsize,omitempty"`
|
|
|
|
FontFamily string `json:"fontfamily,omitempty"`
|
|
|
|
}
|
|
|
|
|
2024-06-20 08:59:41 +02:00
|
|
|
type SettingsConfigType struct {
|
|
|
|
Widgets []WidgetsConfigType `json:"widgets"`
|
2024-06-21 22:23:07 +02:00
|
|
|
Term TerminalConfigType `json:"term"`
|
2024-06-20 08:59:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|