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)
|
||||
}
|
||||
|
||||
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()
|
||||
log.Println("ReadReceivedData() Event msgItems=", 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 {
|
||||
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
|
||||
newGuiButton.Action = "SHOW VM"
|
||||
newGuiButton.Action = "SHOW VM WAS HERE"
|
||||
newGuiButton.Custom = showVmMouseClick
|
||||
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.W = window.UiWindow
|
||||
// newGuiButton.T = window.UiTab
|
||||
newGuiButton.Box = mh.Box
|
||||
gui.Data.AllButtons = append(gui.Data.AllButtons, &newGuiButton)
|
||||
mh.Rows[row].HumanData[6].Button = &newGuiButton
|
||||
|
|
|
@ -8,22 +8,20 @@ import "runtime/debug"
|
|||
|
||||
import "git.wit.com/wit/gui"
|
||||
import pb "git.wit.com/wit/witProtobuf"
|
||||
|
||||
// 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
|
||||
// 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...
|
||||
// This was the default handler for all mouse clicks (buttons, areas, etc))
|
||||
//
|
||||
// Most mouse clicks are now moved to custom functions
|
||||
//
|
||||
|
||||
func mainMouseClick(b *gui.GuiButton) {
|
||||
defer r() // a golang trick to try to not crash on certain errors
|
||||
|
||||
if (b == nil) {
|
||||
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"))
|
||||
}
|
||||
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)
|
||||
log.Printf("%s", buf)
|
||||
log.Println("\tFINISHED FULL STACK DUMP")
|
||||
/*
|
||||
} else if (b.Action == "SHOW VM") {
|
||||
if (gui.Data.Debug) {
|
||||
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)
|
||||
createVmBox(gw, b.VM)
|
||||
}
|
||||
*/
|
||||
} else if (b.Action == "SHOW") {
|
||||
log.Println("\tTRIGGER DISPLAY ACCOUNT")
|
||||
gui.Data.State = "SEND WEBSOCKET"
|
||||
|
@ -109,7 +109,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
|||
// if (count != 0) {
|
||||
name := "Virtual Machines (" + b.Account.Nick + ")"
|
||||
mh := addVmsTab(gw, name, count, b.Account)
|
||||
ReadReceivedData(currentMessage, mh, b.GW)
|
||||
ReadReceivedData(currentMessage, mh, b.Box)
|
||||
// }
|
||||
currentMessage = nil
|
||||
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")
|
||||
subdomain := gui.GetText(b.Box, "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
|
||||
}
|
||||
log.Println("\tsubdomain =", subdomain)
|
||||
|
@ -102,7 +102,7 @@ func addSubdomainButton(b *gui.GuiButton) {
|
|||
acc.URL = "http://stackapi-api1.stackapi.customers.dev.wit.com:4000/"
|
||||
config.Accounts = append(config.Accounts, acc)
|
||||
|
||||
makeCloudInfoBox(b.GW)
|
||||
makeCloudInfoBox(b.Box.Window)
|
||||
gui.Data.State = "done"
|
||||
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) {
|
||||
log.Println("createAddVmBox() START")
|
||||
gw := b.GW
|
||||
gw := b.Box.Window
|
||||
log.Println("createAddVmBox() gw =", gw)
|
||||
name := "(" + b.Account.Nick + ")"
|
||||
|
||||
// gw.BoxMap["ADD VM" + name] = box
|
||||
|
||||
txt := "ADD VM " + name
|
||||
gw = gui.InitGuiWindow(config, txt, gw)
|
||||
box := gui.AddGenericBox(gw, name)
|
||||
|
||||
// Add hostname entry box
|
||||
|
@ -102,11 +104,19 @@ func createAddVmBox(b *gui.GuiButton) {
|
|||
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) {
|
||||
log.Println("CreateVmBox() START")
|
||||
log.Println("CreateVmBox() vm.Name =", vm.Name)
|
||||
log.Println("CreateVmBox() gw =", gw)
|
||||
|
||||
txt := "createVmBox() " + vm.Name
|
||||
gw = gui.InitGuiWindow(config, txt, gw)
|
||||
box := gui.AddGenericBox(gw, vm.Name)
|
||||
|
||||
// Add hostname entry box
|
||||
|
|
6
login.go
6
login.go
|
@ -29,7 +29,7 @@ func login(b *gui.GuiButton) {
|
|||
time.Sleep(200 * time.Millisecond)
|
||||
if (gui.Data.State == "NEW PROTOBUF") {
|
||||
if (currentMessage == nil) {
|
||||
gui.ErrorWindow(b.GW,
|
||||
gui.ErrorWindow(b.Box.Window,
|
||||
"There was a socket error",
|
||||
"More detailed information can be shown here.")
|
||||
gui.Data.State = "done"
|
||||
|
@ -48,7 +48,7 @@ func login(b *gui.GuiButton) {
|
|||
}
|
||||
}
|
||||
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) {
|
||||
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.Email = " + b.Account.Email + "\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
|
||||
gui.Data.State = "done"
|
||||
|
|
Loading…
Reference in New Issue