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) // makeButton(vbox, config.Accounts[key], nil, name, "SHOW", showAccountClick)
// name = "Configure" // 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 + ")" name := config.Accounts[key].Nick + " (" + config.Accounts[key].Domain + ")"
gui.NewLabel(vbox, name) gui.NewLabel(vbox, name)
@ -52,7 +57,9 @@ func makeCloudInfoBox(gw *gui.GuiWindow) {
log.Println("makeCloudInfoBox() Add Account") log.Println("makeCloudInfoBox() Add Account")
createAccount(box.Window) 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) makeButton(Xbox, nil, nil, "Debug", "DEBUG", debugClick)
log.Println("makeCloudInfoBox() END") 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.Accounts =", values.Accounts)
log.Println("\tshowAccountClick() values.Name = ", values.Name) log.Println("\tshowAccountClick() values.Name = ", values.Name)
name := "Virtual Machines (" + values.Account.Nick + ")"
gw := b.Box.Window 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 // TODO: make this text i18n
box := gui.InitWindow(gw, name, gui.Yaxis) box := gui.InitWindow(gw, name, gui.Yaxis)
if (box == nil) { if (box == nil) {
@ -111,7 +119,7 @@ func showAccountClick(b *gui.GuiButton) {
gw = box.Window gw = box.Window
event := pb.MakeGetEvent() event := pb.MakeGetEvent()
event.Account = values.Account event.Account = account
websocketSendProtobuf(event) websocketSendProtobuf(event)
count := 0 count := 0
@ -130,7 +138,7 @@ func showAccountClick(b *gui.GuiButton) {
log.Println("\tSHOW VMS count =", count) log.Println("\tSHOW VMS count =", count)
// TODO: make sure login worked & the account really has zero VMs // TODO: make sure login worked & the account really has zero VMs
// if (count != 0) { // if (count != 0) {
mh := addVmsTab(box, name, count, values.Account) mh := addVmsTab(box, name, count, account)
// ReadReceivedData(currentMessage, mh, b.Box) // ReadReceivedData(currentMessage, mh, b.Box)
ReadReceivedData(currentMessage, mh, box) ReadReceivedData(currentMessage, mh, box)
// } // }

View File

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

View File

@ -76,6 +76,19 @@ func getNEWTEXT() *ui.AttributedString {
func splashClick(b *gui.GuiButton) { func splashClick(b *gui.GuiButton) {
log.Println("splashClick() START") log.Println("splashClick() START")
gw := b.Box.Window 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 // if there is already an account, skip straight to the main screen
for key, _ := range config.Accounts { for key, _ := range config.Accounts {
log.Println("gui.State = splash BUT THERE IS AN ACCOUNT Account = ", config.Accounts[key]) log.Println("gui.State = splash BUT THERE IS AN ACCOUNT Account = ", config.Accounts[key])
@ -83,7 +96,6 @@ func splashClick(b *gui.GuiButton) {
return return
} }
// gw.UiTab.Delete(0) // does this make things more or less stable or neither?
createAccount(gw) createAccount(gw)
log.Println("splashClick() END") log.Println("splashClick() END")
} }