From 522723e9468fefabec1bb4bbd5b12c6fec51666d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 22 Feb 2025 22:17:54 -0600 Subject: wow. all it took to make a table window for running droplets --- doGui.go | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'doGui.go') diff --git a/doGui.go b/doGui.go index d80138d..2f63e37 100644 --- a/doGui.go +++ b/doGui.go @@ -61,6 +61,21 @@ func drawWindow(win *gadgets.BasicWindow) { testWin = makeDropletsWindow(d) }) + grid.NewButton("Running droplets", func() { + d := me.cluster.GetDropletsPB() + var found *virtpb.Droplets + found = virtpb.NewDroplets() + all := d.All() + for all.Scan() { + vm := all.Next() + if vm.Current.State != virtpb.DropletState_ON { + continue + } + found.Append(vm) + } + makeDropletsWindow(found) + }) + /* var test2 *genericWindow grid.NewButton("test2", func() { @@ -101,10 +116,13 @@ func makeDropletsWindow(pb *virtpb.Droplets) *genericWindow { t.AddHostname() t.AddMemory() t.AddCpus() + t.AddStringFunc("State", func(d *virtpb.Droplet) string { + if d.Current.State == virtpb.DropletState_ON { + return "ON" + } + return "UNKNOWN" + }) /* - t.AddStringFunc("sMB", func(m *zoopb.Machine) string { - return fmt.Sprintf("%d mb", m.Memory/(1024*1024)) - }) t.AddStringFunc("zood", func(m *zoopb.Machine) string { return findVersion(m, "zood") }) -- cgit v1.2.3