use SetText() not SetValue()
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
513c38922b
commit
1a9b13dda5
|
@ -1,7 +1,10 @@
|
|||
*.swp
|
||||
go.sum
|
||||
go.mod
|
||||
|
||||
control-panel-dns
|
||||
/files/*
|
||||
/*.deb
|
||||
*.swp
|
||||
/plugins/*
|
||||
|
||||
control-panel-dns
|
||||
|
|
2
draw.go
2
draw.go
|
@ -20,7 +20,7 @@ func draw(ls *LinuxStatus) {
|
|||
ls.hostshort = gadgets.NewOneLiner(ls.grid, "hostname -s")
|
||||
ls.domainname = gadgets.NewOneLiner(ls.grid, "domain name")
|
||||
ls.resolver = gadgets.NewOneLiner(ls.grid, "nameservers =")
|
||||
ls.resolver.SetValue("TODO")
|
||||
ls.resolver.SetText("TODO")
|
||||
ls.uid = gadgets.NewOneLiner(ls.grid, "UID =")
|
||||
ls.IPv4 = gadgets.NewOneLiner(ls.grid, "Current IPv4 =")
|
||||
ls.IPv6 = gadgets.NewOneLiner(ls.grid, "Current IPv6 =")
|
||||
|
|
17
go.mod
17
go.mod
|
@ -1,17 +0,0 @@
|
|||
module go.wit.com/lib/gui/linuxstatus
|
||||
|
||||
go 1.21.4
|
||||
|
||||
require (
|
||||
github.com/Showmax/go-fqdn v1.0.0
|
||||
go.wit.com/gui v0.14.0
|
||||
go.wit.com/lib/gadgets v0.14.0
|
||||
go.wit.com/log v0.13.18
|
||||
)
|
||||
|
||||
require (
|
||||
go.wit.com/dev/alexflint/arg v1.4.5 // indirect
|
||||
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
|
||||
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
|
||||
go.wit.com/widget v1.1.10 // indirect
|
||||
)
|
16
go.sum
16
go.sum
|
@ -1,16 +0,0 @@
|
|||
github.com/Showmax/go-fqdn v1.0.0 h1:0rG5IbmVliNT5O19Mfuvna9LL7zlHyRfsSvBPZmF9tM=
|
||||
github.com/Showmax/go-fqdn v1.0.0/go.mod h1:SfrFBzmDCtCGrnHhoDjuvFnKsWjEQX/Q9ARZvOrJAko=
|
||||
go.wit.com/dev/alexflint/arg v1.4.5 h1:asDx5f9IlfpknKjPBqqb2qndE91Pbo7ZDkWUgddfMhY=
|
||||
go.wit.com/dev/alexflint/arg v1.4.5/go.mod h1:wnWc+c6z8kSdDKYriMf6RpM+FiXmo5RYp/t4FNi0MU0=
|
||||
go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26TvKNs=
|
||||
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
|
||||
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
|
||||
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
|
||||
go.wit.com/gui v0.14.0 h1:MNxWgCdLXbAf4+r0/UtItL9WE6uoAtceEX2TqCXqTzg=
|
||||
go.wit.com/gui v0.14.0/go.mod h1:v4tLhOESMrt9s2kjNb0QEYz29odpIusMITmVzPJme+E=
|
||||
go.wit.com/lib/gadgets v0.14.0 h1:h/8VIcJ4882Oa169uTtIsvLGnxH8UQsWbw/mE88vRjM=
|
||||
go.wit.com/lib/gadgets v0.14.0/go.mod h1:lFxjMHjvOTC46Q7if1d11lhXIuFML4/xlqJUl+ehzbQ=
|
||||
go.wit.com/log v0.13.18 h1:XJNaQWX+8m12p3mH+kYih3zNjb0kScZDFpJa4c2TvKE=
|
||||
go.wit.com/log v0.13.18/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
|
||||
go.wit.com/widget v1.1.10 h1:bdEqqNZMlLc+T4dHKlkQG1c1N5I+x2RUewOlrn2GWng=
|
||||
go.wit.com/widget v1.1.10/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=
|
11
hostname.go
11
hostname.go
|
@ -26,7 +26,7 @@ func (ls *LinuxStatus) setDomainName() {
|
|||
dn := run("domainname")
|
||||
if me.domainname.String() != dn {
|
||||
log.Log(CHANGE, "domainname has changed from", me.GetDomainName(), "to", dn)
|
||||
me.domainname.SetValue(dn)
|
||||
me.domainname.SetText(dn)
|
||||
me.changed = true
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ func (ls *LinuxStatus) GetHostname() string {
|
|||
|
||||
func (ls *LinuxStatus) ValidHostname() bool {
|
||||
if !me.Ready() {
|
||||
log.Info("ValidHostname() not ready")
|
||||
return false
|
||||
}
|
||||
if me.hostnameStatus.String() == "WORKING" {
|
||||
|
@ -56,7 +57,7 @@ func (ls *LinuxStatus) setHostname(newname string) {
|
|||
return
|
||||
}
|
||||
log.Log(CHANGE, "hostname has changed from", me.GetHostname(), "to", newname)
|
||||
me.hostname.SetValue(newname)
|
||||
me.hostname.SetText(newname)
|
||||
me.changed = true
|
||||
}
|
||||
|
||||
|
@ -74,7 +75,7 @@ func (ls *LinuxStatus) setHostShort() {
|
|||
hshort := run("hostname -s")
|
||||
if me.hostshort.String() != hshort {
|
||||
log.Log(CHANGE, "hostname -s has changed from", me.hostshort.String(), "to", hshort)
|
||||
me.hostshort.SetValue(hshort)
|
||||
me.hostshort.SetText(hshort)
|
||||
me.changed = true
|
||||
}
|
||||
}
|
||||
|
@ -118,12 +119,12 @@ func lookupHostname() {
|
|||
if me.hostnameStatus.String() != "BROKEN" {
|
||||
log.Log(CHANGE, "hostname", hostname, "does not equal", test)
|
||||
me.changed = true
|
||||
me.hostnameStatus.SetValue("BROKEN")
|
||||
me.hostnameStatus.SetText("BROKEN")
|
||||
}
|
||||
} else {
|
||||
if me.hostnameStatus.String() != "WORKING" {
|
||||
log.Log(CHANGE, "hostname", hostname, "is valid")
|
||||
me.hostnameStatus.SetValue("WORKING")
|
||||
me.hostnameStatus.SetText("WORKING")
|
||||
me.changed = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ func linuxLoop() {
|
|||
if tmp != me.workingIPv4.String() {
|
||||
log.Log(CHANGE, "realAAAA() your real IPv6 addresses changed")
|
||||
me.changed = true
|
||||
me.workingIPv4.SetValue(tmp)
|
||||
me.workingIPv4.SetText(tmp)
|
||||
}
|
||||
|
||||
// get all the real AAAA records from all the network interfaces linux can see
|
||||
|
@ -56,7 +56,7 @@ func linuxLoop() {
|
|||
if tmp != me.workingIPv6.String() {
|
||||
log.Log(CHANGE, "realAAAA() your real IPv6 addresses changed")
|
||||
me.changed = true
|
||||
me.workingIPv6.SetValue(tmp)
|
||||
me.workingIPv6.SetText(tmp)
|
||||
}
|
||||
|
||||
user, _ := user.Current()
|
||||
|
@ -64,7 +64,7 @@ func linuxLoop() {
|
|||
if tmp != me.uid.String() {
|
||||
log.Log(CHANGE, "os.Getuid =", user.Username, os.Getuid())
|
||||
me.changed = true
|
||||
me.uid.SetValue(tmp)
|
||||
me.uid.SetText(tmp)
|
||||
}
|
||||
|
||||
content, _ := ioutil.ReadFile("/etc/resolv.conf")
|
||||
|
@ -82,7 +82,7 @@ func linuxLoop() {
|
|||
if newNS != me.resolver.String() {
|
||||
log.Log(CHANGE, "resolver changed in /etc/resolv.conf to", ns)
|
||||
me.changed = true
|
||||
me.resolver.SetValue(newNS)
|
||||
me.resolver.SetText(newNS)
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
8
net.go
8
net.go
|
@ -154,13 +154,13 @@ func checkIP(ip *net.IPNet, i net.Interface) bool {
|
|||
me.ipmap[realip].ipv4 = false
|
||||
t = "IPv6"
|
||||
if me.IPv6 != nil {
|
||||
me.IPv6.SetValue(realip)
|
||||
me.IPv6.SetText(realip)
|
||||
}
|
||||
} else {
|
||||
me.ipmap[realip].ipv6 = false
|
||||
me.ipmap[realip].ipv4 = true
|
||||
if me.IPv4 != nil {
|
||||
me.IPv4.SetValue(realip)
|
||||
me.IPv4.SetText(realip)
|
||||
}
|
||||
}
|
||||
if IsReal(&ip.IP) {
|
||||
|
@ -234,12 +234,12 @@ func updateRealAAAA() {
|
|||
|
||||
if me.IPv4.String() != s4 {
|
||||
log.Log(CHANGE, "IPv4 addresses have changed", s4)
|
||||
me.IPv4.SetValue(s4)
|
||||
me.IPv4.SetText(s4)
|
||||
me.changed = true
|
||||
}
|
||||
if me.IPv6.String() != s6 {
|
||||
log.Log(CHANGE, "IPv6 addresses have changed", s6)
|
||||
me.IPv6.SetValue(s6)
|
||||
me.IPv6.SetText(s6)
|
||||
me.changed = true
|
||||
}
|
||||
}
|
||||
|
|
2
timer.go
2
timer.go
|
@ -34,5 +34,5 @@ func (ls *LinuxStatus) SetSpeedActual(s string) {
|
|||
if !ls.Ready() {
|
||||
return
|
||||
}
|
||||
ls.speedActual.SetValue(s)
|
||||
ls.speedActual.SetText(s)
|
||||
}
|
||||
|
|
2
unix.go
2
unix.go
|
@ -91,7 +91,7 @@ func run(s string) string {
|
|||
// Trim leading and trailing whitespace from each line
|
||||
tmp := strings.TrimSpace(out.String())
|
||||
// Output the results
|
||||
log.Info("Command Output:", tmp)
|
||||
log.Verbose("Command Output:", tmp)
|
||||
|
||||
return tmp
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ func (ls *LinuxStatus) setSpeed(duration time.Duration) {
|
|||
log.Log(WARN, "can't actually warn")
|
||||
return
|
||||
}
|
||||
ls.speedActual.SetValue(s)
|
||||
ls.speedActual.SetText(s)
|
||||
|
||||
if duration > 500*time.Millisecond {
|
||||
ls.speed.SetValue("SLOW")
|
||||
ls.speed.SetText("SLOW")
|
||||
} else if duration > 100*time.Millisecond {
|
||||
ls.speed.SetValue("OK")
|
||||
ls.speed.SetText("OK")
|
||||
} else {
|
||||
ls.speed.SetValue("FAST")
|
||||
ls.speed.SetText("FAST")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue