error button disables
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
f10c3085c6
commit
6916a6428d
60
gui.go
60
gui.go
|
@ -12,7 +12,7 @@ import (
|
||||||
"go.wit.com/gui/cloudflare"
|
"go.wit.com/gui/cloudflare"
|
||||||
"go.wit.com/gui/debugger"
|
"go.wit.com/gui/debugger"
|
||||||
"go.wit.com/gui/gadgets/logsettings"
|
"go.wit.com/gui/gadgets/logsettings"
|
||||||
// "go.wit.com/control-panels/dns/linuxstatus"
|
"go.wit.com/control-panels/dns/smartwindow"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This setups up the dns control panel window
|
// This setups up the dns control panel window
|
||||||
|
@ -81,11 +81,14 @@ func mainWindow(title string) {
|
||||||
// me.hostname.Set(hostname)
|
// me.hostname.Set(hostname)
|
||||||
me.hostnameStatus.Set("WORKING")
|
me.hostnameStatus.Set("WORKING")
|
||||||
me.DnsStatus.Set("WORKING")
|
me.DnsStatus.Set("WORKING")
|
||||||
|
me.fixButton.SetText("No Errors!")
|
||||||
|
me.fixButton.Disable()
|
||||||
})
|
})
|
||||||
|
|
||||||
statusGrid(me.window.Box())
|
statusGrid(me.window.Box())
|
||||||
|
|
||||||
gr = me.window.Box().NewGroup("debugging")
|
gr = me.window.Box().NewGroup("debugging")
|
||||||
|
/*
|
||||||
me.statusDNSbutton = gr.NewButton("hostname status", func () {
|
me.statusDNSbutton = gr.NewButton("hostname status", func () {
|
||||||
if ! me.statusDNS.Ready() {return}
|
if ! me.statusDNS.Ready() {return}
|
||||||
me.statusDNS.window.Toggle()
|
me.statusDNS.window.Toggle()
|
||||||
|
@ -97,12 +100,7 @@ func mainWindow(title string) {
|
||||||
if ! me.digStatus.Ready() {return}
|
if ! me.digStatus.Ready() {return}
|
||||||
me.digStatus.window.Toggle()
|
me.digStatus.window.Toggle()
|
||||||
})
|
})
|
||||||
gr.NewButton("cloudflare wit.com", func () {
|
*/
|
||||||
if me.witcom != nil {
|
|
||||||
me.witcom.Toggle()
|
|
||||||
}
|
|
||||||
me.witcom = cloudflare.CreateRR(me.myGui, "wit.com", "3777302ac4a78cd7fa4f6d3f72086d06")
|
|
||||||
})
|
|
||||||
gr.NewButton("Debug", func () {
|
gr.NewButton("Debug", func () {
|
||||||
me.debug.Toggle()
|
me.debug.Toggle()
|
||||||
})
|
})
|
||||||
|
@ -116,30 +114,64 @@ func mainWindow(title string) {
|
||||||
}
|
}
|
||||||
myLS.Toggle()
|
myLS.Toggle()
|
||||||
})
|
})
|
||||||
|
gr.NewButton("Show Errors", func () {
|
||||||
|
if me.fixWindow == nil {
|
||||||
|
me.fixWindow = smartwindow.New()
|
||||||
|
me.fixWindow.SetParent(me.myGui)
|
||||||
|
me.fixWindow.Title("fix window")
|
||||||
|
me.fixWindow.SetDraw(drawFixWindow)
|
||||||
|
me.fixWindow.Vertical()
|
||||||
|
me.fixWindow.Make()
|
||||||
|
me.fixWindow.Draw()
|
||||||
|
me.fixWindow.Hide()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
me.fixWindow.Toggle()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func statusGrid(n *gui.Node) {
|
func statusGrid(n *gui.Node) {
|
||||||
problems := n.NewGroup("status")
|
problems := n.NewGroup("status")
|
||||||
|
|
||||||
gridP := problems.NewGrid("nuts", 2, 2)
|
gridP := problems.NewGrid("nuts", 3, 1)
|
||||||
|
|
||||||
gridP.NewLabel("hostname =")
|
gridP.NewLabel("hostname =")
|
||||||
me.hostnameStatus = gridP.NewLabel("invalid")
|
me.hostnameStatus = gridP.NewLabel("invalid")
|
||||||
|
gridP.NewButton("Linux Status", func () {
|
||||||
|
me.statusOS.Toggle()
|
||||||
|
})
|
||||||
|
|
||||||
gridP.NewLabel("DNS Status =")
|
gridP.NewLabel("DNS Status =")
|
||||||
me.DnsStatus = gridP.NewLabel("unknown")
|
me.DnsStatus = gridP.NewLabel("unknown")
|
||||||
|
me.statusDNSbutton = gridP.NewButton("hostname status", func () {
|
||||||
|
if ! me.statusDNS.Ready() {return}
|
||||||
|
me.statusDNS.window.Toggle()
|
||||||
|
})
|
||||||
|
|
||||||
me.statusIPv6 = gadgets.NewOneLiner(gridP, "IPv6 working")
|
me.statusIPv6 = gadgets.NewOneLiner(gridP, "IPv6 working")
|
||||||
me.statusIPv6.Set("known")
|
me.statusIPv6.Set("known")
|
||||||
|
gridP.NewButton("resolver status", func () {
|
||||||
gridP.NewLabel("dns resolution")
|
if ! me.digStatus.Ready() {return}
|
||||||
me.DnsSpeed = gridP.NewLabel("unknown")
|
me.digStatus.window.Toggle()
|
||||||
|
})
|
||||||
gridP.NewLabel("dns resolution speed")
|
|
||||||
me.DnsSpeedActual = gridP.NewLabel("unknown")
|
|
||||||
|
|
||||||
gridP.NewLabel("dns API provider =")
|
gridP.NewLabel("dns API provider =")
|
||||||
me.DnsAPI = gridP.NewLabel("unknown")
|
me.DnsAPI = gridP.NewLabel("unknown")
|
||||||
|
gridP.NewButton("cloudflare wit.com", func () {
|
||||||
|
if me.witcom != nil {
|
||||||
|
me.witcom.Toggle()
|
||||||
|
}
|
||||||
|
me.witcom = cloudflare.CreateRR(me.myGui, "wit.com", "3777302ac4a78cd7fa4f6d3f72086d06")
|
||||||
|
})
|
||||||
|
|
||||||
|
gridP.NewLabel("dns resolution")
|
||||||
|
me.DnsSpeed = gridP.NewLabel("unknown")
|
||||||
|
gridP.NewLabel("")
|
||||||
|
|
||||||
|
gridP.NewLabel("dns resolution speed")
|
||||||
|
me.DnsSpeedActual = gridP.NewLabel("unknown")
|
||||||
|
gridP.NewLabel("")
|
||||||
|
|
||||||
gridP.Margin()
|
gridP.Margin()
|
||||||
gridP.Pad()
|
gridP.Pad()
|
||||||
|
|
|
@ -33,7 +33,7 @@ func (ls *LinuxStatus) GetHostname() string {
|
||||||
|
|
||||||
func (ls *LinuxStatus) ValidHostname() bool {
|
func (ls *LinuxStatus) ValidHostname() bool {
|
||||||
if ! me.Ready() {return false}
|
if ! me.Ready() {return false}
|
||||||
if me.hostnameStatus.Get() == "VALID" {
|
if me.hostnameStatus.Get() == "WORKING" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -104,9 +104,9 @@ func lookupHostname() {
|
||||||
me.hostnameStatus.Set("BROKEN")
|
me.hostnameStatus.Set("BROKEN")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (me.hostnameStatus.Get() != "VALID") {
|
if (me.hostnameStatus.Get() != "WORKING") {
|
||||||
log.Log(CHANGE, "hostname", hostname, "is valid")
|
log.Log(CHANGE, "hostname", hostname, "is valid")
|
||||||
me.hostnameStatus.Set("VALID")
|
me.hostnameStatus.Set("WORKING")
|
||||||
me.changed = true
|
me.changed = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
main.go
4
main.go
|
@ -162,8 +162,8 @@ func linuxLoop() {
|
||||||
me.statusOS.Update()
|
me.statusOS.Update()
|
||||||
|
|
||||||
if me.statusOS.ValidHostname() {
|
if me.statusOS.ValidHostname() {
|
||||||
if me.hostnameStatus.GetText() != "VALID" {
|
if me.hostnameStatus.GetText() != "WORKING" {
|
||||||
me.hostnameStatus.Set("VALID")
|
me.hostnameStatus.Set("WORKING")
|
||||||
me.changed = true
|
me.changed = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue