diff options
| author | Jeff Carr <[email protected]> | 2025-02-15 04:12:27 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-15 07:28:36 -0600 |
| commit | 875da60adb56ba8b88301d19f19b3b7fac2d88c0 (patch) | |
| tree | 1e43e9ab32ddd179725074a49deb818bfc04252e | |
| parent | 25bc18c55f58949e5765b73af8b61ede8ac5eb12 (diff) | |
adds machines to table
| -rw-r--r-- | doGui.go | 40 | ||||
| -rw-r--r-- | tableWindow.go | 14 |
2 files changed, 38 insertions, 16 deletions
@@ -11,6 +11,7 @@ import ( "go.wit.com/gui" "go.wit.com/lib/gadgets" + "go.wit.com/lib/protobuf/zoopb" "go.wit.com/log" ) @@ -54,16 +55,37 @@ func drawWindow(win *gadgets.BasicWindow) { win.Disable() defer win.Enable() - if tbwin != nil { - if tbwin.Hidden() { - tbwin.Show() - } else { - tbwin.Hide() - } - return + if tbwin == nil { + log.Info("show zoo here") + tbwin = makeTableWindow() + } + + if tbwin.Hidden() { + tbwin.Show() + } else { + tbwin.Hide() } + return - log.Info("show zoo here") - tbwin = makeTableWindow() }) + + grid.NewButton("addTable", func() { + if tbwin == nil { + log.Info("show the table first") + return + } + tbwin.showTable(me.machines) + }) +} + +func (tw *tableWindow) showTable(allm *zoopb.Machines) { + + all := allm.All() + for all.Scan() { + m := all.Next() + tw.grid.NewLabel("hello") + + tw.grid.NewLabel(m.Hostname) + tw.grid.NextRow() + } } diff --git a/tableWindow.go b/tableWindow.go index 8ec1439..17c7cfa 100644 --- a/tableWindow.go +++ b/tableWindow.go @@ -81,13 +81,13 @@ func makeTableWindow() *tableWindow { // make a grid to put the list of git repos that have patches // in this particular patchset - grid = g.NewGrid("", 0, 0) - grid.NewLabel("repo") - grid.NewLabel("patch name") - grid.NewLabel("Applied in current branch?") - grid.NewLabel("start hash") - grid.NewLabel("") - grid.NextRow() + pw.grid = g.NewGrid("", 0, 0) + pw.grid.NewLabel("repo") + pw.grid.NewLabel("patch name") + pw.grid.NewLabel("Applied in current branch?") + pw.grid.NewLabel("start hash") + pw.grid.NewLabel("") + pw.grid.NextRow() // add the patches to the grid // pw.addPatchset(grid, pset) |
