start adding a VM page

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-24 01:17:14 -07:00
parent ec46388402
commit 9949a02b3e
2 changed files with 126 additions and 5 deletions

View File

@ -59,7 +59,9 @@ func (mh *TableData) CellValue(m *ui.TableModel, row, column int) ui.TableValue
return nil
}
bgcolor := libuiColorToGOlangColor(mh.Rows[row].HumanData[humanID].Color)
log.Println("CellValue() BGCOLOR =", bgcolor)
if (Data.Debug) {
log.Println("CellValue() BGCOLOR =", bgcolor)
}
return bgcolor
}
return libuiColorToGOlangColor(mh.Rows[row].HumanData[humanID].Color)
@ -98,6 +100,10 @@ func defaultSetCellValue(mh *TableData, row int, column int) {
log.Println("defaultSetCellValue() FOUND THE BUTTON!!!!!!! Button was pressed START", row, column)
Data.CurrentVM = fmt.Sprintf("%s",vmname)
log.Println("Data.CurrentVM =", Data.CurrentVM)
go ui.Main(ShowVM)
if (Data.Debug) {
go ui.Main(ShowVM)
} else {
AddVmConfigureTab(vmname)
}
}
}

View File

@ -7,7 +7,7 @@ import _ "github.com/andlabs/ui/winmanifest"
func ShowVM() {
name := Data.CurrentVM
log.Println("setupDemoUI() START Data.CurrentVM=", Data.CurrentVM)
log.Println("ShowVM() START Data.CurrentVM=", Data.CurrentVM)
VMwin := ui.NewWindow("VM " + name, 500, 300, false)
VMwin.OnClosing(func(*ui.Window) bool {
return true
@ -22,8 +22,123 @@ func ShowVM() {
VMwin.SetChild(VMtab)
VMwin.SetMargined(true)
// VMtab.Append("List examples", makeNumbersPage())
// VMtab.SetMargined(0, true)
vmBox := createVmBox(buttonClick)
VMtab.Append(Data.CurrentVM, vmBox)
VMtab.SetMargined(0, true)
VMwin.Show()
}
func AddVmConfigureTab(name string) {
vmBox := createVmBox(buttonClick)
Data.cloudTab.Append(name, vmBox)
Data.cloudTab.SetMargined(0, true)
}
func createVmBox(custom func(int, string)) *ui.Box {
vbox := ui.NewVerticalBox()
vbox.SetPadded(true)
hboxAccount := ui.NewHorizontalBox()
hboxAccount.SetPadded(true)
vbox.Append(hboxAccount, false)
// Start 'Provider' vertical box
vboxC := ui.NewVerticalBox()
vboxC.SetPadded(true)
vboxC.Append(ui.NewLabel("Cloud Provider:"), false)
cbox := ui.NewCombobox()
cbox.Append("WIT")
cbox.Append("Evocative")
vboxC.Append(cbox, false)
cbox.SetSelected(0)
cbox.OnSelected(func(*ui.Combobox) {
log.Println("OK. Selected Cloud Provider =", cbox.Selected())
})
hboxAccount.Append(vboxC, false)
// End 'Cloud Provider' vertical box
// Start 'Region' vertical box
vboxR := ui.NewVerticalBox()
vboxR.SetPadded(true)
vboxR.Append(ui.NewLabel("Region:"), false)
regbox := ui.NewCombobox()
regbox.Append("Any")
regbox.Append("SF")
vboxR.Append(regbox, false)
regbox.SetSelected(0)
regbox.OnSelected(func(*ui.Combobox) {
log.Println("OK. Selected something =", regbox.Selected())
})
hboxAccount.Append(vboxR, false)
// End 'Region' vertical box
// Start 'Nickname' vertical box
vboxN := ui.NewVerticalBox()
vboxN.SetPadded(true)
vboxN.Append(ui.NewLabel("Account Nickname:"), false)
entryNick := ui.NewEntry()
entryNick.SetReadOnly(false)
vboxN.Append(entryNick, false)
entryNick.OnChanged(func(*ui.Entry) {
log.Println("OK. nickname =", entryNick.Text())
Data.AccNick = entryNick.Text()
})
hboxAccount.Append(vboxN, false)
// End 'Nickname' vertical box
// Start 'Username' vertical box
vboxU := ui.NewVerticalBox()
vboxU.SetPadded(true)
vboxU.Append(ui.NewLabel("Account Username:"), false)
entryUser := ui.NewEntry()
entryUser.SetReadOnly(false)
vboxU.Append(entryUser, false)
entryUser.OnChanged(func(*ui.Entry) {
log.Println("OK. username =", entryUser.Text())
Data.AccUser = entryUser.Text()
})
hboxAccount.Append(vboxU, false)
// End 'Username' vertical box
// Start 'Password' vertical box
vboxP := ui.NewVerticalBox()
vboxP.SetPadded(true)
vboxP.Append(ui.NewLabel("Account Password:"), false)
entryPass := ui.NewEntry()
entryPass.SetReadOnly(false)
vboxP.Append(entryPass, false)
entryPass.OnChanged(func(*ui.Entry) {
log.Println("OK. password =", entryPass.Text())
Data.AccPass = entryPass.Text()
})
hboxAccount.Append(vboxP, false)
// End 'Password' vertical box
vbox.Append(ui.NewHorizontalSeparator(), false)
hboxButtons := ui.NewHorizontalBox()
hboxButtons.SetPadded(true)
vbox.Append(hboxButtons, false)
okButton := CreateButton("Add Account", "ADD", custom)
hboxButtons.Append(okButton, false)
backButton := CreateButton("Back", "BACK", custom)
hboxButtons.Append(backButton, false)
return vbox
}