auto login's in

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-13 16:37:17 -07:00
parent db7d9b8de7
commit 3f9885bc6a
4 changed files with 38 additions and 6 deletions

View File

@ -41,7 +41,12 @@ func makeCloudInfoBox(gw *gui.GuiWindow) {
// makeButton(vbox, config.Accounts[key], nil, name, "SHOW", showAccountClick)
// name = "Configure"
makeButton(vbox, config.Accounts[key], nil, "Configure", "CONFIG", showAccountClick)
makeButton(vbox, config.Accounts[key], nil, "Configure", "JUNK", showAccountClick)
makeButton(vbox, config.Accounts[key], nil, "Delete", "JUNK", func (*gui.GuiButton) {
config.Accounts[key] = config.Accounts[len(config.Accounts)-1]
config.Accounts = config.Accounts[:len(config.Accounts)-1]
})
name := config.Accounts[key].Nick + " (" + config.Accounts[key].Domain + ")"
gui.NewLabel(vbox, name)
@ -52,7 +57,9 @@ func makeCloudInfoBox(gw *gui.GuiWindow) {
log.Println("makeCloudInfoBox() Add Account")
createAccount(box.Window)
})
makeButton(Xbox, nil, nil, "Quit", "QUIT", nil)
makeButton(Xbox, nil, nil, "Quit", "QUIT", func (*gui.GuiButton) {
onExit(nil)
})
makeButton(Xbox, nil, nil, "Debug", "DEBUG", debugClick)
log.Println("makeCloudInfoBox() END")
}

View File

@ -99,9 +99,17 @@ func showAccountClick(b *gui.GuiButton) {
log.Println("\tshowAccountClick() values.Accounts =", values.Accounts)
log.Println("\tshowAccountClick() values.Name = ", values.Name)
name := "Virtual Machines (" + values.Account.Nick + ")"
gw := b.Box.Window
makeAccountWindow(gw, values.Account)
log.Println("\tshowAccountClick() END")
}
func makeAccountWindow(gw *gui.GuiWindow, account *pb.Account) {
log.Println("\tmakeAccountWindow() START")
name := "Virtual Machines (" + account.Nick + ")"
// TODO: make this text i18n
box := gui.InitWindow(gw, name, gui.Yaxis)
if (box == nil) {
@ -111,7 +119,7 @@ func showAccountClick(b *gui.GuiButton) {
gw = box.Window
event := pb.MakeGetEvent()
event.Account = values.Account
event.Account = account
websocketSendProtobuf(event)
count := 0
@ -130,7 +138,7 @@ func showAccountClick(b *gui.GuiButton) {
log.Println("\tSHOW VMS count =", count)
// TODO: make sure login worked & the account really has zero VMs
// if (count != 0) {
mh := addVmsTab(box, name, count, values.Account)
mh := addVmsTab(box, name, count, account)
// ReadReceivedData(currentMessage, mh, b.Box)
ReadReceivedData(currentMessage, mh, box)
// }

View File

@ -63,15 +63,20 @@ func debugClick(b *gui.GuiButton) {
time.Sleep(2000 * time.Millisecond)
box.Window.UiTab.Show()
})
/*
makeButton(Ybox2, nil, nil, "Destroy tab 0", "SUBDOMAIN", func (*gui.GuiButton) {
log.Println("debugClick() Destroy(0)")
box := gw.BoxMap["MAINBOX"]
box.Window.UiTab.Delete(0)
})
*/
makeButton(Ybox2, nil, nil, "Destroy Splash", "SUBDOMAIN", func (*gui.GuiButton) {
log.Println("debugClick() Destroy(0)")
gui.DeleteWindow("Splash")
})
makeButton(Ybox2, nil, nil, "Destroy Debugging Tab", "SUBDOMAIN", func (*gui.GuiButton) {
gui.DeleteWindow("Debugging")
})
makeButton(Ybox2, nil, nil, "Load the default test config file", "SUBDOMAIN", func (*gui.GuiButton) {
newConfig := loadDefaultConfig()

View File

@ -76,6 +76,19 @@ func getNEWTEXT() *ui.AttributedString {
func splashClick(b *gui.GuiButton) {
log.Println("splashClick() START")
gw := b.Box.Window
// remove the splash screen
gui.DeleteWindow("Splash")
tmp := len(config.Accounts)
log.Println("splashClick() There are", tmp, "accounts")
if (tmp == 1) {
// Alfonso and Christina suggested auto login here
makeAccountWindow(gw, config.Accounts[0])
makeCloudInfoBox(gw)
return
}
// if there is already an account, skip straight to the main screen
for key, _ := range config.Accounts {
log.Println("gui.State = splash BUT THERE IS AN ACCOUNT Account = ", config.Accounts[key])
@ -83,7 +96,6 @@ func splashClick(b *gui.GuiButton) {
return
}
// gw.UiTab.Delete(0) // does this make things more or less stable or neither?
createAccount(gw)
log.Println("splashClick() END")
}