summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-23 00:51:28 -0600
committerJeff Carr <[email protected]>2025-02-23 13:13:30 -0600
commit69b0d4c01345b13955ea42115beef3072b082b39 (patch)
tree8a53898139f86ee265a3abe6d91dceac723dbbe2
parent522723e9468fefabec1bb4bbd5b12c6fec51666d (diff)
add hypervisors table
-rw-r--r--doGui.go61
-rw-r--r--windowGeneric.go21
2 files changed, 74 insertions, 8 deletions
diff --git a/doGui.go b/doGui.go
index 2f63e37..85f10bf 100644
--- a/doGui.go
+++ b/doGui.go
@@ -51,8 +51,17 @@ func drawWindow(win *gadgets.BasicWindow) {
group1 := vbox.NewGroup("Zookeeper Settings")
grid := group1.NewGrid("buildOptions", 0, 0)
+ var hyperWin *genericWindow
+ grid.NewButton("hypervisors", func() {
+ if hyperWin != nil {
+ hyperWin.Toggle()
+ return
+ }
+ hyperWin = makeHypervisorsWindow(me.cluster.H)
+ })
+
var testWin *genericWindow
- grid.NewButton("machine list", func() {
+ grid.NewButton("all defined droplets", func() {
if testWin != nil {
testWin.Toggle()
return
@@ -106,11 +115,17 @@ func makeDropletsWindow(pb *virtpb.Droplets) *genericWindow {
log.Info("?")
})
grid.NextRow()
- grid.NewButton("smore", func() {
+ grid.NewButton("2nd row", func() {
+ log.Info("smore")
+ })
+ win.middle.NewButton("middle", func() {
+ log.Info("smore")
+ })
+ win.middle.NewButton("middle", func() {
log.Info("smore")
})
- tbox := win.win.Box().Vertical() // a vertical box (like a stack of books)
+ tbox := win.bottom.Box() // a vertical box (like a stack of books)
t := pb.NewTable("test 2")
t.SetParent(tbox)
t.AddHostname()
@@ -133,3 +148,43 @@ func makeDropletsWindow(pb *virtpb.Droplets) *genericWindow {
t.ShowTable()
return win
}
+
+func makeHypervisorsWindow(pb *virtpb.Hypervisors) *genericWindow {
+ win := initGenericWindow("Hypervisors registered with Virtigo", "Buttons of things")
+ grid := win.group.RawGrid()
+ grid.NewButton("List", func() {
+ log.Info("list...")
+ })
+ grid.NewButton("more", func() {
+ log.Info("?")
+ })
+ grid.NextRow()
+ grid.NewButton("smore", func() {
+ log.Info("smore")
+ })
+
+ tbox := win.bottom.Box() // a vertical box (like a stack of books)
+ t := pb.NewTable("test 2")
+ t.SetParent(tbox)
+ t.AddHostname()
+ t.AddMemory()
+ t.AddCpus()
+ /*
+ t.AddStringFunc("State", func(d *virtpb.Hypervisor) string {
+ if d.Current.State == virtpb.HypervisorState_ON {
+ return "ON"
+ }
+ return "UNKNOWN"
+ })
+ */
+ /*
+ t.AddStringFunc("zood", func(m *zoopb.Machine) string {
+ return findVersion(m, "zood")
+ })
+ t.AddTimeFunc("age", func(m *zoopb.Machine) time.Time {
+ return m.Laststamp.AsTime()
+ })
+ */
+ t.ShowTable()
+ return win
+}
diff --git a/windowGeneric.go b/windowGeneric.go
index 7daae01..967ca0a 100644
--- a/windowGeneric.go
+++ b/windowGeneric.go
@@ -11,9 +11,14 @@ import (
)
type genericWindow struct {
- win *gadgets.BasicWindow // the window widget itself
- box *gui.Node // the top box of the repolist window
- group *gui.Node // the default group
+ win *gadgets.BasicWindow // the window widget itself
+ box *gui.Node // the overall shelf
+ shelf *gui.Node // the overall shelf
+ stack *gui.Node // the first box is a shelf
+ top *gui.Node // the first item in the stack is always a box
+ group *gui.Node // the first item top box is always a group
+ middle *gui.Node // the middle box
+ bottom *gui.Node // the bottom box of the repolist window
}
func (r *genericWindow) Hidden() bool {
@@ -79,13 +84,19 @@ func initGenericWindow(title string, grouptxt string) *genericWindow {
gw.win = gadgets.RawBasicWindow(title)
gw.win.Make()
- gw.box = gw.win.Box().Vertical() // a vertical box (like a stack of books)
gw.win.Custom = func() {
log.Warn("Found Window close. setting hidden=true")
// sets the hidden flag to false so Toggle() works
gw.win.Hide()
}
- gw.group = gw.box.NewGroup(grouptxt)
+ gw.box = gw.win.Box()
+ gw.shelf = gw.box
+ gw.stack = gw.shelf.NewVerticalBox("STACKBOX") // a vertical box (like a stack of books)
+ gw.top = gw.stack.Box()
+ gw.group = gw.top.NewGroup(grouptxt)
+ gw.middle = gw.stack.Box()
+ gw.middle.Vertical()
+ gw.bottom = gw.stack.Box()
gw.Show()
return gw