show some more details in the table
This commit is contained in:
parent
d3b6c1725d
commit
8ad5e77931
15
doGui.go
15
doGui.go
|
@ -71,28 +71,25 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
|
||||
})
|
||||
|
||||
grid.NewButton("addTable", func() {
|
||||
if tbwin == nil {
|
||||
log.Info("show the table first")
|
||||
return
|
||||
}
|
||||
tbwin.showTable(me.machines)
|
||||
grid.NewButton("update table", func() {
|
||||
newwin := makeTableWindow()
|
||||
newwin.showTable(me.machines)
|
||||
newwin.Show()
|
||||
})
|
||||
}
|
||||
|
||||
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.NewLabel(fmt.Sprintf("%d", m.Cpus))
|
||||
tw.grid.NewLabel(fmt.Sprintf("%d", m.Memory))
|
||||
tw.grid.NewLabel(m.Distro)
|
||||
tw.grid.NewLabel(findVersion(m, "zood"))
|
||||
tw.grid.NewLabel(findVersion(m, "bash"))
|
||||
dur := m.Laststamp.AsTime()
|
||||
tw.grid.NewLabel(fmt.Sprintf("%v", time.Since(dur)))
|
||||
tw.grid.NextRow()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go.wit.com/lib/protobuf/zoopb"
|
||||
"go.wit.com/log"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
// someone sent machine 'u' is it new?
|
||||
|
@ -41,6 +44,7 @@ func updateMachine(u *zoopb.Machine) string {
|
|||
if zood := m.Packages.FindByName("zood"); zood != nil {
|
||||
log.Log(INFO, m.Hostname, "has zood version", zood.Version)
|
||||
}
|
||||
m.Laststamp = timestamppb.New(time.Now())
|
||||
|
||||
updatePackages(m, u.Packages)
|
||||
return "upgrade"
|
||||
|
|
|
@ -82,11 +82,13 @@ func makeTableWindow() *tableWindow {
|
|||
// make a grid to put the list of git repos that have patches
|
||||
// in this particular patchset
|
||||
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.NewLabel("hostname")
|
||||
pw.grid.NewLabel("cpus")
|
||||
pw.grid.NewLabel("Memory")
|
||||
pw.grid.NewLabel("distro")
|
||||
pw.grid.NewLabel("zood")
|
||||
pw.grid.NewLabel("bash")
|
||||
pw.grid.NewLabel("age")
|
||||
pw.grid.NextRow()
|
||||
|
||||
// add the patches to the grid
|
||||
|
|
Loading…
Reference in New Issue