fix the table display. can have more than one now?

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-13 12:29:00 -07:00
parent 4df4f2bfd9
commit ebfab08357
2 changed files with 17 additions and 5 deletions

View File

@ -69,6 +69,7 @@ func mainMouseClick(b *gui.GuiButton) {
log.Println("\tmainMouseClick() values.Accounts =", values.Accounts)
log.Println("\tmainMouseClick() values.Name = ", values.Name)
/*
if (values.Action == "QUIT") {
onExit(nil)
} else if (values.Action == "CREATE") {
@ -77,6 +78,7 @@ func mainMouseClick(b *gui.GuiButton) {
} else if (values.Action == "SHOW") {
showAccountClick(b)
}
*/
log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE")
log.Println("mainMouseClick() FAILED TO FIND values.Action =", values.Action)
log.Println("mainMouseClick() END")
@ -97,8 +99,16 @@ func showAccountClick(b *gui.GuiButton) {
log.Println("\tshowAccountClick() values.Accounts =", values.Accounts)
log.Println("\tshowAccountClick() values.Name = ", values.Name)
name := "Virtual Machines (" + values.Account.Nick + ")"
gw := b.Box.Window
// TODO: make this text i18n
box := gui.InitWindow(gw, name, gui.Yaxis)
if (box == nil) {
log.Println("gui.InitWindow() FAILED")
return
}
event := pb.MakeGetEvent()
event.Account = values.Account
websocketSendProtobuf(event)
@ -119,9 +129,9 @@ func showAccountClick(b *gui.GuiButton) {
log.Println("\tSHOW VMS count =", count)
// TODO: make sure login worked & the account really has zero VMs
// if (count != 0) {
name := "Virtual Machines (" + values.Account.Nick + ")"
mh := addVmsTab(gw, name, count, values.Account)
ReadReceivedData(currentMessage, mh, b.Box)
mh := addVmsTab(box, name, count, values.Account)
// ReadReceivedData(currentMessage, mh, b.Box)
ReadReceivedData(currentMessage, mh, box)
// }
currentMessage = nil
State = "done"

View File

@ -15,7 +15,8 @@ import pb "git.wit.com/wit/witProtobuf"
// which could be anything since TEXTCOLOR, TEXT, BG, etc
// fields use between 1 and 3 values internally
//
func addVmsTab(gw *gui.GuiWindow, name string, count int, a *pb.Account) *gui.TableData {
// func addVmsTab(gw *gui.GuiWindow, name string, count int, a *pb.Account) *gui.TableData {
func addVmsTab(box *gui.GuiBox, name string, count int, a *pb.Account) *gui.TableData {
var parts []gui.TableColumnData
human := 0
@ -69,7 +70,8 @@ func addVmsTab(gw *gui.GuiWindow, name string, count int, a *pb.Account) *gui.Ta
parts = append(parts, tmp)
human += 1
mh := gui.AddTableTab(gw, name, count, parts)
// mh := gui.AddTableTab(gw, name, count, parts)
mh := gui.AddTableBox(box, name, count, parts)
makeButton(mh.Box, a, nil, "Add Virtual Machine", "JUNK", createAddVmBox)
makeButton(mh.Box, a, nil, "Login", "JUNK", login)