summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-05-26 17:28:34 -0700
committerJeff Carr <[email protected]>2019-05-26 17:28:34 -0700
commit58209fde5d2f88b6f43565cfc5e6f08d5190dc0f (patch)
tree50d61065247cab06f82ce81754b49f9474874d4e
parent3bf115b56e75db0488a797f110c8717ff9a5a966 (diff)
experiement with 'show vm' as a window or a tab
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--gui.go17
-rw-r--r--mainCloudBox.go45
-rw-r--r--structs.go1
3 files changed, 35 insertions, 28 deletions
diff --git a/gui.go b/gui.go
index 9199eca..8b3b1e0 100644
--- a/gui.go
+++ b/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
}
diff --git a/mainCloudBox.go b/mainCloudBox.go
index 973d510..f474f83 100644
--- a/mainCloudBox.go
+++ b/mainCloudBox.go
@@ -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)
diff --git a/structs.go b/structs.go
index b5377ee..d28d3c9 100644
--- a/structs.go
+++ b/structs.go
@@ -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