lots of changes to update window & tab mapping
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
e3feda9437
commit
5caf303828
2
Makefile
2
Makefile
|
@ -53,7 +53,7 @@ config-default-config: config-delete
|
||||||
|
|
||||||
config-delete:
|
config-delete:
|
||||||
echo deleting your current config
|
echo deleting your current config
|
||||||
mv ~/.config/cloud-control-panel.json /tmp
|
-mv ~/.config/cloud-control-panel.json /tmp
|
||||||
|
|
||||||
diff:
|
diff:
|
||||||
git diff
|
git diff
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "log"
|
||||||
|
import "github.com/miekg/dns"
|
||||||
|
|
||||||
|
import "git.wit.com/jcarr/dnssecsocket"
|
||||||
|
|
||||||
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
// import "github.com/Showmax/go-fqdn"
|
||||||
|
|
||||||
|
func lookupAAAA(hostname string) string {
|
||||||
|
// lookup the IP address from DNS
|
||||||
|
dnsRR := dnssecsocket.Dnstrace(hostname, "AAAA")
|
||||||
|
spew.Dump(dnsRR)
|
||||||
|
if (dnsRR == nil) {
|
||||||
|
return "BROKEN"
|
||||||
|
}
|
||||||
|
ipaddr := dns.Field(dnsRR, 1)
|
||||||
|
log.Println("ipaddr", ipaddr)
|
||||||
|
return ipaddr
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
hostname := "v000185.testing.com.customers.wprod.wit.com"
|
||||||
|
|
||||||
|
lookupAAAA(hostname)
|
||||||
|
}
|
49
main.go
49
main.go
|
@ -164,22 +164,29 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
onExit(fmt.Errorf("mainMouseClick() got b = nil"))
|
onExit(fmt.Errorf("mainMouseClick() got b = nil"))
|
||||||
}
|
}
|
||||||
log.Println("mainMouseClick() b.Action =", b.Action)
|
log.Println("mainMouseClick() b.Action =", b.Action)
|
||||||
log.Println("mainMouseClick() b.Action =", b.Account)
|
log.Println("mainMouseClick() b.Account =", b.Account)
|
||||||
spew.Dump(b.Account)
|
spew.Dump(b.Account)
|
||||||
|
|
||||||
var wm *gui.GuiWindow
|
var gw *gui.GuiWindow
|
||||||
|
gw = b.GW
|
||||||
wm = b.WM
|
|
||||||
|
|
||||||
// gui.Data.Current = b.Account
|
// gui.Data.Current = b.Account
|
||||||
log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE")
|
log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE b =", b)
|
||||||
if (b.Account != nil) {
|
if (b.Account != nil) {
|
||||||
log.Println("\tmainMouseClick() setting current account = ", b.Account.Nick)
|
log.Println("\tmainMouseClick() setting current account = ", b.Account.Nick)
|
||||||
}
|
}
|
||||||
if (b.Action == "NEWTEXT") {
|
if (b.Action == "NEWTEXT") {
|
||||||
wm.Area.UiAttrstr = getNEWTEXT()
|
if (b.Box == nil) {
|
||||||
log.Println("Area.UiAttrstr = ", wm.Area.UiAttrstr)
|
log.Println("\tmainMouseClick() b.Box = nil")
|
||||||
wm.Area.UiArea.QueueRedrawAll()
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
if (b.Box.Area == nil) {
|
||||||
|
log.Println("\tmainMouseClick() b.Box.Area = nil")
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
b.Box.Area.UiAttrstr = getNEWTEXT()
|
||||||
|
log.Println("Area.UiAttrstr = ", b.Box.Area.UiAttrstr)
|
||||||
|
b.Box.Area.UiArea.QueueRedrawAll()
|
||||||
} else if (b.Action == "AREA") {
|
} else if (b.Action == "AREA") {
|
||||||
if (config == nil) {
|
if (config == nil) {
|
||||||
log.Println("gui.State = splash BUT SOMETHING HAS GONE VERY WRONG")
|
log.Println("gui.State = splash BUT SOMETHING HAS GONE VERY WRONG")
|
||||||
|
@ -197,25 +204,25 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gui.Data.State == "splash") {
|
if (gui.Data.State == "splash") {
|
||||||
gui.ShowAccountQuestionTab(wm)
|
gui.ShowAccountQuestionTab(gw)
|
||||||
gui.Data.State = "account1"
|
gui.Data.State = "account1"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (gui.Data.State == "main") {
|
if (gui.Data.State == "main") {
|
||||||
log.Println("gui.Data.State == main b =", b)
|
log.Println("gui.Data.State == main b =", b)
|
||||||
log.Println("gui.Data.State == main wm =", wm)
|
log.Println("gui.Data.State == main gw =", gw)
|
||||||
gui.ShowMainTab(wm)
|
gui.ShowMainTab(gw)
|
||||||
gui.Data.State = "done"
|
gui.Data.State = "done"
|
||||||
return
|
return
|
||||||
} else if (gui.Data.State == "account1") {
|
} else if (gui.Data.State == "account1") {
|
||||||
gui.ShowAccountTab(wm, 0)
|
gui.ShowAccountTab(gw, 0)
|
||||||
gui.Data.State = "main"
|
gui.Data.State = "main"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else if (b.Action == "ADD TAB") {
|
} else if (b.Action == "ADD TAB") {
|
||||||
log.Println("\tADD TAB TRY b.Action = ", b.Action)
|
log.Println("\tADD TAB TRY b.Action = ", b.Action)
|
||||||
log.Println("\tADD TAB TRY gui.ShowAccountTab(-1)")
|
log.Println("\tADD TAB TRY gui.ShowAccountTab(-1)")
|
||||||
gui.ShowAccountTab(wm, -1)
|
gui.ShowAccountTab(gw, -1)
|
||||||
gui.Data.State = "done"
|
gui.Data.State = "done"
|
||||||
return
|
return
|
||||||
} else if (b.Action == "QUIT") {
|
} else if (b.Action == "QUIT") {
|
||||||
|
@ -261,7 +268,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
log.Println("\tSHOULD ADD ACCOUNT HERE")
|
log.Println("\tSHOULD ADD ACCOUNT HERE")
|
||||||
subdomain := gui.GetText(b.Box, "SUBDOMAIN")
|
subdomain := gui.GetText(b.Box, "SUBDOMAIN")
|
||||||
if (subdomain == "") {
|
if (subdomain == "") {
|
||||||
gui.ErrorWindow(wm, "Blank Name", "You must have a valid subdomain")
|
gui.ErrorWindow(gw, "Blank Name", "You must have a valid subdomain")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Println("\tsubdomain =", subdomain)
|
log.Println("\tsubdomain =", subdomain)
|
||||||
|
@ -275,7 +282,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
acc.URL = "http://stackapi-api1.stackapi.customers.dev.wit.com:4000/"
|
acc.URL = "http://stackapi-api1.stackapi.customers.dev.wit.com:4000/"
|
||||||
config.Accounts = append(config.Accounts, acc)
|
config.Accounts = append(config.Accounts, acc)
|
||||||
|
|
||||||
gui.ShowMainTab(wm)
|
gui.ShowMainTab(gw)
|
||||||
gui.Data.State = "done"
|
gui.Data.State = "done"
|
||||||
} else if (b.Action == "LOGIN") {
|
} else if (b.Action == "LOGIN") {
|
||||||
log.Println("\tTRIGGER LOGIN ACCOUNT")
|
log.Println("\tTRIGGER LOGIN ACCOUNT")
|
||||||
|
@ -292,7 +299,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
if (gui.Data.State == "NEW PROTOBUF") {
|
if (gui.Data.State == "NEW PROTOBUF") {
|
||||||
if (currentMessage == nil) {
|
if (currentMessage == nil) {
|
||||||
gui.SocketError(wm)
|
gui.SocketError(gw)
|
||||||
gui.Data.State = "done"
|
gui.Data.State = "done"
|
||||||
} else {
|
} else {
|
||||||
log.Println("LOGIN currentMessage =", currentMessage)
|
log.Println("LOGIN currentMessage =", currentMessage)
|
||||||
|
@ -309,7 +316,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Println("\tLOGIN WAS OK!")
|
log.Println("\tLOGIN WAS OK!")
|
||||||
gui.MessageWindow(wm, "Login OK", msg)
|
gui.MessageWindow(gw, "Login OK", msg)
|
||||||
} else if (currentMessage.Type == pb.Event_FAIL) {
|
} else if (currentMessage.Type == pb.Event_FAIL) {
|
||||||
log.Println("\tLOGIN FAILED")
|
log.Println("\tLOGIN FAILED")
|
||||||
log.Println("\tLOGIN FAILED")
|
log.Println("\tLOGIN FAILED")
|
||||||
|
@ -319,7 +326,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
msg += "pb.Id = " + fmt.Sprintf("%d", currentMessage.Id) + "\n"
|
msg += "pb.Id = " + fmt.Sprintf("%d", currentMessage.Id) + "\n"
|
||||||
msg += "pb.Email = " + b.Account.Email + "\n"
|
msg += "pb.Email = " + b.Account.Email + "\n"
|
||||||
msg += "pb.Username = " + b.Account.Username + "\n"
|
msg += "pb.Username = " + b.Account.Username + "\n"
|
||||||
gui.ErrorWindow(wm, "Login Failed", msg)
|
gui.ErrorWindow(gw, "Login Failed", msg)
|
||||||
}
|
}
|
||||||
currentMessage = nil
|
currentMessage = nil
|
||||||
gui.Data.State = "done"
|
gui.Data.State = "done"
|
||||||
|
@ -342,7 +349,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
// go gui.GoShowVM()
|
// go gui.GoShowVM()
|
||||||
} else {
|
} else {
|
||||||
log.Println("\tATTEMPTING TO SHOW VM TAB", b.T)
|
log.Println("\tATTEMPTING TO SHOW VM TAB", b.T)
|
||||||
gui.CreateVmBox(wm, b.T, b.VM)
|
gui.CreateVmBox(gw, b.T, b.VM)
|
||||||
}
|
}
|
||||||
} else if (b.Action == "SHOW") {
|
} else if (b.Action == "SHOW") {
|
||||||
log.Println("\tTRIGGER DISPLAY ACCOUNT")
|
log.Println("\tTRIGGER DISPLAY ACCOUNT")
|
||||||
|
@ -358,7 +365,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
if (gui.Data.State == "NEW PROTOBUF") {
|
if (gui.Data.State == "NEW PROTOBUF") {
|
||||||
if (currentMessage == nil) {
|
if (currentMessage == nil) {
|
||||||
gui.SocketError(wm)
|
gui.SocketError(gw)
|
||||||
gui.Data.State = "done"
|
gui.Data.State = "done"
|
||||||
} else {
|
} else {
|
||||||
count := countVMS(currentMessage)
|
count := countVMS(currentMessage)
|
||||||
|
@ -367,7 +374,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
// 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) {
|
||||||
name := "Virtual Machines (" + b.Account.Nick + ")"
|
name := "Virtual Machines (" + b.Account.Nick + ")"
|
||||||
mh := gui.AddVmsTab(wm, name, count, b.Account)
|
mh := gui.AddVmsTab(gw, name, count, b.Account)
|
||||||
ReadReceivedData(currentMessage, mh, b.W, b.T)
|
ReadReceivedData(currentMessage, mh, b.W, b.T)
|
||||||
// }
|
// }
|
||||||
currentMessage = nil
|
currentMessage = nil
|
||||||
|
|
Loading…
Reference in New Issue