ConfigSave() and upgrade all buttons
This commit is contained in:
parent
80fa693ba4
commit
0c4a91054f
4
doGui.go
4
doGui.go
|
@ -69,6 +69,10 @@ func doGui() {
|
||||||
log.Info("todo: start a list here!")
|
log.Info("todo: start a list here!")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
grid.NewButton("ConfigSave()", func() {
|
||||||
|
saveMachineState()
|
||||||
|
})
|
||||||
|
|
||||||
// sit here forever refreshing the GUI
|
// sit here forever refreshing the GUI
|
||||||
for {
|
for {
|
||||||
refresh()
|
refresh()
|
||||||
|
|
|
@ -60,23 +60,10 @@ func makeZoodWin() *stdTableWin {
|
||||||
stdw.outOfDate = grid.NewCheckbox("out of date")
|
stdw.outOfDate = grid.NewCheckbox("out of date")
|
||||||
stdw.showAll = grid.NewCheckbox("all")
|
stdw.showAll = grid.NewCheckbox("all")
|
||||||
grid.NewButton("upgrade 10", func() {
|
grid.NewButton("upgrade 10", func() {
|
||||||
var count int
|
sendUpgrade(10)
|
||||||
all := me.machines.All()
|
})
|
||||||
for all.Scan() {
|
grid.NewButton("upgrade all", func() {
|
||||||
m := all.Next()
|
sendUpgrade(-1)
|
||||||
mtime := m.Laststamp.AsTime()
|
|
||||||
if time.Since(mtime) > 10*time.Hour {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if m.FindVersion("zood") != me.zood.version {
|
|
||||||
count += 1
|
|
||||||
m.Upgrade = true
|
|
||||||
log.Info("upgrade", m.Hostname, count)
|
|
||||||
}
|
|
||||||
if count > 9 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// make a box at the bottom of the window for the protobuf table
|
// make a box at the bottom of the window for the protobuf table
|
||||||
|
@ -86,6 +73,26 @@ func makeZoodWin() *stdTableWin {
|
||||||
return stdw
|
return stdw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func sendUpgrade(i int) {
|
||||||
|
var count int
|
||||||
|
all := me.machines.All()
|
||||||
|
for all.Scan() {
|
||||||
|
m := all.Next()
|
||||||
|
mtime := m.Laststamp.AsTime()
|
||||||
|
if time.Since(mtime) > 10*time.Hour {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if m.FindVersion("zood") != me.zood.version {
|
||||||
|
count += 1
|
||||||
|
m.Upgrade = true
|
||||||
|
log.Info("upgrade", m.Hostname, count)
|
||||||
|
}
|
||||||
|
if i == -1 || count > i {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (stdw *stdTableWin) refresh() {
|
func (stdw *stdTableWin) refresh() {
|
||||||
if stdw.outOfDate.Checked() {
|
if stdw.outOfDate.Checked() {
|
||||||
log.Info("refresh() showing out of date zoo")
|
log.Info("refresh() showing out of date zoo")
|
||||||
|
|
Loading…
Reference in New Issue