ConfigSave() and upgrade all buttons

This commit is contained in:
Jeff Carr 2025-09-03 04:01:39 -05:00
parent 80fa693ba4
commit 0c4a91054f
2 changed files with 28 additions and 17 deletions

View File

@ -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()

View File

@ -60,6 +60,20 @@ 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() {
sendUpgrade(10)
})
grid.NewButton("upgrade all", func() {
sendUpgrade(-1)
})
// make a box at the bottom of the window for the protobuf table
stdw.box = stdw.win.Bottom.Box().SetProgName("TBOX")
stdw.doMachinesUpgradeTable(me.machines)
return stdw
}
func sendUpgrade(i int) {
var count int var count int
all := me.machines.All() all := me.machines.All()
for all.Scan() { for all.Scan() {
@ -73,17 +87,10 @@ func makeZoodWin() *stdTableWin {
m.Upgrade = true m.Upgrade = true
log.Info("upgrade", m.Hostname, count) log.Info("upgrade", m.Hostname, count)
} }
if count > 9 { if i == -1 || count > i {
return return
} }
} }
})
// make a box at the bottom of the window for the protobuf table
stdw.box = stdw.win.Bottom.Box().SetProgName("TBOX")
stdw.doMachinesUpgradeTable(me.machines)
return stdw
} }
func (stdw *stdTableWin) refresh() { func (stdw *stdTableWin) refresh() {