wow. all it took to make a table window for running droplets
This commit is contained in:
parent
32e2753007
commit
522723e946
2
Makefile
2
Makefile
|
@ -8,7 +8,7 @@ REDOMOD = $(shell if [ -e go.sum ]; then echo go.sum exists; else GO111MODULE=
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
./virtigo --version
|
./virtigo --version
|
||||||
./virtigo --gui gocui
|
@#./virtigo --gui gocui
|
||||||
@echo build worked
|
@echo build worked
|
||||||
|
|
||||||
build: goimports vet
|
build: goimports vet
|
||||||
|
|
24
doGui.go
24
doGui.go
|
@ -61,6 +61,21 @@ func drawWindow(win *gadgets.BasicWindow) {
|
||||||
testWin = makeDropletsWindow(d)
|
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
|
var test2 *genericWindow
|
||||||
grid.NewButton("test2", func() {
|
grid.NewButton("test2", func() {
|
||||||
|
@ -101,10 +116,13 @@ func makeDropletsWindow(pb *virtpb.Droplets) *genericWindow {
|
||||||
t.AddHostname()
|
t.AddHostname()
|
||||||
t.AddMemory()
|
t.AddMemory()
|
||||||
t.AddCpus()
|
t.AddCpus()
|
||||||
/*
|
t.AddStringFunc("State", func(d *virtpb.Droplet) string {
|
||||||
t.AddStringFunc("sMB", func(m *zoopb.Machine) string {
|
if d.Current.State == virtpb.DropletState_ON {
|
||||||
return fmt.Sprintf("%d mb", m.Memory/(1024*1024))
|
return "ON"
|
||||||
|
}
|
||||||
|
return "UNKNOWN"
|
||||||
})
|
})
|
||||||
|
/*
|
||||||
t.AddStringFunc("zood", func(m *zoopb.Machine) string {
|
t.AddStringFunc("zood", func(m *zoopb.Machine) string {
|
||||||
return findVersion(m, "zood")
|
return findVersion(m, "zood")
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue