From 49e3887aa68b3d061a3f740c5479999c01762087 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 30 May 2019 01:58:05 -0700 Subject: [PATCH] generate subdomain Signed-off-by: Jeff Carr --- addAccount.go | 26 ++++++++++++++++++-------- area.go | 1 + gui.go | 3 ++- mainCloudBox.go | 6 ++++++ 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/addAccount.go b/addAccount.go index a1d1d25..f20441e 100644 --- a/addAccount.go +++ b/addAccount.go @@ -10,24 +10,27 @@ var subdomain *ui.Entry func AddAccountQuestionBox(wm *WindowMap) *ui.Box { vbox := ui.NewVerticalBox() vbox.SetPadded(true) + wm.Box1 = vbox - vboxN := ui.NewVerticalBox() - vboxN.SetPadded(true) - vboxN.Append(ui.NewLabel("Enter your Subdomain:"), false) + hbox := ui.NewHorizontalBox() + hbox.SetPadded(true) + vbox.Append(hbox, false) + + hbox.Append(ui.NewLabel("Enter your Subdomain or"), false) + + generate := CreateButton(wm, nil, nil, "Make me a Subdomain", "SUBDOMAIN", generateSubdomain) + hbox.Append(generate, false) subdomain = ui.NewEntry() subdomain.SetReadOnly(false) - - vboxN.Append(subdomain, false) - subdomain.OnChanged(func(*ui.Entry) { log.Println("OK. subdomain =", subdomain.Text()) }) - vbox.Append(vboxN, false) + vbox.Append(subdomain, false) vbox.Append(ui.NewHorizontalSeparator(), false) - okButton := CreateButton(wm, nil, nil, "Make me a Subdomain", "SUBDOMAIN", generateSubdomain) + okButton := CreateButton(wm, nil, nil, "Create Subdomain Account", "SUBDOMAIN", addSubdomain) vbox.Append(okButton, false) return vbox @@ -39,6 +42,13 @@ func generateSubdomain(b *ButtonMap) { log.Println("generateSubdomain END") } +func addSubdomain(b *ButtonMap) { + log.Println("generateSubdomain START") + sub := subdomain.Text() + log.Println("generateSubdomain subdomain =", sub) + log.Println("generateSubdomain END") +} + func AddAccountBox(wm *WindowMap) *ui.Box { vbox := ui.NewVerticalBox() vbox.SetPadded(true) diff --git a/area.go b/area.go index 9c1e5b9..f4f78ac 100644 --- a/area.go +++ b/area.go @@ -28,6 +28,7 @@ func makeSplashArea(wm *WindowMap, ah *AreaHandler) { // ah.Attrstr = makeAttributedString() ah.Area = ui.NewArea(ah) newB.A = ah.Area + newB.WM = wm // Data.AllButtons[1].A = ah.Area // ah.Button = &Data.AllButtons[1] ah.Button = newB diff --git a/gui.go b/gui.go index 7e880c7..84fb13c 100644 --- a/gui.go +++ b/gui.go @@ -175,6 +175,7 @@ func defaultButtonClick(button *ui.Button) { for key, foo := range Data.AllButtons { if (Data.Debug) { log.Println("defaultButtonClick() Data.AllButtons =", key, foo) + spew.Dump(foo) } if Data.AllButtons[key].B == button { log.Println("\tdefaultButtonClick() BUTTON MATCHED") @@ -184,7 +185,7 @@ func defaultButtonClick(button *ui.Button) { log.Println("\tdefaultButtonClick() DOING CUSTOM FUNCTION") var tmp ButtonMap tmp = Data.AllButtons[key] - spew.Dump(tmp) + // spew.Dump(tmp) Data.AllButtons[key].custom(&tmp) return } diff --git a/mainCloudBox.go b/mainCloudBox.go index 670ae7b..74de80a 100644 --- a/mainCloudBox.go +++ b/mainCloudBox.go @@ -3,6 +3,7 @@ package gui import "log" import "time" import "regexp" +import "os" // import "reflect" import "github.com/andlabs/ui" @@ -161,6 +162,11 @@ func AddVmsTab(wm *WindowMap, name string, count int, a *pb.Account) *TableData } func ShowAccountQuestionTab(wm *WindowMap) { + log.Println("ShowAccountQuestionTab() wm =", wm) + if (wm.T == nil) { + log.Println("ShowAccountQuestionTab() wm.T = nil THIS IS BAD") + os.Exit(-1) + } wm.T.Delete(0) log.Println("Sleep(200)")