admin "show droplets" works
This commit is contained in:
parent
89f870f1f9
commit
e0970840e2
|
@ -65,26 +65,6 @@ func doAdminGui() {
|
|||
})
|
||||
|
||||
grid.NewButton("show droplets", func() {
|
||||
durl := url + "/dumpdroplets"
|
||||
response, err := postData(durl, data)
|
||||
if err != nil {
|
||||
fmt.Println("Error:", err)
|
||||
} else {
|
||||
fmt.Println("Response:", string(response))
|
||||
}
|
||||
})
|
||||
|
||||
grid.NewButton("uptime", func() {
|
||||
durl := url + "/uptime"
|
||||
response, err := postData(durl, data)
|
||||
if err != nil {
|
||||
fmt.Println("Error:", err)
|
||||
} else {
|
||||
fmt.Println("Response:", string(response))
|
||||
}
|
||||
})
|
||||
|
||||
grid.NewButton("get DropletsPB", func() {
|
||||
durl := url + "/DropletsPB"
|
||||
data, err := postData(durl, data)
|
||||
if err != nil {
|
||||
|
@ -98,6 +78,31 @@ func doAdminGui() {
|
|||
return
|
||||
}
|
||||
fmt.Println("Droplet len=", me.droplets.Len())
|
||||
|
||||
var found *virtpb.Droplets
|
||||
found = virtpb.NewDroplets()
|
||||
all := me.droplets.All()
|
||||
for all.Scan() {
|
||||
vm := all.Next()
|
||||
if vm.Current.State != virtpb.DropletState_ON {
|
||||
continue
|
||||
}
|
||||
found.Append(vm)
|
||||
}
|
||||
dropWin, _ := makeDropletsWindow(found)
|
||||
dropWin.Win.Custom = func() {
|
||||
log.Info("hiding droplet table window")
|
||||
}
|
||||
})
|
||||
|
||||
grid.NewButton("uptime", func() {
|
||||
durl := url + "/uptime"
|
||||
response, err := postData(durl, data)
|
||||
if err != nil {
|
||||
fmt.Println("Error:", err)
|
||||
} else {
|
||||
fmt.Println("Response:", string(response))
|
||||
}
|
||||
})
|
||||
|
||||
grid.NewButton("clean exit", func() {
|
||||
|
|
4
doGui.go
4
doGui.go
|
@ -140,9 +140,11 @@ func makeDropletsWindow(pb *virtpb.Droplets) (*GenericWindow, *virtpb.DropletsTa
|
|||
log.Info("todo")
|
||||
})
|
||||
|
||||
/*
|
||||
grid.NewButton("Update", func() {
|
||||
t.Update()
|
||||
})
|
||||
*/
|
||||
|
||||
tbox := win.Bottom.Box()
|
||||
t.SetParent(tbox)
|
||||
|
@ -185,9 +187,11 @@ func makeHypervisorsWindow(pb *virtpb.Hypervisors) *GenericWindow {
|
|||
grid.NewButton("List", func() {
|
||||
log.Info("list...")
|
||||
})
|
||||
/*
|
||||
grid.NewButton("Update", func() {
|
||||
t.Update()
|
||||
})
|
||||
*/
|
||||
|
||||
tbox := win.Bottom.Box() // a vertical box (like a stack of books)
|
||||
t.NewUuid()
|
||||
|
|
|
@ -77,7 +77,7 @@ func (dwin *stdDropletTableWin) doDropletsTable(currentDroplets *virtpb.Droplets
|
|||
|
||||
// display the protobuf
|
||||
dwin.TB = AddDropletsPB(dwin.box, currentDroplets)
|
||||
f := func(e *Droplet) {
|
||||
f := func(e *virtpb.Droplet) {
|
||||
log.Info("Triggered. do something here", e.Hostname)
|
||||
// m.Enabled = true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue