diff --git a/config.go b/config.go index 13532e9..961d7c4 100644 --- a/config.go +++ b/config.go @@ -95,6 +95,10 @@ func parseConfig() { log.Println(config.String("map1.key1.jwc1")) - cloud := config.StringMap("cloud") - fmt.Printf("%#v\n",cloud) + for account, _ := range config.StringMap("cloud") { + port := config.String("cloud." + account + ".port") + proto := config.String("cloud." + account + ".proto") + hostname := config.String("cloud." + account + ".hostname") + fmt.Println(hostname, port, proto) + } } diff --git a/config.json b/config.json index 1868b00..cc88d0c 100644 --- a/config.json +++ b/config.json @@ -9,7 +9,13 @@ ], "baseKey": "value2", "cloud": { - "v000185.testing.com.customers.wprod.wit.com": { + "jcarr": { + "hostname": "fire.lab.wit.com", + "port": 3333, + "proto": "tcp" + }, + "v000185": { + "hostname": "v000185.testing.com.customers.wprod.wit.com", "port": 3333, "proto": "tcp" } diff --git a/config.yml b/config.yml index e088c57..934eb27 100644 --- a/config.yml +++ b/config.yml @@ -8,6 +8,12 @@ cloud: v000185.testing.com.customers.wprod.wit.com: port: 3333 proto: tcp + jcarr: + port: 3333 + proto: tcp + foo.bar: + port: 3333 + proto: tcp map1: key1: diff --git a/gui.go b/gui.go index 9ded9a7..1e21e10 100644 --- a/gui.go +++ b/gui.go @@ -13,6 +13,8 @@ import _ "github.com/andlabs/ui/winmanifest" // import "github.com/davecgh/go-spew/spew" var mainwin *ui.Window +var maintab *ui.Tab +var tabcount int func hostnameButton(hostname string) ui.Control { tmpbox := ui.NewHorizontalBox() @@ -242,25 +244,38 @@ func setupUI() { return true }) - tab := ui.NewTab() - mainwin.SetChild(tab) + maintab = ui.NewTab() + mainwin.SetChild(maintab) mainwin.SetMargined(true) name := "v000185.testing.com.customers.wprod.wit.com" - tab.Append(name, makeDemotable(name)) - tab.SetMargined(0, true) + maintab.Append(name, makeDemotable(name)) + tabcount = 0 + maintab.SetMargined(tabcount, true) name = "jcarrTable" table, mh, model := makeJcarrtable(name) log.Println(table, mh, model) - tab.Append(name, table) - tab.SetMargined(1, true) + maintab.Append(name, table) + tabcount += 1 + maintab.SetMargined(tabcount, true) - tab.Append("List examples", makeNumbersPage()) - tab.SetMargined(2, true) + maintab.Append("List examples", makeNumbersPage()) + tabcount += 1 + maintab.SetMargined(tabcount, true) - tab.Append("Choosers examples", makeDataChoosersPage()) - tab.SetMargined(3, true) + maintab.Append("Choosers examples", makeDataChoosersPage()) + tabcount += 1 + maintab.SetMargined(tabcount, true) mainwin.Show() } + +func addTableTab(name string) { + table, mh, model := makeJcarrtable(name) + log.Println(table, mh, model) + + tabcount += 1 + maintab.Append(name, table) + maintab.SetMargined(tabcount, true) +} diff --git a/main.go b/main.go index a3aab89..b8bd66d 100644 --- a/main.go +++ b/main.go @@ -72,6 +72,22 @@ func main() { go doGUI() + log.Println("Sleep for 2 seconds, then try to add new tabs") + time.Sleep(2 * 1000 * 1000 * 1000) + + log.Println("Sleep for 2 seconds, then try to add new tabs") + time.Sleep(2 * 1000 * 1000 * 1000) + + log.Println("Sleep for 2 seconds, then try to add new tabs") + time.Sleep(2 * 1000 * 1000 * 1000) + + for account, _ := range config.StringMap("cloud") { + port := config.String("cloud." + account + ".port") + proto := config.String("cloud." + account + ".proto") + hostname := config.String("cloud." + account + ".hostname") + fmt.Println(hostname, port, proto) + addTableTab(account) + } for { log.Println("Sleep for 10 seconds, then try to establish connection to WIT")