Add server-stats widget

This commit is contained in:
Svilen Markov
2025-02-09 17:52:22 +00:00
parent 306fb3cb33
commit 37f35281b4
9 changed files with 746 additions and 26 deletions
+7
View File
@@ -73,6 +73,8 @@ func newWidget(widgetType string) (widget, error) {
w = &customAPIWidget{}
case "docker-containers":
w = &dockerContainersWidget{}
case "server-stats":
w = &serverStatsWidget{}
default:
return nil, fmt.Errorf("unknown widget type: %s", widgetType)
}
@@ -147,6 +149,7 @@ type widgetBase struct {
CSSClass string `yaml:"css-class"`
CustomCacheDuration durationField `yaml:"cache"`
ContentAvailable bool `yaml:"-"`
WIP bool `yaml:"-"`
Error error `yaml:"-"`
Notice error `yaml:"-"`
templateBuffer bytes.Buffer `yaml:"-"`
@@ -173,6 +176,10 @@ func (w *widgetBase) requiresUpdate(now *time.Time) bool {
return now.After(w.nextUpdate)
}
func (w *widgetBase) IsWIP() bool {
return w.WIP
}
func (w *widgetBase) update(ctx context.Context) {
}