vm code completely moved out of 'gui'

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-01 03:24:53 -07:00
parent 6bba691f3f
commit f025c96b94
2 changed files with 42 additions and 19 deletions

View File

@ -362,10 +362,10 @@ func mainMouseClick(b *gui.GuiButton) {
// go gui.GoShowVM()
log.Println("\tATTEMPTING TO SHOW VM TAB gw = ", gw)
gui.CreateVmBox(gw, b.VM)
createVmBox(gw, b.VM)
} else {
log.Println("\tATTEMPTING TO SHOW VM TAB gw = ", gw)
gui.CreateVmBox(gw, b.VM)
createVmBox(gw, b.VM)
}
} else if (b.Action == "SHOW") {
log.Println("\tTRIGGER DISPLAY ACCOUNT")

57
vm.go
View File

@ -1,7 +1,7 @@
package main
import "log"
// import "fmt"
import "fmt"
import "git.wit.com/wit/gui"
import pb "git.wit.com/wit/witProtobuf"
@ -74,7 +74,7 @@ func addVmsTab(gw *gui.GuiWindow, name string, count int, a *pb.Account) *gui.Ta
mh := gui.AddTableTab(gw, name, count, parts, a)
box := mh.Box
okButton := gui.CreateButton(box, a, nil, "Add Virtual Machine", "createAddVmBox", createAddVmBox)
okButton := gui.CreateButton(box, a, nil, "Add Virtual Machine", "JUNK", createAddVmBox)
gui.AddButtonToBox(box, okButton)
return mh
@ -98,26 +98,49 @@ func createAddVmBox(b *gui.GuiButton) {
log.Println("createAddVmBox() hostname, memory, disk =", hostname, memory, disk)
gui.HorizontalBreak(box)
// vbox.Append(ui.NewHorizontalSeparator(), false)
// hboxButtons := ui.NewHorizontalBox()
// hboxButtons.SetPadded(true)
// vbox.Append(hboxButtons, false)
add := gui.CreateButton(box, b.Account, nil, "Add Virtual Machine", "CREATE", nil)
gui.AddButtonToBox(box, add)
// gui.AddBoxToTab(name, gw.UiTab, vbox)
cancel := gui.CreateButton(box, b.Account, nil, "Cancel", "CLOSE", nil)
gui.AddButtonToBox(box, cancel)
}
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)
box := gui.CreateBox(gw, vm.Name)
// Add hostname entry box
gui.MakeEntryVbox(box, "hostname:", vm.Hostname, true, "Hostname")
gui.MakeEntryVbox(box, "IPv6:", vm.IPv6, true, "IPv6")
gui.MakeEntryVbox(box, "RAM:", fmt.Sprintf("%d",vm.Memory), true, "Memory")
gui.MakeEntryVbox(box, "CPU:", fmt.Sprintf("%d",vm.Cpus), true, "Cpus")
gui.MakeEntryVbox(box, "Disk (GB):", fmt.Sprintf("%d",vm.Disk), true, "Disk")
gui.MakeEntryVbox(box, "OS Image:", vm.BaseImage, true, "BaseImage")
/*
var newb GuiButton
newb.Action = "CREATE"
newb.VM = b.VM
newb.Account = b.Account
hostname.B = &newb
memory.B = &newb
disk.B = &newb
hboxButtons.Append(AddButton(&newb, "Add Virtual Machine"), false)
vbox.Append(ui.NewHorizontalSeparator(), false)
a := CreateButton(box, nil, nil, "Cancel", "CLOSE", nil)
hboxButtons := ui.NewHorizontalBox()
hboxButtons.SetPadded(true)
vbox.Append(hboxButtons, false)
a := CreateButton(box, nil, vm, "Power On", "POWERON", nil)
hboxButtons.Append(a.B, false)
a = CreateButton(box, nil, vm, "Power Off", "POWEROFF", nil)
hboxButtons.Append(a.B, false)
a = CreateButton(box, nil, vm, "Destroy", "DESTROY", nil)
hboxButtons.Append(a.B, false)
a = CreateButton(box, nil, vm, "ping", "PING", runPingClick)
hboxButtons.Append(a.B, false)
a = CreateButton(box, nil, vm, "Console", "XTERM", runTestExecClick)
hboxButtons.Append(a.B, false)
a = CreateButton(box, nil, vm, "Save", "SAVE", nil)
hboxButtons.Append(a.B, false)
a = CreateButton(box, nil, vm, "Done", "DONE", nil)
hboxButtons.Append(a.B, false)
*/
}