try to list the registered accounts

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-23 09:48:12 -07:00
parent cf9fe10d1e
commit b9ade31605
2 changed files with 21 additions and 29 deletions

28
gui.go
View File

@ -64,29 +64,12 @@ type ButtonMap struct {
Note string // what type of button Note string // what type of button
} }
func setupUI() { /*
Data.mainwin = ui.NewWindow("Cloud Control Panel", Data.Width, Data.Height, false)
Data.mainwin.OnClosing(func(*ui.Window) bool {
ui.Quit()
return true
})
ui.OnShouldQuit(func() bool {
Data.mainwin.Destroy()
return true
})
Data.maintab = ui.NewTab()
Data.mainwin.SetChild(Data.maintab)
Data.mainwin.SetMargined(true)
Data.tabcount = 0
Data.mainwin.Show()
}
func AddNewTab(mytab *ui.Tab, newbox ui.Control, tabOffset int) { func AddNewTab(mytab *ui.Tab, newbox ui.Control, tabOffset int) {
mytab.Append("Cloud Info", newbox) mytab.Append("Cloud Info", newbox)
mytab.SetMargined(tabOffset, true) mytab.SetMargined(tabOffset, true)
} }
*/
func InitColumns(mh *TableData, parts []TableColumnData) { func InitColumns(mh *TableData, parts []TableColumnData) {
tmpBTindex := 0 tmpBTindex := 0
@ -182,13 +165,6 @@ func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts
return mh return mh
} }
func DoGUI() {
for {
ui.Main(setupUI)
log.Println("GUI exited. Not sure what to do here. os.Exit() ?")
}
}
func defaultButtonClick(button *ui.Button) { func defaultButtonClick(button *ui.Button) {
log.Println("defaultButtonClick() button =", button) log.Println("defaultButtonClick() button =", button)
for key, foo := range Data.allButtons { for key, foo := range Data.allButtons {

View File

@ -5,6 +5,7 @@ import "time"
import "fmt" import "fmt"
import "runtime/debug" import "runtime/debug"
import "runtime" import "runtime"
import "os"
import "github.com/gookit/config" import "github.com/gookit/config"
@ -51,12 +52,11 @@ func makeCloudInfoBox(custom func(int, string)) *ui.Box {
vbox.SetPadded(true) vbox.SetPadded(true)
hbox.Append(vbox, true) hbox.Append(vbox, true)
/*
grid := ui.NewGrid() grid := ui.NewGrid()
grid.SetPadded(true) grid.SetPadded(true)
vbox.Append(grid, false) vbox.Append(grid, false)
*/
msggrid := ui.NewGrid()
msggrid.SetPadded(true)
entryForm := ui.NewForm() entryForm := ui.NewForm()
entryForm.SetPadded(true) entryForm.SetPadded(true)
@ -70,6 +70,22 @@ func makeCloudInfoBox(custom func(int, string)) *ui.Box {
entryForm.Append("IPv6:", IPv6entry, false) entryForm.Append("IPv6:", IPv6entry, false)
IPv6entry.SetText("2604:bbc0:3:3:0:10:0:1003") IPv6entry.SetText("2604:bbc0:3:3:0:10:0:1003")
vbox.Append(ui.NewHorizontalSeparator(), false)
vbox.Append(ui.NewLabel("Accounts:"), false)
agrid := ui.NewGrid()
agrid.SetPadded(true)
for account, _ := range config.StringMap("accounts") {
hostname := config.String("cloud." + account + ".hostname")
domainname := config.String("cloud." + account + ".hostname")
port := config.String("cloud." + account + ".port")
a := account + " " + hostname + " " + domainname + " " + port
log.Println("ACCOUNT: ", a)
vbox.Append(ui.NewLabel(a), false)
}
os.Exit(0)
return hbox return hbox
} }