try to get events & hypervisors protobufs
This commit is contained in:
parent
d2d04da122
commit
8517dbc948
26
http.go
26
http.go
|
@ -145,6 +145,32 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if route == "/HypervisorsPB" {
|
||||||
|
pb := me.cluster.GetHypervisorsPB()
|
||||||
|
data, err := pb.Marshal()
|
||||||
|
if err != nil {
|
||||||
|
log.Info("hypervisors marshal failed", err)
|
||||||
|
fmt.Fprintln(w, "hypervisors marshal failed", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
w.Write(data)
|
||||||
|
// fmt.Fprintln("droplet marshal failed", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if route == "/EventsPB" {
|
||||||
|
pb := me.cluster.GetEventsPB()
|
||||||
|
data, err := pb.Marshal()
|
||||||
|
if err != nil {
|
||||||
|
log.Info("events marshal failed", err)
|
||||||
|
fmt.Fprintln(w, "events marshal failed", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
w.Write(data)
|
||||||
|
// fmt.Fprintln("droplet marshal failed", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if route == "/dumpdropletsfull" {
|
if route == "/dumpdropletsfull" {
|
||||||
dumpDroplets(w, true)
|
dumpDroplets(w, true)
|
||||||
return
|
return
|
||||||
|
|
|
@ -45,6 +45,7 @@ func newDropletsWindow() *stdDropletTableWin {
|
||||||
return dwin
|
return dwin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func makeWindownDropletsPB(pb *virtpb.Droplets) *stdDropletTableWin {
|
func makeWindownDropletsPB(pb *virtpb.Droplets) *stdDropletTableWin {
|
||||||
dwin := new(stdDropletTableWin)
|
dwin := new(stdDropletTableWin)
|
||||||
dwin.win = gadgets.NewGenericWindow("virtigo current droplets", "")
|
dwin.win = gadgets.NewGenericWindow("virtigo current droplets", "")
|
||||||
|
@ -59,7 +60,9 @@ func makeWindownDropletsPB(pb *virtpb.Droplets) *stdDropletTableWin {
|
||||||
|
|
||||||
return dwin
|
return dwin
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
func (dwin *stdDropletTableWin) doDropletsTable(currentDroplets *virtpb.Droplets) {
|
func (dwin *stdDropletTableWin) doDropletsTable(currentDroplets *virtpb.Droplets) {
|
||||||
dwin.Lock()
|
dwin.Lock()
|
||||||
defer dwin.Unlock()
|
defer dwin.Unlock()
|
||||||
|
@ -94,6 +97,7 @@ func addDropletsPB(tbox *gui.Node, pb *virtpb.Droplets) *virtpb.DropletsTable {
|
||||||
t.ShowTable()
|
t.ShowTable()
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// default window for active running droplets
|
// default window for active running droplets
|
||||||
func (dw *stdDropletTableWin) doInactiveDroplets(pb *virtpb.Droplets) {
|
func (dw *stdDropletTableWin) doInactiveDroplets(pb *virtpb.Droplets) {
|
||||||
|
@ -113,7 +117,31 @@ func (dw *stdDropletTableWin) doInactiveDroplets(pb *virtpb.Droplets) {
|
||||||
t.SetParent(dw.box)
|
t.SetParent(dw.box)
|
||||||
|
|
||||||
// pick the columns
|
// pick the columns
|
||||||
t.AddHostname()
|
// t.AddHostname()
|
||||||
|
dropon := t.AddButtonFunc("Start", func(d *virtpb.Droplet) string {
|
||||||
|
return "poweron"
|
||||||
|
})
|
||||||
|
dropon.Custom = func(d *virtpb.Droplet) {
|
||||||
|
log.Info("start droplet here", d.Hostname)
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
t.AddHostname()
|
||||||
|
t.AddStringFunc("location", func(d *virtpb.Droplet) string {
|
||||||
|
return d.Current.Hypervisor
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
vp := t.AddButtonFunc("Configure Hostname", func(p *virtpb.Droplet) string {
|
||||||
|
return p.Hostname
|
||||||
|
})
|
||||||
|
vp.Custom = func(d *virtpb.Droplet) {
|
||||||
|
log.Info("open config window", d.Hostname)
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
t.AddHostname()
|
||||||
|
t.AddStringFunc("location", func(d *virtpb.Droplet) string {
|
||||||
|
return d.Current.Hypervisor
|
||||||
|
})
|
||||||
|
*/
|
||||||
t.AddMemory()
|
t.AddMemory()
|
||||||
t.AddCpus()
|
t.AddCpus()
|
||||||
|
|
||||||
|
@ -142,6 +170,21 @@ func (dw *stdDropletTableWin) doActiveDroplets(pb *virtpb.Droplets) {
|
||||||
t.NewUuid()
|
t.NewUuid()
|
||||||
|
|
||||||
t.SetParent(dw.box)
|
t.SetParent(dw.box)
|
||||||
|
|
||||||
|
serial := t.AddButtonFunc("serial", func(p *virtpb.Droplet) string {
|
||||||
|
return "ttyS0"
|
||||||
|
})
|
||||||
|
serial.Custom = func(d *virtpb.Droplet) {
|
||||||
|
log.Printf("run %s: remmina spice://%s:%d\n", d.Hostname, argv.Server, d.SpicePort)
|
||||||
|
}
|
||||||
|
|
||||||
|
fb := t.AddButtonFunc("fb0 console", func(p *virtpb.Droplet) string {
|
||||||
|
return "remmina"
|
||||||
|
})
|
||||||
|
fb.Custom = func(d *virtpb.Droplet) {
|
||||||
|
log.Printf("run %s: remmina spice://%s:%d\n", d.Hostname, argv.Server, d.SpicePort)
|
||||||
|
}
|
||||||
|
|
||||||
t.AddHostname()
|
t.AddHostname()
|
||||||
t.AddStringFunc("location", func(d *virtpb.Droplet) string {
|
t.AddStringFunc("location", func(d *virtpb.Droplet) string {
|
||||||
return d.Current.Hypervisor
|
return d.Current.Hypervisor
|
||||||
|
|
Loading…
Reference in New Issue