experiement with 'show vm' as a window or a tab
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
38185c3156
commit
34d081f856
17
gui.go
17
gui.go
|
@ -134,14 +134,16 @@ func mouseClick(b *ButtonMap) {
|
|||
createAddVmBox(Data.cloudTab, "Create New Virtual Machine")
|
||||
return
|
||||
}
|
||||
/*
|
||||
if (b.Action == "SHOW VM") {
|
||||
Data.CurrentVM = b.VM
|
||||
if (Data.Debug) {
|
||||
go ui.Main(ShowVM)
|
||||
} else {
|
||||
createVmBox(Data.cloudTab, b.VM)
|
||||
CreateVmBox(Data.cloudTab, b.VM)
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (b.Action == "WINDOW CLOSE") {
|
||||
b.W.Hide()
|
||||
// TODO: fix this (seems to crash? maybe because we are in the button here?)
|
||||
|
@ -203,12 +205,13 @@ func CreateButton(a *pb.Account, vm *pb.Event_VM,
|
|||
newB.OnClicked(defaultButtonClick)
|
||||
|
||||
var newmap ButtonMap
|
||||
newmap.B = newB
|
||||
newmap.Account = a
|
||||
newmap.VM = vm
|
||||
newmap.Action = action
|
||||
newmap.custom = custom
|
||||
Data.AllButtons = append(Data.AllButtons, newmap)
|
||||
newmap.B = newB
|
||||
newmap.T = Data.cloudTab
|
||||
newmap.Account = a
|
||||
newmap.VM = vm
|
||||
newmap.Action = action
|
||||
newmap.custom = custom
|
||||
Data.AllButtons = append(Data.AllButtons, newmap)
|
||||
|
||||
return newB
|
||||
}
|
||||
|
|
|
@ -235,6 +235,10 @@ func makeCloudWindow() {
|
|||
Data.State = "splash"
|
||||
}
|
||||
|
||||
func GoShowVM() {
|
||||
ui.Main(ShowVM)
|
||||
}
|
||||
|
||||
func ShowVM() {
|
||||
name := Data.CurrentVM.Name
|
||||
log.Println("ShowVM() START Data.CurrentVM=", Data.CurrentVM)
|
||||
|
@ -259,12 +263,12 @@ func ShowVM() {
|
|||
VMwin.SetChild(VMtab)
|
||||
VMwin.SetMargined(true)
|
||||
|
||||
createVmBox(VMtab, Data.CurrentVM)
|
||||
CreateVmBox(VMtab, Data.CurrentVM)
|
||||
VMwin.Show()
|
||||
}
|
||||
|
||||
func AddVmConfigureTab(name string, pbVM *pb.Event_VM) {
|
||||
createVmBox(Data.cloudTab, Data.CurrentVM)
|
||||
CreateVmBox(Data.cloudTab, Data.CurrentVM)
|
||||
}
|
||||
|
||||
// makeEntryBox(box, "hostname:", "blah.foo.org") {
|
||||
|
@ -312,12 +316,12 @@ func makeEntryHbox(hbox *ui.Box, a string, b string, edit bool) {
|
|||
// End 'Nickname' vertical box
|
||||
}
|
||||
|
||||
func createVmBox(tab *ui.Tab, pbVM *pb.Event_VM) {
|
||||
log.Println("createVmBox() START")
|
||||
log.Println("createVmBox() pbVM.Name", pbVM.Name)
|
||||
spew.Dump(pbVM)
|
||||
func CreateVmBox(tab *ui.Tab, vm *pb.Event_VM) {
|
||||
log.Println("CreateVmBox() START")
|
||||
log.Println("CreateVmBox() vm.Name", vm.Name)
|
||||
spew.Dump(vm)
|
||||
if (Data.Debug) {
|
||||
spew.Dump(pbVM)
|
||||
spew.Dump(vm)
|
||||
}
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
|
@ -327,12 +331,12 @@ func createVmBox(tab *ui.Tab, pbVM *pb.Event_VM) {
|
|||
vbox.Append(hboxAccount, false)
|
||||
|
||||
// Add hostname entry box
|
||||
makeEntryVbox(hboxAccount, "hostname:", pbVM.Hostname, true)
|
||||
makeEntryVbox(hboxAccount, "IPv6:", pbVM.IPv6, true)
|
||||
makeEntryVbox(hboxAccount, "RAM:", fmt.Sprintf("%d",pbVM.Memory), true)
|
||||
makeEntryVbox(hboxAccount, "CPU:", fmt.Sprintf("%d",pbVM.Cpus), true)
|
||||
makeEntryVbox(hboxAccount, "Disk (GB):", fmt.Sprintf("%d",pbVM.Disk), true)
|
||||
makeEntryVbox(hboxAccount, "OS Image:", pbVM.BaseImage, true)
|
||||
makeEntryVbox(hboxAccount, "hostname:", vm.Hostname, true)
|
||||
makeEntryVbox(hboxAccount, "IPv6:", vm.IPv6, true)
|
||||
makeEntryVbox(hboxAccount, "RAM:", fmt.Sprintf("%d",vm.Memory), true)
|
||||
makeEntryVbox(hboxAccount, "CPU:", fmt.Sprintf("%d",vm.Cpus), true)
|
||||
makeEntryVbox(hboxAccount, "Disk (GB):", fmt.Sprintf("%d",vm.Disk), true)
|
||||
makeEntryVbox(hboxAccount, "OS Image:", vm.BaseImage, true)
|
||||
|
||||
vbox.Append(ui.NewHorizontalSeparator(), false)
|
||||
|
||||
|
@ -340,14 +344,13 @@ func createVmBox(tab *ui.Tab, pbVM *pb.Event_VM) {
|
|||
hboxButtons.SetPadded(true)
|
||||
vbox.Append(hboxButtons, false)
|
||||
|
||||
log.Println("pbVM =", pbVM)
|
||||
hboxButtons.Append(CreateButton(nil, pbVM, "Power On", "POWERON", nil), false)
|
||||
hboxButtons.Append(CreateButton(nil, pbVM, "Power Off", "POWEROFF", nil), false)
|
||||
hboxButtons.Append(CreateButton(nil, pbVM, "Destroy", "DESTROY", nil), false)
|
||||
hboxButtons.Append(CreateButton(nil, pbVM, "ping", "PING", runPingClick), false)
|
||||
hboxButtons.Append(CreateButton(nil, pbVM, "Console", "XTERM", runTestExecClick), false)
|
||||
hboxButtons.Append(CreateButton(nil, pbVM, "Save", "SAVE", nil), false)
|
||||
hboxButtons.Append(CreateButton(nil, pbVM, "Done", "DONE", nil), false)
|
||||
hboxButtons.Append(CreateButton(nil, vm, "Power On", "POWERON", nil), false)
|
||||
hboxButtons.Append(CreateButton(nil, vm, "Power Off", "POWEROFF", nil), false)
|
||||
hboxButtons.Append(CreateButton(nil, vm, "Destroy", "DESTROY", nil), false)
|
||||
hboxButtons.Append(CreateButton(nil, vm, "ping", "PING", runPingClick), false)
|
||||
hboxButtons.Append(CreateButton(nil, vm, "Console", "XTERM", runTestExecClick), false)
|
||||
hboxButtons.Append(CreateButton(nil, vm, "Save", "SAVE", nil), false)
|
||||
hboxButtons.Append(CreateButton(nil, vm, "Done", "DONE", nil), false)
|
||||
|
||||
tab.Append(Data.CurrentVM.Name, vbox)
|
||||
tab.SetMargined(0, true)
|
||||
|
|
|
@ -102,6 +102,7 @@ type ButtonMap struct {
|
|||
FB *ui.FontButton
|
||||
A *ui.Area
|
||||
W *ui.Window
|
||||
T *ui.Tab
|
||||
|
||||
Account *pb.Account
|
||||
VM *pb.Event_VM
|
||||
|
|
Loading…
Reference in New Issue