vm's are showing again
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
da6ca3dc24
commit
689357b522
|
@ -52,7 +52,7 @@ func countVMS(data *pb.Event) int {
|
||||||
return len(vms)
|
return len(vms)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReadReceivedData(data *pb.Event, mh *gui.TableData, window *gui.GuiWindow) {
|
func ReadReceivedData(data *pb.Event, mh *gui.TableData, box *gui.GuiBox) {
|
||||||
msgItems := data.GetResults()
|
msgItems := data.GetResults()
|
||||||
log.Println("ReadReceivedData() Event msgItems=", msgItems)
|
log.Println("ReadReceivedData() Event msgItems=", msgItems)
|
||||||
for _, item := range msgItems {
|
for _, item := range msgItems {
|
||||||
|
@ -70,13 +70,17 @@ func ReadReceivedData(data *pb.Event, mh *gui.TableData, window *gui.GuiWindow)
|
||||||
for row, vm := range vms {
|
for row, vm := range vms {
|
||||||
setRowValues(mh, row, vm)
|
setRowValues(mh, row, vm)
|
||||||
|
|
||||||
// create 'fake' button entries for the mouse clicks within tables
|
// create entries for the mouse clicks within tables
|
||||||
var newGuiButton gui.GuiButton
|
var newGuiButton gui.GuiButton
|
||||||
newGuiButton.Action = "SHOW VM"
|
newGuiButton.Action = "SHOW VM WAS HERE"
|
||||||
|
newGuiButton.Custom = showVmMouseClick
|
||||||
newGuiButton.VM = vm // set the button to this VM
|
newGuiButton.VM = vm // set the button to this VM
|
||||||
|
// newGuiButton.GW = box
|
||||||
|
if (box.Window == nil) {
|
||||||
|
newGuiButton.Action = "SHOW VM WAS HERE NIL"
|
||||||
|
panic("ReadReceivedData() box == nil")
|
||||||
|
}
|
||||||
newGuiButton.Account = data.Account
|
newGuiButton.Account = data.Account
|
||||||
// newGuiButton.W = window.UiWindow
|
|
||||||
// newGuiButton.T = window.UiTab
|
|
||||||
newGuiButton.Box = mh.Box
|
newGuiButton.Box = mh.Box
|
||||||
gui.Data.AllButtons = append(gui.Data.AllButtons, &newGuiButton)
|
gui.Data.AllButtons = append(gui.Data.AllButtons, &newGuiButton)
|
||||||
mh.Rows[row].HumanData[6].Button = &newGuiButton
|
mh.Rows[row].HumanData[6].Button = &newGuiButton
|
||||||
|
|
|
@ -8,22 +8,20 @@ import "runtime/debug"
|
||||||
|
|
||||||
import "git.wit.com/wit/gui"
|
import "git.wit.com/wit/gui"
|
||||||
import pb "git.wit.com/wit/witProtobuf"
|
import pb "git.wit.com/wit/witProtobuf"
|
||||||
|
|
||||||
// import "github.com/davecgh/go-spew/spew"
|
// import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
// This is the handler for all mosue clicks (buttons, areas, etc))
|
|
||||||
//
|
//
|
||||||
// This is massive for a reason. EVERY MOUSE CLICK COMES HERE
|
// This was the default handler for all mouse clicks (buttons, areas, etc))
|
||||||
// the 'gui' code is kinda just a holder. It will pass everything
|
|
||||||
// here and we have to sort out what to do with the click
|
|
||||||
// at least, that is the current design because I thought it
|
|
||||||
// might be a good approach. Time will tell...
|
|
||||||
//
|
//
|
||||||
|
// Most mouse clicks are now moved to custom functions
|
||||||
|
//
|
||||||
|
|
||||||
func mainMouseClick(b *gui.GuiButton) {
|
func mainMouseClick(b *gui.GuiButton) {
|
||||||
defer r() // a golang trick to try to not crash on certain errors
|
defer r() // a golang trick to try to not crash on certain errors
|
||||||
|
|
||||||
if (b == nil) {
|
if (b == nil) {
|
||||||
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
||||||
|
log.Println("THIS IS PROBABLY A BUG IN git.wit.com/gui")
|
||||||
onExit(fmt.Errorf("mainMouseClick() got b = nil"))
|
onExit(fmt.Errorf("mainMouseClick() got b = nil"))
|
||||||
}
|
}
|
||||||
log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE b.Action =", b.Action)
|
log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE b.Action =", b.Action)
|
||||||
|
@ -75,6 +73,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
runtime.Stack(buf, true)
|
runtime.Stack(buf, true)
|
||||||
log.Printf("%s", buf)
|
log.Printf("%s", buf)
|
||||||
log.Println("\tFINISHED FULL STACK DUMP")
|
log.Println("\tFINISHED FULL STACK DUMP")
|
||||||
|
/*
|
||||||
} else if (b.Action == "SHOW VM") {
|
} else if (b.Action == "SHOW VM") {
|
||||||
if (gui.Data.Debug) {
|
if (gui.Data.Debug) {
|
||||||
log.Println("\tATTEMPTING TO SHOW VM TAB gw = ", gw)
|
log.Println("\tATTEMPTING TO SHOW VM TAB gw = ", gw)
|
||||||
|
@ -83,6 +82,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
log.Println("\tATTEMPTING TO SHOW VM TAB gw = ", gw)
|
log.Println("\tATTEMPTING TO SHOW VM TAB gw = ", gw)
|
||||||
createVmBox(gw, b.VM)
|
createVmBox(gw, b.VM)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
} else if (b.Action == "SHOW") {
|
} else if (b.Action == "SHOW") {
|
||||||
log.Println("\tTRIGGER DISPLAY ACCOUNT")
|
log.Println("\tTRIGGER DISPLAY ACCOUNT")
|
||||||
gui.Data.State = "SEND WEBSOCKET"
|
gui.Data.State = "SEND WEBSOCKET"
|
||||||
|
@ -109,7 +109,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
// if (count != 0) {
|
// if (count != 0) {
|
||||||
name := "Virtual Machines (" + b.Account.Nick + ")"
|
name := "Virtual Machines (" + b.Account.Nick + ")"
|
||||||
mh := addVmsTab(gw, name, count, b.Account)
|
mh := addVmsTab(gw, name, count, b.Account)
|
||||||
ReadReceivedData(currentMessage, mh, b.GW)
|
ReadReceivedData(currentMessage, mh, b.Box)
|
||||||
// }
|
// }
|
||||||
currentMessage = nil
|
currentMessage = nil
|
||||||
gui.Data.State = "done"
|
gui.Data.State = "done"
|
||||||
|
@ -125,4 +125,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE")
|
||||||
|
log.Println("mainMouseClick() FAILED TO FIND b.Action =", b.Action)
|
||||||
|
log.Println("mainMouseClick() END")
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ func addSubdomainButton(b *gui.GuiButton) {
|
||||||
log.Println("addSubdomainButton() START")
|
log.Println("addSubdomainButton() START")
|
||||||
subdomain := gui.GetText(b.Box, "SUBDOMAIN")
|
subdomain := gui.GetText(b.Box, "SUBDOMAIN")
|
||||||
if (subdomain == "") {
|
if (subdomain == "") {
|
||||||
gui.ErrorWindow(b.GW, "Blank Name", "You must have a valid subdomain")
|
gui.ErrorWindow(b.Box.Window, "Blank Name", "You must have a valid subdomain")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Println("\tsubdomain =", subdomain)
|
log.Println("\tsubdomain =", subdomain)
|
||||||
|
@ -102,7 +102,7 @@ func addSubdomainButton(b *gui.GuiButton) {
|
||||||
acc.URL = "http://stackapi-api1.stackapi.customers.dev.wit.com:4000/"
|
acc.URL = "http://stackapi-api1.stackapi.customers.dev.wit.com:4000/"
|
||||||
config.Accounts = append(config.Accounts, acc)
|
config.Accounts = append(config.Accounts, acc)
|
||||||
|
|
||||||
makeCloudInfoBox(b.GW)
|
makeCloudInfoBox(b.Box.Window)
|
||||||
gui.Data.State = "done"
|
gui.Data.State = "done"
|
||||||
log.Println("addSubdomainButton() END")
|
log.Println("addSubdomainButton() END")
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,12 +81,14 @@ func addVmsTab(gw *gui.GuiWindow, name string, count int, a *pb.Account) *gui.Ta
|
||||||
|
|
||||||
func createAddVmBox(b *gui.GuiButton) {
|
func createAddVmBox(b *gui.GuiButton) {
|
||||||
log.Println("createAddVmBox() START")
|
log.Println("createAddVmBox() START")
|
||||||
gw := b.GW
|
gw := b.Box.Window
|
||||||
log.Println("createAddVmBox() gw =", gw)
|
log.Println("createAddVmBox() gw =", gw)
|
||||||
name := "(" + b.Account.Nick + ")"
|
name := "(" + b.Account.Nick + ")"
|
||||||
|
|
||||||
// gw.BoxMap["ADD VM" + name] = box
|
// gw.BoxMap["ADD VM" + name] = box
|
||||||
|
|
||||||
|
txt := "ADD VM " + name
|
||||||
|
gw = gui.InitGuiWindow(config, txt, gw)
|
||||||
box := gui.AddGenericBox(gw, name)
|
box := gui.AddGenericBox(gw, name)
|
||||||
|
|
||||||
// Add hostname entry box
|
// Add hostname entry box
|
||||||
|
@ -102,11 +104,19 @@ func createAddVmBox(b *gui.GuiButton) {
|
||||||
gui.CreateButton(box, b.Account, nil, "Cancel", "CLOSE", nil)
|
gui.CreateButton(box, b.Account, nil, "Cancel", "CLOSE", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func showVmMouseClick(b *gui.GuiButton) {
|
||||||
|
log.Println("showVmMouseClick() START b.Box.Window =", b.Box.Window)
|
||||||
|
createVmBox(b.Box.Window, b.VM)
|
||||||
|
log.Println("showVmMouseClick() END")
|
||||||
|
}
|
||||||
|
|
||||||
func createVmBox(gw *gui.GuiWindow, vm *pb.Event_VM) {
|
func createVmBox(gw *gui.GuiWindow, vm *pb.Event_VM) {
|
||||||
log.Println("CreateVmBox() START")
|
log.Println("CreateVmBox() START")
|
||||||
log.Println("CreateVmBox() vm.Name =", vm.Name)
|
log.Println("CreateVmBox() vm.Name =", vm.Name)
|
||||||
log.Println("CreateVmBox() gw =", gw)
|
log.Println("CreateVmBox() gw =", gw)
|
||||||
|
|
||||||
|
txt := "createVmBox() " + vm.Name
|
||||||
|
gw = gui.InitGuiWindow(config, txt, gw)
|
||||||
box := gui.AddGenericBox(gw, vm.Name)
|
box := gui.AddGenericBox(gw, vm.Name)
|
||||||
|
|
||||||
// Add hostname entry box
|
// Add hostname entry box
|
||||||
|
|
6
login.go
6
login.go
|
@ -29,7 +29,7 @@ func login(b *gui.GuiButton) {
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
if (gui.Data.State == "NEW PROTOBUF") {
|
if (gui.Data.State == "NEW PROTOBUF") {
|
||||||
if (currentMessage == nil) {
|
if (currentMessage == nil) {
|
||||||
gui.ErrorWindow(b.GW,
|
gui.ErrorWindow(b.Box.Window,
|
||||||
"There was a socket error",
|
"There was a socket error",
|
||||||
"More detailed information can be shown here.")
|
"More detailed information can be shown here.")
|
||||||
gui.Data.State = "done"
|
gui.Data.State = "done"
|
||||||
|
@ -48,7 +48,7 @@ func login(b *gui.GuiButton) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Println("\tLOGIN WAS OK!")
|
log.Println("\tLOGIN WAS OK!")
|
||||||
gui.MessageWindow(b.GW, "Login OK", msg)
|
gui.MessageWindow(b.Box.Window, "Login OK", msg)
|
||||||
} else if (currentMessage.Type == pb.Event_FAIL) {
|
} else if (currentMessage.Type == pb.Event_FAIL) {
|
||||||
log.Println("\tLOGIN FAILED")
|
log.Println("\tLOGIN FAILED")
|
||||||
log.Println("\tLOGIN FAILED")
|
log.Println("\tLOGIN FAILED")
|
||||||
|
@ -58,7 +58,7 @@ func login(b *gui.GuiButton) {
|
||||||
msg += "pb.Id = " + fmt.Sprintf("%d", currentMessage.Id) + "\n"
|
msg += "pb.Id = " + fmt.Sprintf("%d", currentMessage.Id) + "\n"
|
||||||
msg += "pb.Email = " + b.Account.Email + "\n"
|
msg += "pb.Email = " + b.Account.Email + "\n"
|
||||||
msg += "pb.Username = " + b.Account.Username + "\n"
|
msg += "pb.Username = " + b.Account.Username + "\n"
|
||||||
gui.ErrorWindow(b.GW, "Login Failed", msg)
|
gui.ErrorWindow(b.Box.Window, "Login Failed", msg)
|
||||||
}
|
}
|
||||||
currentMessage = nil
|
currentMessage = nil
|
||||||
gui.Data.State = "done"
|
gui.Data.State = "done"
|
||||||
|
|
Loading…
Reference in New Issue