summaryrefslogtreecommitdiff
path: root/windowDroplets.go
diff options
context:
space:
mode:
Diffstat (limited to 'windowDroplets.go')
-rw-r--r--windowDroplets.go56
1 files changed, 3 insertions, 53 deletions
diff --git a/windowDroplets.go b/windowDroplets.go
index 109f3cc..fecef99 100644
--- a/windowDroplets.go
+++ b/windowDroplets.go
@@ -23,6 +23,7 @@ type stdDropletTableWin struct {
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
+ admin *adminT
}
func (w *stdDropletTableWin) Toggle() {
@@ -37,6 +38,7 @@ func (w *stdDropletTableWin) Toggle() {
func newDropletsWindow(admin *adminT) *stdDropletTableWin {
dwin := new(stdDropletTableWin)
+ dwin.admin = admin
dwin.win = gadgets.NewGenericWindow("virtigo current droplets", "Options")
dwin.win.Custom = func() {
log.Info("test delete window here")
@@ -76,58 +78,6 @@ func newDropletsWindow(admin *adminT) *stdDropletTableWin {
return dwin
}
-/*
-func makeWindownDropletsPB(pb *virtpb.Droplets) *stdDropletTableWin {
- dwin := new(stdDropletTableWin)
- dwin.win = gadgets.NewGenericWindow("virtigo current droplets", "")
- dwin.win.Custom = func() {
- log.Info("test delete window here")
- }
-
- // make a box at the bottom of the window for the protobuf table
- dwin.box = dwin.win.Bottom.Box().SetProgName("TBOX")
-
- dwin.doDropletsTable(pb)
-
- return dwin
-}
-
-func (dwin *stdDropletTableWin) doDropletsTable(currentDroplets *virtpb.Droplets) {
- dwin.Lock()
- defer dwin.Unlock()
- if dwin.TB != nil {
- dwin.TB.Delete()
- dwin.TB = nil
- }
-
- // display the protobuf
- dwin.TB = addDropletsPB(dwin.box, currentDroplets)
- f := func(e *virtpb.Droplet) {
- log.Info("Triggered. do something here", e.Hostname)
- // m.Enabled = true
- }
- dwin.TB.Custom(f)
-}
-
-func addDropletsPB(tbox *gui.Node, pb *virtpb.Droplets) *virtpb.DropletsTable {
- t := pb.NewTable("DropletsPB")
- t.NewUuid()
- t.SetParent(tbox)
-
- vp := t.AddButtonFunc("start", func(p *virtpb.Droplet) string {
- return "poweron"
- })
- vp.Custom = func(d *virtpb.Droplet) {
- log.Info("power on the droplet here:", d.Hostname)
- }
- t.AddHostname()
- t.AddMemory()
- t.AddCpus()
- t.ShowTable()
- return t
-}
-*/
-
// default window for active running droplets
func (dw *stdDropletTableWin) doInactiveDroplets(pb *virtpb.Droplets) {
dw.Lock()
@@ -150,7 +100,7 @@ func (dw *stdDropletTableWin) doInactiveDroplets(pb *virtpb.Droplets) {
})
dropedit.Custom = func(d *virtpb.Droplet) {
log.Info("edit droplet here", d.Hostname)
- editDropletWindow(d)
+ dw.admin.editDropletWindow(d)
}
dropon := t.AddButtonFunc("Start", func(d *virtpb.Droplet) string {