pass the mouse click to the area

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-01 22:24:26 -07:00
parent 7e5e36dd13
commit 9a2b03fc96
6 changed files with 49 additions and 12 deletions

View File

@ -1,18 +1,19 @@
GITCOMMIT = $(shell git rev-list -1 HEAD)
GOVERSION = $(shell go version | cut -d' ' -f 3)
BUILDTIME = $(shell date -u --iso-8601=seconds)
VERSION = $(shell cat VERSION)
# try go get github.com/ahmetb/govvv
# this will add branch info & build RFC3339 date also
run:
@echo your version of go must be greater than 2.10. Your version is ${GOVERSION}
go build -ldflags "-X main.GITCOMMIT=${GITCOMMIT} -X main.GOVERSION='${GOVERSION}' -X main.BUILDTIME='${BUILDTIME}'"
go build -ldflags "-X main.GITCOMMIT=${GITCOMMIT} -X main.GOVERSION='${GOVERSION}' -X main.BUILDTIME='${BUILDTIME}' -X main.VERSION=${VERSION}"
./cloud-control-panel
debug:
@echo your version of go must be greater than 2.10. Your version is ${GOVERSION}
go build -ldflags "-X main.GITCOMMIT=${GITCOMMIT} -X main.GOVERSION='${GOVERSION}' -X main.BUILDTIME='${BUILDTIME}'"
go build -ldflags "-X main.GITCOMMIT=${GITCOMMIT} -X main.GOVERSION='${GOVERSION}' -X main.BUILDTIME='${BUILDTIME}' -X main.VERSION=${VERSION}"
./cloud-control-panel --debug
nogui:

View File

@ -1 +1 @@
v0.4
v0.6

5
crash1-fqdn Normal file
View File

@ -0,0 +1,5 @@
2019/06/01 21:11:47 connecting to ws://v000185.testing.com.customers.wprod.wit.com:9000/event
2019/06/01 21:11:47 fqdn.Get() = librem15.lab.wit.com
INFO[0000] *** error: read udp [2604:bbc0:1:22::f5d3:7f44]:50435->[2001:500:12::d0d]:53: i/o timeout
make: *** [Makefile:52: config-default-config] Error 1

37
fqdn.go Normal file
View File

@ -0,0 +1,37 @@
package main
import (
"net"
"os"
"strings"
)
// Get Fully Qualified Domain Name
// returns "unknown" or hostanme in case of error
func FqdnGet() string {
hostname, err := os.Hostname()
if err != nil {
return "unknown"
}
addrs, err := net.LookupIP(hostname)
if err != nil {
return hostname
}
for _, addr := range addrs {
if ipv4 := addr.To4(); ipv4 != nil {
ip, err := ipv4.MarshalText()
if err != nil {
return hostname
}
hosts, err := net.LookupAddr(string(ip))
if err != nil || len(hosts) == 0 {
return hostname
}
fqdn := hosts[0]
return strings.TrimSuffix(fqdn, ".") // return fqdn without trailing dot
}
}
return hostname
}

10
main.go
View File

@ -16,13 +16,10 @@ import "git.wit.com/jcarr/dnssecsocket"
import "github.com/gobuffalo/packr"
import "github.com/davecgh/go-spew/spew"
// will try to get this hosts FQDN
import "github.com/Showmax/go-fqdn"
var GITCOMMIT string // this is passed in as an ldflag
var GOVERSION string // this is passed in as an ldflag
var BUILDTIME string // this is passed in as an ldflag
const VERSION = "0.2"
var VERSION string // this is passed in as an ldflag
// use mergo to merge structs
// import "github.com/imdario/mergo"
@ -104,13 +101,10 @@ func main() {
onExit(err)
}
// gui.Data.Width = int(config.Width)
// gui.Data.Height = int(config.Height)
// use this to discover what the OS thinks it's hostname is
// seems to be cross platform (?)
// Windows: WMIC computersystem where caption='current_pc_name' rename new_pc_name
hostname := fqdn.Get()
hostname := FqdnGet()
log.Println("fqdn.Get() = ", hostname)
gui.Data.Hostname = hostname

View File

@ -13,7 +13,7 @@ import pb "git.wit.com/wit/witProtobuf"
func showSplashBox(gw *gui.GuiWindow) *gui.GuiBox {
log.Println("ShowSplashBox() START")
text := getNEWTEXT()
box := gui.ShowTextBox(gw, text)
box := gui.ShowTextBox(gw, text, splashClick)
if runtime.GOOS == "linux" {
gui.NewLabel(box,"OS: Linux")