diff options
| author | Jeff Carr <[email protected]> | 2025-09-03 04:01:39 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-03 04:03:23 -0500 |
| commit | 0c4a91054f49dd1ff89fd74c7972c8282f18c70f (patch) | |
| tree | 6d69a8c0bcf0b10d86e3ef7d6d9f0706f60922c6 /windowZood.go | |
| parent | 80fa693ba408c4f4f62d78a66779788a9965e9f5 (diff) | |
Diffstat (limited to 'windowZood.go')
| -rw-r--r-- | windowZood.go | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/windowZood.go b/windowZood.go index 80ebeb3..b71d770 100644 --- a/windowZood.go +++ b/windowZood.go @@ -60,23 +60,10 @@ func makeZoodWin() *stdTableWin { stdw.outOfDate = grid.NewCheckbox("out of date") stdw.showAll = grid.NewCheckbox("all") grid.NewButton("upgrade 10", func() { - 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 count > 9 { - return - } - } + sendUpgrade(10) + }) + grid.NewButton("upgrade all", func() { + sendUpgrade(-1) }) // make a box at the bottom of the window for the protobuf table @@ -86,6 +73,26 @@ func makeZoodWin() *stdTableWin { 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() { if stdw.outOfDate.Checked() { log.Info("refresh() showing out of date zoo") |
