add hypervisors table
This commit is contained in:
parent
522723e946
commit
69b0d4c013
61
doGui.go
61
doGui.go
|
@ -51,8 +51,17 @@ func drawWindow(win *gadgets.BasicWindow) {
|
||||||
group1 := vbox.NewGroup("Zookeeper Settings")
|
group1 := vbox.NewGroup("Zookeeper Settings")
|
||||||
grid := group1.NewGrid("buildOptions", 0, 0)
|
grid := group1.NewGrid("buildOptions", 0, 0)
|
||||||
|
|
||||||
|
var hyperWin *genericWindow
|
||||||
|
grid.NewButton("hypervisors", func() {
|
||||||
|
if hyperWin != nil {
|
||||||
|
hyperWin.Toggle()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
hyperWin = makeHypervisorsWindow(me.cluster.H)
|
||||||
|
})
|
||||||
|
|
||||||
var testWin *genericWindow
|
var testWin *genericWindow
|
||||||
grid.NewButton("machine list", func() {
|
grid.NewButton("all defined droplets", func() {
|
||||||
if testWin != nil {
|
if testWin != nil {
|
||||||
testWin.Toggle()
|
testWin.Toggle()
|
||||||
return
|
return
|
||||||
|
@ -106,11 +115,17 @@ func makeDropletsWindow(pb *virtpb.Droplets) *genericWindow {
|
||||||
log.Info("?")
|
log.Info("?")
|
||||||
})
|
})
|
||||||
grid.NextRow()
|
grid.NextRow()
|
||||||
grid.NewButton("smore", func() {
|
grid.NewButton("2nd row", func() {
|
||||||
|
log.Info("smore")
|
||||||
|
})
|
||||||
|
win.middle.NewButton("middle", func() {
|
||||||
|
log.Info("smore")
|
||||||
|
})
|
||||||
|
win.middle.NewButton("middle", func() {
|
||||||
log.Info("smore")
|
log.Info("smore")
|
||||||
})
|
})
|
||||||
|
|
||||||
tbox := win.win.Box().Vertical() // a vertical box (like a stack of books)
|
tbox := win.bottom.Box() // a vertical box (like a stack of books)
|
||||||
t := pb.NewTable("test 2")
|
t := pb.NewTable("test 2")
|
||||||
t.SetParent(tbox)
|
t.SetParent(tbox)
|
||||||
t.AddHostname()
|
t.AddHostname()
|
||||||
|
@ -133,3 +148,43 @@ func makeDropletsWindow(pb *virtpb.Droplets) *genericWindow {
|
||||||
t.ShowTable()
|
t.ShowTable()
|
||||||
return win
|
return win
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func makeHypervisorsWindow(pb *virtpb.Hypervisors) *genericWindow {
|
||||||
|
win := initGenericWindow("Hypervisors registered with Virtigo", "Buttons of things")
|
||||||
|
grid := win.group.RawGrid()
|
||||||
|
grid.NewButton("List", func() {
|
||||||
|
log.Info("list...")
|
||||||
|
})
|
||||||
|
grid.NewButton("more", func() {
|
||||||
|
log.Info("?")
|
||||||
|
})
|
||||||
|
grid.NextRow()
|
||||||
|
grid.NewButton("smore", func() {
|
||||||
|
log.Info("smore")
|
||||||
|
})
|
||||||
|
|
||||||
|
tbox := win.bottom.Box() // a vertical box (like a stack of books)
|
||||||
|
t := pb.NewTable("test 2")
|
||||||
|
t.SetParent(tbox)
|
||||||
|
t.AddHostname()
|
||||||
|
t.AddMemory()
|
||||||
|
t.AddCpus()
|
||||||
|
/*
|
||||||
|
t.AddStringFunc("State", func(d *virtpb.Hypervisor) string {
|
||||||
|
if d.Current.State == virtpb.HypervisorState_ON {
|
||||||
|
return "ON"
|
||||||
|
}
|
||||||
|
return "UNKNOWN"
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
t.AddStringFunc("zood", func(m *zoopb.Machine) string {
|
||||||
|
return findVersion(m, "zood")
|
||||||
|
})
|
||||||
|
t.AddTimeFunc("age", func(m *zoopb.Machine) time.Time {
|
||||||
|
return m.Laststamp.AsTime()
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
t.ShowTable()
|
||||||
|
return win
|
||||||
|
}
|
||||||
|
|
|
@ -11,9 +11,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type genericWindow struct {
|
type genericWindow struct {
|
||||||
win *gadgets.BasicWindow // the window widget itself
|
win *gadgets.BasicWindow // the window widget itself
|
||||||
box *gui.Node // the top box of the repolist window
|
box *gui.Node // the overall shelf
|
||||||
group *gui.Node // the default group
|
shelf *gui.Node // the overall shelf
|
||||||
|
stack *gui.Node // the first box is a shelf
|
||||||
|
top *gui.Node // the first item in the stack is always a box
|
||||||
|
group *gui.Node // the first item top box is always a group
|
||||||
|
middle *gui.Node // the middle box
|
||||||
|
bottom *gui.Node // the bottom box of the repolist window
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *genericWindow) Hidden() bool {
|
func (r *genericWindow) Hidden() bool {
|
||||||
|
@ -79,13 +84,19 @@ func initGenericWindow(title string, grouptxt string) *genericWindow {
|
||||||
gw.win = gadgets.RawBasicWindow(title)
|
gw.win = gadgets.RawBasicWindow(title)
|
||||||
gw.win.Make()
|
gw.win.Make()
|
||||||
|
|
||||||
gw.box = gw.win.Box().Vertical() // a vertical box (like a stack of books)
|
|
||||||
gw.win.Custom = func() {
|
gw.win.Custom = func() {
|
||||||
log.Warn("Found Window close. setting hidden=true")
|
log.Warn("Found Window close. setting hidden=true")
|
||||||
// sets the hidden flag to false so Toggle() works
|
// sets the hidden flag to false so Toggle() works
|
||||||
gw.win.Hide()
|
gw.win.Hide()
|
||||||
}
|
}
|
||||||
gw.group = gw.box.NewGroup(grouptxt)
|
gw.box = gw.win.Box()
|
||||||
|
gw.shelf = gw.box
|
||||||
|
gw.stack = gw.shelf.NewVerticalBox("STACKBOX") // a vertical box (like a stack of books)
|
||||||
|
gw.top = gw.stack.Box()
|
||||||
|
gw.group = gw.top.NewGroup(grouptxt)
|
||||||
|
gw.middle = gw.stack.Box()
|
||||||
|
gw.middle.Vertical()
|
||||||
|
gw.bottom = gw.stack.Box()
|
||||||
gw.Show()
|
gw.Show()
|
||||||
|
|
||||||
return gw
|
return gw
|
||||||
|
|
Loading…
Reference in New Issue