summaryrefslogtreecommitdiff
path: root/windowDroplets.go
diff options
context:
space:
mode:
Diffstat (limited to 'windowDroplets.go')
-rw-r--r--windowDroplets.go32
1 files changed, 31 insertions, 1 deletions
diff --git a/windowDroplets.go b/windowDroplets.go
index 6d2e71b..09c2d18 100644
--- a/windowDroplets.go
+++ b/windowDroplets.go
@@ -22,6 +22,7 @@ type stdDropletTableWin struct {
pb *virtpb.Droplets // the droplets protobuf
TB *virtpb.DropletsTable // the gui table buffer
update bool // if the window should be updated
+ Close func() // this function is called when the window is closed
}
func (w *stdDropletTableWin) Toggle() {
@@ -36,10 +37,39 @@ func (w *stdDropletTableWin) Toggle() {
func newDropletsWindow() *stdDropletTableWin {
dwin := new(stdDropletTableWin)
- dwin.win = gadgets.NewGenericWindow("virtigo current droplets", "")
+ dwin.win = gadgets.NewGenericWindow("virtigo current droplets", "Options")
dwin.win.Custom = func() {
log.Info("test delete window here")
}
+ grid := dwin.win.Group.RawGrid()
+
+ grid.NewButton("Active", func() {
+ var found *virtpb.Droplets
+ found = virtpb.NewDroplets()
+ all := me.admin.droplets.All()
+ for all.Scan() {
+ vm := all.Next()
+ if vm.Current.State != virtpb.DropletState_ON {
+ continue
+ }
+ found.Append(vm)
+ }
+ dwin.doActiveDroplets(found)
+ })
+
+ grid.NewButton("Inactive", func() {
+ var found *virtpb.Droplets
+ found = virtpb.NewDroplets()
+ all := me.admin.droplets.All()
+ for all.Scan() {
+ vm := all.Next()
+ if vm.Current.State == virtpb.DropletState_ON {
+ continue
+ }
+ found.Append(vm)
+ }
+ dwin.doInactiveDroplets(found)
+ })
// make a box at the bottom of the window for the protobuf table
dwin.box = dwin.win.Bottom.Box().SetProgName("TBOX")