checkboxes to show only out of sync machines
This commit is contained in:
parent
7ef9f39a62
commit
17c9a34aa4
3
doGui.go
3
doGui.go
|
@ -21,7 +21,7 @@ func refresh() {
|
|||
log.Info("zookeeper scan here")
|
||||
}
|
||||
if me.zood != nil {
|
||||
me.zood.doMachinesUpgradeTable(me.machines)
|
||||
// me.zood.doMachinesUpgradeTable(me.machines)
|
||||
all := me.machines.All()
|
||||
for all.Scan() {
|
||||
m := all.Next()
|
||||
|
@ -32,6 +32,7 @@ func refresh() {
|
|||
me.zood.versionL.SetText(v)
|
||||
}
|
||||
}
|
||||
me.zood.refresh()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ type stdTableWin struct {
|
|||
version string // the current zood version
|
||||
versionL *gui.Node // label widget to display the current zood version
|
||||
outOfDate *gui.Node // checkbox to only show out of date droplets
|
||||
showAll *gui.Node // show everything in the zoo
|
||||
update bool // if the window should be updated
|
||||
}
|
||||
|
||||
|
@ -52,10 +53,12 @@ func makeZoodWin() *stdTableWin {
|
|||
})
|
||||
|
||||
grid.NewButton("refresh", func() {
|
||||
refresh()
|
||||
stdw.refresh()
|
||||
})
|
||||
|
||||
stdw.versionL = grid.NewLabel("scan")
|
||||
stdw.outOfDate = grid.NewCheckbox("out of date")
|
||||
stdw.showAll = grid.NewCheckbox("all")
|
||||
grid.NewButton("show out of date", func() {
|
||||
found := zoopb.NewMachines()
|
||||
all := me.machines.All()
|
||||
|
@ -77,10 +80,18 @@ func makeZoodWin() *stdTableWin {
|
|||
|
||||
func (stdw *stdTableWin) refresh() {
|
||||
if stdw.outOfDate.Checked() {
|
||||
log.Info("refresh() showing out of date zoo")
|
||||
found := zoopb.NewMachines()
|
||||
all := me.machines.All()
|
||||
for all.Scan() {
|
||||
m := all.Next()
|
||||
if !stdw.showAll.Checked() {
|
||||
// skip non-active zoo members
|
||||
mtime := m.Laststamp.AsTime()
|
||||
if time.Since(mtime) > 10*time.Hour {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if m.FindVersion("zood") != me.zood.version {
|
||||
found.Append(m)
|
||||
}
|
||||
|
@ -88,9 +99,25 @@ func (stdw *stdTableWin) refresh() {
|
|||
stdw.doMachinesUpgradeTable(found)
|
||||
return
|
||||
}
|
||||
if stdw.showAll.Checked() {
|
||||
log.Info("refresh() showing everything in zoo")
|
||||
stdw.doMachinesUpgradeTable(me.machines)
|
||||
return
|
||||
}
|
||||
|
||||
// show all droplets
|
||||
stdw.doMachinesUpgradeTable(me.machines)
|
||||
log.Info("refresh() only show active zoo")
|
||||
found := zoopb.NewMachines()
|
||||
all := me.machines.All()
|
||||
for all.Scan() {
|
||||
m := all.Next()
|
||||
mtime := m.Laststamp.AsTime()
|
||||
// now := time.Now()
|
||||
if time.Since(mtime) > 10*time.Hour {
|
||||
continue
|
||||
}
|
||||
found.Append(m)
|
||||
}
|
||||
stdw.doMachinesUpgradeTable(found)
|
||||
}
|
||||
|
||||
func (zood *stdTableWin) doMachinesUpgradeTable(pb *zoopb.Machines) {
|
||||
|
|
Loading…
Reference in New Issue