2019-05-22 20:35:00 -05:00
|
|
|
package gui
|
|
|
|
|
|
|
|
import "log"
|
|
|
|
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
2019-05-30 03:23:46 -05:00
|
|
|
var subdomain *ui.Entry
|
|
|
|
|
2019-05-30 10:52:28 -05:00
|
|
|
func AddAccountQuestionBox(wm *GuiWindow) *ui.Box {
|
2019-05-30 03:23:46 -05:00
|
|
|
vbox := ui.NewVerticalBox()
|
|
|
|
vbox.SetPadded(true)
|
2019-05-30 03:58:05 -05:00
|
|
|
wm.Box1 = vbox
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-30 03:58:05 -05:00
|
|
|
hbox := ui.NewHorizontalBox()
|
|
|
|
hbox.SetPadded(true)
|
|
|
|
vbox.Append(hbox, false)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-30 03:58:05 -05:00
|
|
|
hbox.Append(ui.NewLabel("Enter your Subdomain or"), false)
|
2019-05-22 22:03:17 -05:00
|
|
|
|
2019-05-30 10:52:28 -05:00
|
|
|
generate := CreateButton(wm, nil, nil, "Generate", "SUBDOMAIN", generateSubdomain)
|
2019-05-30 03:58:05 -05:00
|
|
|
hbox.Append(generate, false)
|
2019-05-30 03:23:46 -05:00
|
|
|
|
2019-05-30 03:58:05 -05:00
|
|
|
subdomain = ui.NewEntry()
|
|
|
|
subdomain.SetReadOnly(false)
|
2019-05-30 03:23:46 -05:00
|
|
|
subdomain.OnChanged(func(*ui.Entry) {
|
|
|
|
log.Println("OK. subdomain =", subdomain.Text())
|
|
|
|
})
|
2019-05-30 03:58:05 -05:00
|
|
|
vbox.Append(subdomain, false)
|
2019-05-30 03:23:46 -05:00
|
|
|
|
|
|
|
vbox.Append(ui.NewHorizontalSeparator(), false)
|
|
|
|
|
2019-05-30 03:58:05 -05:00
|
|
|
okButton := CreateButton(wm, nil, nil, "Create Subdomain Account", "SUBDOMAIN", addSubdomain)
|
2019-05-30 03:23:46 -05:00
|
|
|
vbox.Append(okButton, false)
|
|
|
|
|
|
|
|
return vbox
|
|
|
|
}
|
2019-05-22 22:03:17 -05:00
|
|
|
|
2019-05-30 10:55:54 -05:00
|
|
|
func generateSubdomain(b *GuiButton) {
|
2019-05-30 03:23:46 -05:00
|
|
|
log.Println("generateSubdomain START")
|
|
|
|
subdomain.SetText("cust00013.wit.dev")
|
|
|
|
log.Println("generateSubdomain END")
|
2019-05-22 22:03:17 -05:00
|
|
|
}
|
|
|
|
|
2019-05-30 10:55:54 -05:00
|
|
|
func addSubdomain(b *GuiButton) {
|
2019-05-30 03:58:05 -05:00
|
|
|
log.Println("generateSubdomain START")
|
|
|
|
sub := subdomain.Text()
|
|
|
|
log.Println("generateSubdomain subdomain =", sub)
|
|
|
|
log.Println("generateSubdomain END")
|
|
|
|
}
|
|
|
|
|
2019-05-30 10:52:28 -05:00
|
|
|
func AddAccountBox(wm *GuiWindow) *ui.Box {
|
2019-05-22 20:35:00 -05:00
|
|
|
vbox := ui.NewVerticalBox()
|
|
|
|
vbox.SetPadded(true)
|
2019-05-22 22:03:17 -05:00
|
|
|
|
|
|
|
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())
|
2019-05-22 20:35:00 -05:00
|
|
|
})
|
2019-05-22 22:03:17 -05:00
|
|
|
hboxAccount.Append(vboxC, false)
|
|
|
|
// End 'Cloud Provider' vertical box
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
// 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)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
regbox.OnSelected(func(*ui.Combobox) {
|
|
|
|
log.Println("OK. Selected something =", regbox.Selected())
|
2019-05-22 20:35:00 -05:00
|
|
|
})
|
2019-05-22 22:03:17 -05:00
|
|
|
hboxAccount.Append(vboxR, false)
|
|
|
|
// End 'Region' vertical box
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
// Start 'Nickname' vertical box
|
|
|
|
vboxN := ui.NewVerticalBox()
|
|
|
|
vboxN.SetPadded(true)
|
|
|
|
vboxN.Append(ui.NewLabel("Account Nickname:"), false)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-27 12:55:10 -05:00
|
|
|
Data.EntryNick = ui.NewEntry()
|
|
|
|
Data.EntryNick.SetReadOnly(false)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-27 12:55:10 -05:00
|
|
|
vboxN.Append(Data.EntryNick, false)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-27 12:55:10 -05:00
|
|
|
Data.EntryNick.OnChanged(func(*ui.Entry) {
|
|
|
|
log.Println("OK. nickname =", Data.EntryNick.Text())
|
2019-05-24 20:17:05 -05:00
|
|
|
// Data.AccNick = entryNick.Text()
|
2019-05-22 22:03:17 -05:00
|
|
|
})
|
|
|
|
hboxAccount.Append(vboxN, false)
|
|
|
|
// End 'Nickname' vertical box
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
// Start 'Username' vertical box
|
|
|
|
vboxU := ui.NewVerticalBox()
|
|
|
|
vboxU.SetPadded(true)
|
|
|
|
vboxU.Append(ui.NewLabel("Account Username:"), false)
|
|
|
|
|
2019-05-27 12:55:10 -05:00
|
|
|
Data.EntryUser = ui.NewEntry()
|
|
|
|
Data.EntryUser.SetReadOnly(false)
|
2019-05-22 22:03:17 -05:00
|
|
|
|
2019-05-27 12:55:10 -05:00
|
|
|
vboxU.Append(Data.EntryUser, false)
|
2019-05-22 22:03:17 -05:00
|
|
|
|
2019-05-27 12:55:10 -05:00
|
|
|
Data.EntryUser.OnChanged(func(*ui.Entry) {
|
|
|
|
log.Println("OK. username =", Data.EntryUser.Text())
|
2019-05-24 20:17:05 -05:00
|
|
|
// Data.AccUser = entryUser.Text()
|
2019-05-22 22:03:17 -05:00
|
|
|
})
|
|
|
|
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)
|
|
|
|
|
2019-05-27 12:55:10 -05:00
|
|
|
Data.EntryPass = ui.NewEntry()
|
|
|
|
Data.EntryPass.SetReadOnly(false)
|
2019-05-22 22:03:17 -05:00
|
|
|
|
2019-05-27 12:55:10 -05:00
|
|
|
vboxP.Append(Data.EntryPass, false)
|
2019-05-22 22:03:17 -05:00
|
|
|
|
2019-05-27 12:55:10 -05:00
|
|
|
Data.EntryPass.OnChanged(func(*ui.Entry) {
|
|
|
|
log.Println("OK. password =", Data.EntryPass.Text())
|
2019-05-24 20:17:05 -05:00
|
|
|
// Data.AccPass = entryPass.Text()
|
2019-05-22 22:03:17 -05:00
|
|
|
})
|
|
|
|
hboxAccount.Append(vboxP, false)
|
|
|
|
// End 'Password' vertical box
|
|
|
|
|
|
|
|
vbox.Append(ui.NewHorizontalSeparator(), false)
|
|
|
|
|
|
|
|
hboxButtons := ui.NewHorizontalBox()
|
|
|
|
hboxButtons.SetPadded(true)
|
|
|
|
vbox.Append(hboxButtons, false)
|
|
|
|
|
2019-05-29 21:57:15 -05:00
|
|
|
okButton := CreateButton(wm, nil, nil, "Add Account", "ADD", nil)
|
2019-05-22 22:03:17 -05:00
|
|
|
hboxButtons.Append(okButton, false)
|
|
|
|
|
2019-05-29 21:57:15 -05:00
|
|
|
backButton := CreateButton(wm, nil, nil, "Back", "BACK", nil)
|
2019-05-22 22:03:17 -05:00
|
|
|
hboxButtons.Append(backButton, false)
|
2019-05-27 12:55:10 -05:00
|
|
|
|
|
|
|
return vbox
|
2019-05-22 20:35:00 -05:00
|
|
|
}
|