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:
|
||||
echo deleting your current config
|
||||
mv ~/.config/cloud-control-panel.json /tmp
|
||||
-mv ~/.config/cloud-control-panel.json /tmp
|
||||
|
||||
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"))
|
||||
}
|
||||
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)
|
||||
|
||||
var wm *gui.GuiWindow
|
||||
|
||||
wm = b.WM
|
||||
var gw *gui.GuiWindow
|
||||
gw = b.GW
|
||||
|
||||
// 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) {
|
||||
log.Println("\tmainMouseClick() setting current account = ", b.Account.Nick)
|
||||
}
|
||||
if (b.Action == "NEWTEXT") {
|
||||
wm.Area.UiAttrstr = getNEWTEXT()
|
||||
log.Println("Area.UiAttrstr = ", wm.Area.UiAttrstr)
|
||||
wm.Area.UiArea.QueueRedrawAll()
|
||||
if (b.Box == nil) {
|
||||
log.Println("\tmainMouseClick() b.Box = nil")
|
||||
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") {
|
||||
if (config == nil) {
|
||||
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") {
|
||||
gui.ShowAccountQuestionTab(wm)
|
||||
gui.ShowAccountQuestionTab(gw)
|
||||
gui.Data.State = "account1"
|
||||
return
|
||||
}
|
||||
if (gui.Data.State == "main") {
|
||||
log.Println("gui.Data.State == main b =", b)
|
||||
log.Println("gui.Data.State == main wm =", wm)
|
||||
gui.ShowMainTab(wm)
|
||||
log.Println("gui.Data.State == main gw =", gw)
|
||||
gui.ShowMainTab(gw)
|
||||
gui.Data.State = "done"
|
||||
return
|
||||
} else if (gui.Data.State == "account1") {
|
||||
gui.ShowAccountTab(wm, 0)
|
||||
gui.ShowAccountTab(gw, 0)
|
||||
gui.Data.State = "main"
|
||||
return
|
||||
}
|
||||
} else if (b.Action == "ADD TAB") {
|
||||
log.Println("\tADD TAB TRY b.Action = ", b.Action)
|
||||
log.Println("\tADD TAB TRY gui.ShowAccountTab(-1)")
|
||||
gui.ShowAccountTab(wm, -1)
|
||||
gui.ShowAccountTab(gw, -1)
|
||||
gui.Data.State = "done"
|
||||
return
|
||||
} else if (b.Action == "QUIT") {
|
||||
|
@ -261,7 +268,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
|||
log.Println("\tSHOULD ADD ACCOUNT HERE")
|
||||
subdomain := gui.GetText(b.Box, "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
|
||||
}
|
||||
log.Println("\tsubdomain =", subdomain)
|
||||
|
@ -275,7 +282,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
|||
acc.URL = "http://stackapi-api1.stackapi.customers.dev.wit.com:4000/"
|
||||
config.Accounts = append(config.Accounts, acc)
|
||||
|
||||
gui.ShowMainTab(wm)
|
||||
gui.ShowMainTab(gw)
|
||||
gui.Data.State = "done"
|
||||
} else if (b.Action == "LOGIN") {
|
||||
log.Println("\tTRIGGER LOGIN ACCOUNT")
|
||||
|
@ -292,7 +299,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
|||
time.Sleep(200 * time.Millisecond)
|
||||
if (gui.Data.State == "NEW PROTOBUF") {
|
||||
if (currentMessage == nil) {
|
||||
gui.SocketError(wm)
|
||||
gui.SocketError(gw)
|
||||
gui.Data.State = "done"
|
||||
} else {
|
||||
log.Println("LOGIN currentMessage =", currentMessage)
|
||||
|
@ -309,7 +316,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
|||
}
|
||||
}
|
||||
log.Println("\tLOGIN WAS OK!")
|
||||
gui.MessageWindow(wm, "Login OK", msg)
|
||||
gui.MessageWindow(gw, "Login OK", msg)
|
||||
} else if (currentMessage.Type == pb.Event_FAIL) {
|
||||
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.Email = " + b.Account.Email + "\n"
|
||||
msg += "pb.Username = " + b.Account.Username + "\n"
|
||||
gui.ErrorWindow(wm, "Login Failed", msg)
|
||||
gui.ErrorWindow(gw, "Login Failed", msg)
|
||||
}
|
||||
currentMessage = nil
|
||||
gui.Data.State = "done"
|
||||
|
@ -342,7 +349,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
|||
// go gui.GoShowVM()
|
||||
} else {
|
||||
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") {
|
||||
log.Println("\tTRIGGER DISPLAY ACCOUNT")
|
||||
|
@ -358,7 +365,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
|||
time.Sleep(200 * time.Millisecond)
|
||||
if (gui.Data.State == "NEW PROTOBUF") {
|
||||
if (currentMessage == nil) {
|
||||
gui.SocketError(wm)
|
||||
gui.SocketError(gw)
|
||||
gui.Data.State = "done"
|
||||
} else {
|
||||
count := countVMS(currentMessage)
|
||||
|
@ -367,7 +374,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
|||
// TODO: make sure login worked & the account really has zero VMs
|
||||
// if (count != 0) {
|
||||
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)
|
||||
// }
|
||||
currentMessage = nil
|
||||
|
|
Loading…
Reference in New Issue