summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--doGui.go62
-rw-r--r--machine.go4
-rw-r--r--main.go6
-rw-r--r--structs.go2
5 files changed, 72 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 73e37e0..785389c 100644
--- a/Makefile
+++ b/Makefile
@@ -7,12 +7,12 @@ BUILDTIME = $(shell date +%Y.%m.%d_%H%M)
# REDOMOD = $(shell if [ -e go.mod ]; then echo go.mod; else echo no go mod; fi)
REDOMOD = $(shell if [ -e go.sum ]; then echo go.sum exists; else GO111MODULE= go mod init; GO111MODULE= go mod tidy; fi)
-all: build
+all: goimports build
./zookeeper --version
./zookeeper
build:
- GO111MODULE=off go build \
+ GO111MODULE=off go build -v -x \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
install:
diff --git a/doGui.go b/doGui.go
new file mode 100644
index 0000000..6719661
--- /dev/null
+++ b/doGui.go
@@ -0,0 +1,62 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+// An app to submit patches for the 30 GO GUI repos
+
+import (
+ "os"
+ "time"
+
+ "go.wit.com/gui"
+ "go.wit.com/lib/gadgets"
+ "go.wit.com/log"
+)
+
+func debug() {
+ for {
+ time.Sleep(90 * time.Second)
+ log.Info("TODO: zookeeper scan here. repo count =")
+ }
+}
+
+func doGui() {
+ me.myGui = gui.New()
+ me.myGui.InitEmbed(resources)
+ me.myGui.Default()
+
+ mainWindow := gadgets.RawBasicWindow("Zookeeper: (inventory your cluster)")
+ mainWindow.Make()
+ mainWindow.Show()
+ mainWindow.Custom = func() {
+ log.Warn("Main window close")
+ os.Exit(0)
+ }
+
+ drawWindow(mainWindow)
+
+ // sits here forever
+ debug()
+
+}
+
+func drawWindow(win *gadgets.BasicWindow) {
+ box := win.Box()
+
+ vbox := box.NewVerticalBox("BOX2")
+
+ group1 := vbox.NewGroup("Zookeeper Settings")
+ grid := group1.NewGrid("buildOptions", 0, 0)
+
+ // select the branch you want to test, build and develop against
+ // this lets you select your user branch, but, when you are happy
+ // you can merge everything into the devel branch and make sure it actually
+ // works. Then, when that is good, merge and version everything in master
+ grid.NewButton("show zoo", func() {
+ win.Disable()
+ defer win.Enable()
+
+ log.Info("show zoo here")
+ })
+}
diff --git a/machine.go b/machine.go
index 6b1a8ea..9d5933c 100644
--- a/machine.go
+++ b/machine.go
@@ -59,14 +59,14 @@ func updatePackages(m *zoopb.Machine, newp *zoopb.Packages) bool {
if p.Name == "zood" {
if pold := m.Packages.FindByName("zood"); pold == nil {
changed = true
- log.Log(ZOOD, "updatePackages() new package", p.Name , "version", p.Version, "machine", m.Hostname)
+ log.Log(ZOOD, "updatePackages() new package", p.Name, "version", p.Version, "machine", m.Hostname)
m.Packages.Append(p)
} else {
if p.Version == pold.Version {
log.Log(ZOOD, "updatePackages() unchanged", p.Version, "machine", m.Hostname)
} else {
changed = true
- log.Log(NOW, "updatePackages() package", p.Name , "version changed", pold.Version, "to", p.Version, "machine", m.Hostname)
+ log.Log(NOW, "updatePackages() package", p.Name, "version changed", pold.Version, "to", p.Version, "machine", m.Hostname)
pold.Version = p.Version
}
}
diff --git a/main.go b/main.go
index 2b81159..01edde3 100644
--- a/main.go
+++ b/main.go
@@ -53,9 +53,11 @@ func main() {
os.Exit(-1)
}
// me.targets = make(map[string]string) // keep track of what versions the machines should be running
- me.upgrade = make(map[string]bool) // used to trigger upgrade attempts
+ me.upgrade = make(map[string]bool) // used to trigger upgrade attempts
go NewWatchdog()
- startHTTP()
+ go startHTTP()
+
+ doGui()
}
diff --git a/structs.go b/structs.go
index 65d5173..42846ee 100644
--- a/structs.go
+++ b/structs.go
@@ -3,6 +3,7 @@ package main
import (
"time"
+ "go.wit.com/gui"
"go.wit.com/lib/protobuf/zoopb"
)
@@ -19,4 +20,5 @@ type stuff struct {
machines *zoopb.Machines // every machine that has reported itself to the zookeeper
targets map[string]string // what versions the machines should be running
upgrade map[string]bool // use this to trigger builds
+ myGui *gui.Node // the gui toolkit handle
}