From 41679c718b486fee5873d718a21cc09e9ac5a7e0 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 23 May 2019 13:27:05 -0700 Subject: [PATCH] v0.5 : skip the account screens when the user already has one Signed-off-by: Jeff Carr --- Makefile | 6 +++++ config.json | 61 ------------------------------------------- main.go | 21 +++++++++++---- resources/config.json | 14 ---------- resources/jcarr.json | 1 + 5 files changed, 23 insertions(+), 80 deletions(-) delete mode 100644 config.json create mode 100644 resources/jcarr.json diff --git a/Makefile b/Makefile index 91894f6..54e4594 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,12 @@ update: json-readable: cat /tmp/cloud-control-panel.json |jq -r --tab +json-restore: + cp resources/jcarr.json ~/.config/cloud-control-panel.json + +json-delete: + mv ~/.config/cloud-control-panel.json /tmp + diff: git diff diff --git a/config.json b/config.json deleted file mode 100644 index ce1df55..0000000 --- a/config.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "BUILDDEBUG": "", - "MAIL": "/var/mail/jcarr", - "USER": "jcarr", - "arr1": [ - "lo", - "wifi0", - "docker0" - ], - "baseKey": "value2", - "accounts": { - "jcarr": { - "hostname": "fire.lab.wit.com", - "domainname": "lab.wit.com", - "port": 3333, - "rows": 18, - "proto": "tcp" - }, - "jcarr2": { - "hostname": "fire.lab.wit.com", - "domainname": "lab.wit.com", - "port": 3333, - "rows": 18, - "proto": "tcp" - }, - "bmath": { - "hostname": "v000185.testing.com.customers.wprod.wit.com", - "domainname": "testing.com.customers.wprod.wit.com", - "port": 9000, - "proto": "tcp" - } - }, - "cloud": { - "jcarr": { - "hostname": "fire.lab.wit.com", - "port": 3333, - "rows": 18, - "proto": "tcp" - }, - "v000185": { - "hostname": "v000185.testing.com.customers.wprod.wit.com", - "port": 3333, - "rows": 567, - "proto": "tcp" - } - }, - "debug": false, - "envKey1": "${NotExist|defValue}", - "height": 600, - "width": 800, - "hostname": "localhost", - "map1": { - "key1": { - "jwc1": "jcarr1", - "jwc2": "jcarr2" - }, - "key2": "val20" - }, - "name": "app2", - "shell": "${SHELL}" -} diff --git a/main.go b/main.go index e33fa43..e740027 100644 --- a/main.go +++ b/main.go @@ -89,7 +89,7 @@ func main() { gui.Data.Width = config.Int("width") gui.Data.Height = config.Int("height") - gui.Data.Version = "v0.4" + gui.Data.Version = "v0.5" gui.Data.GitCommit = GITCOMMIT gui.Data.GoVersion = GOVERSION gui.Data.ButtonClickNew = buttonClickNew @@ -167,12 +167,15 @@ func buttonClickNew(b *gui.ButtonMap) { } func watchGUI() { - log.Println("Sleep(2000)") - time.Sleep(2000 * time.Millisecond) + count := 0 for { - log.Println("Sleep() in watchGUI() gui.Data.State =", gui.Data.State) - time.Sleep(2000 * time.Millisecond) + if (count > 10) { + log.Println("Sleep() in watchGUI() gui.Data.State =", gui.Data.State) + count = 0 + } + count += 1 + time.Sleep(200 * time.Millisecond) if (gui.Data.State == "bmath") { log.Println("\tTRIGGERING BMATH HERE") @@ -186,5 +189,13 @@ func watchGUI() { log.Println("gui.State = kill") os.Exit(0) } + if (gui.Data.State == "splash") { + for account, _ := range config.StringMap("accounts") { + log.Println("gui.State = splash BUT THERE IS AN ACCOUNT = ", account) + log.Println("gui.State = splash BUT THERE IS AN ACCOUNT = ", account) + log.Println("SETTING gui.State = main") + gui.Data.State = "main"; + } + } } } diff --git a/resources/config.json b/resources/config.json index 3d20046..73fb050 100644 --- a/resources/config.json +++ b/resources/config.json @@ -8,20 +8,6 @@ "docker0" ], "baseKey": "value2", - "accounts": { - "jcarr": { - "hostname": "fire.lab.wit.com", - "port": 3333, - "rows": 18, - "proto": "tcp" - }, - "bmath": { - "hostname": "v000185.testing.com.customers.wprod.wit.com", - "domainname": "testing.com.customers.wprod.wit.com", - "port": 9000, - "proto": "tcp" - } - }, "cloud": { "jcarr": { "hostname": "fire.lab.wit.com", diff --git a/resources/jcarr.json b/resources/jcarr.json new file mode 100644 index 0000000..46da3a4 --- /dev/null +++ b/resources/jcarr.json @@ -0,0 +1 @@ +{"BUILDDEBUG":"","MAIL":"/var/mail/jcarr","USER":"jcarr","accounts":{"bmath":{"domainname":"testing.com.customers.wprod.wit.com","hostname":"v000185.testing.com.customers.wprod.wit.com","port":9000,"proto":"tcp"},"jcarr":{"domainname":"lab.wit.com","hostname":"fire.lab.wit.com","port":3333,"proto":"tcp","rows":18},"jcarr2":{"domainname":"lab.wit.com","hostname":"fire.lab.wit.com","port":3333,"proto":"tcp","rows":18},"jcarr4":{"hostname":"v000185.testing.com.customers.wprod.wit.com","password":"test","username":"jcarr@wit.com"},"jcarr6":{"hostname":"v000185.testing.com.customers.wprod.wit.com","password":"testsinasfd","username":"jcarr@wit.com"}},"arr1":["lo","wifi0","docker0"],"baseKey":"value2","cloud":{"jcarr":{"hostname":"fire.lab.wit.com","port":3333,"proto":"tcp","rows":18},"v000185":{"hostname":"v000185.testing.com.customers.wprod.wit.com","port":3333,"proto":"tcp","rows":567}},"configfile":"/home/jcarr/.config/cloud-control-panel.json","debug":true,"debugging":true,"envKey1":"${NotExist|defValue}","height":600,"hostname":"localhost","map1":{"key1":{"jwc1":"jcarr1","jwc2":"jcarr2"},"key2":"val20"},"name":"app2","nogui":false,"shell":"${SHELL}","width":800}