diff options
| author | Jeff Carr <[email protected]> | 2025-03-06 03:54:08 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-06 05:34:25 -0600 |
| commit | f97e2a48c6330baea7e99dd5dc1e560c23e64494 (patch) | |
| tree | 8529f6ecd56144174988e16ff14dec37030bc0ba /windowZooPB.go | |
| parent | 40fedc09b47d2af9fc231b371f346f7e9fc65188 (diff) | |
1st really awesome table with auto updates
Diffstat (limited to 'windowZooPB.go')
| -rw-r--r-- | windowZooPB.go | 59 |
1 files changed, 14 insertions, 45 deletions
diff --git a/windowZooPB.go b/windowZooPB.go index 154335b..5f7eb74 100644 --- a/windowZooPB.go +++ b/windowZooPB.go @@ -8,56 +8,25 @@ import ( "time" "go.wit.com/gui" - "go.wit.com/lib/gadgets" "go.wit.com/lib/protobuf/zoopb" "go.wit.com/log" ) -func addButtonForZooPB(grid *gui.Node) (*gui.Node, *gadgets.GenericWindow) { - var win *gadgets.GenericWindow - b := grid.NewButton("show zoo", func() { - // if the window exists, just toggle it open or closed - if win != nil { - win.Toggle() - return - } - - win = gadgets.NewGenericWindow("Zoo Raw PB View", "Stuff") - win.Win.Custom = func() { - log.Info("test delete window here") - } - tbox := win.Bottom.Box().SetProgName("TBOX") - grid := win.Group.RawGrid() - - var t *zoopb.MachinesTable - grid.NewButton("Show", func() { - if t != nil { - t.Delete() - t = nil - } - - // display the protobuf - t = AddMachinesPB(tbox, me.machines) - f := func(m *zoopb.Machine) { - log.Info("got to MachinesTable.Custom() ", m.Hostname) - } - t.Custom(f) - log.Info("table has uuid", t.GetUuid()) - }) +func doMachinesUpgradeTable() { + if me.machinesTB != nil { + me.machinesTB.Delete() + me.machinesTB = nil + } - grid.NewButton("update", func() { - if t != nil { - t.Delete() - t = nil - } - t = AddMachinesPB(tbox, me.machines) - log.Info("table has uuid", t.GetUuid()) - }) - grid.NewButton("ListChildren", func() { - me.myGui.ListChildren(false) - }) - }) - return b, win + // display the protobuf + me.machinesTB = AddMachinesPB(me.machinesBox, me.machines) + f := func(m *zoopb.Machine) { + log.Info("upgrade machine", m.Hostname, "memory", m.Memory/(1024*1024*1024)) + log.Info("ADD THE CODE TO TRIGGER AN UPGRADE HERE") + log.Info("ADD THE CODE TO TRIGGER AN UPGRADE HERE") + } + me.machinesTB.Custom(f) + log.Info("table has uuid", me.machinesTB.GetUuid()) } func AddMachinesPB(tbox *gui.Node, pb *zoopb.Machines) *zoopb.MachinesTable { |
