summaryrefslogtreecommitdiff
path: root/windowZood.go
diff options
context:
space:
mode:
Diffstat (limited to 'windowZood.go')
-rw-r--r--windowZood.go44
1 files changed, 35 insertions, 9 deletions
diff --git a/windowZood.go b/windowZood.go
index bd18044..d90a662 100644
--- a/windowZood.go
+++ b/windowZood.go
@@ -16,10 +16,12 @@ import (
type stdTableWin struct {
sync.Mutex
- win *gadgets.GenericWindow // the machines gui window
- box *gui.Node // the machines gui parent box widget
- TB *zoopb.MachinesTable // the machines gui table buffer
- update bool // if the window should be updated
+ win *gadgets.GenericWindow // the machines gui window
+ box *gui.Node // the machines gui parent box widget
+ TB *zoopb.MachinesTable // the machines gui table buffer
+ version string // the current zood version
+ versionL *gui.Node // label widget to display the current zood version
+ update bool // if the window should be updated
}
func (w *stdTableWin) Toggle() {
@@ -42,10 +44,24 @@ func makeZoodWin() *stdTableWin {
grid.NewButton("save machines.pb", func() {
saveMachineState()
})
- grid.NewCheckbox("hide active")
- grid.NewButton("update", func() {
+ grid.NewButton("show active", func() {
zood.doMachinesUpgradeTable(me.machines)
})
+ grid.NewButton("refresh", func() {
+ refresh()
+ })
+ zood.versionL = grid.NewLabel("scan")
+ grid.NewButton("show out of date", func() {
+ found := zoopb.NewMachines()
+ all := me.machines.All()
+ for all.Scan() {
+ m := all.Next()
+ if findVersion(m, "zood") != me.zood.version {
+ found.Append(m)
+ }
+ }
+ zood.doMachinesUpgradeTable(found)
+ })
// make a box at the bottom of the window for the protobuf table
zood.box = zood.win.Bottom.Box().SetProgName("TBOX")
@@ -86,11 +102,22 @@ func AddMachinesPB(tbox *gui.Node, pb *zoopb.Machines) *zoopb.MachinesTable {
t.NewUuid()
t.SetParent(tbox)
- f := func(m *zoopb.Machine) string {
+ upbut := t.AddButtonFunc("upgrade", func(m *zoopb.Machine) string {
+ if me.zood != nil {
+ mver := findVersion(m, "zood")
+ if mver == me.zood.version {
+ return ""
+ } else {
+ // log.Info("machine mismatch", m.Hostname, mver, me.zood.version)
+ }
+ }
// log.Info("machine =", m.Hostname)
return "now"
+ })
+ upbut.Custom = func(m *zoopb.Machine) {
+ log.Info("Triggering machine", m.Hostname, "to upgrade zood")
+ m.Upgrade = true
}
- t.AddButtonFunc("upgrade", f)
t.AddHostname()
t.AddMemory()
@@ -103,7 +130,6 @@ func AddMachinesPB(tbox *gui.Node, pb *zoopb.Machines) *zoopb.MachinesTable {
return findVersion(m, "zood")
})
delf := func(m *zoopb.Machine) string {
- pb.DeleteByHostname(m.Hostname)
return "delete"
}
t.AddButtonFunc("delete", delf)