mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-400 ResourceUsage extracted to new config format
This commit is contained in:
parent
e55cf754b3
commit
8df624f2c0
3
main.go
3
main.go
@ -268,7 +268,8 @@ func makeWidget(app *tview.Application, pages *tview.Pages, widgetName string) w
|
||||
settings := prettyweather.NewSettingsFromYAML(wtf.Config)
|
||||
widget = prettyweather.NewWidget(app, settings)
|
||||
case "resourceusage":
|
||||
widget = resourceusage.NewWidget(app)
|
||||
settings := resourceusage.NewSettingsFromYAML(wtf.Config)
|
||||
widget = resourceusage.NewWidget(app, settings)
|
||||
case "security":
|
||||
widget = security.NewWidget(app)
|
||||
case "status":
|
||||
|
18
modules/resourceusage/settings.go
Normal file
18
modules/resourceusage/settings.go
Normal file
@ -0,0 +1,18 @@
|
||||
package resourceusage
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
}
|
@ -17,12 +17,16 @@ var ok = true
|
||||
// Widget define wtf widget to register widget later
|
||||
type Widget struct {
|
||||
wtf.BarGraph
|
||||
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget(app *tview.Application) *Widget {
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
BarGraph: wtf.NewBarGraph(app, "Resource Usage", "resourceusage", false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
widget.View.SetWrap(false)
|
||||
|
Loading…
x
Reference in New Issue
Block a user