start a gui
This commit is contained in:
parent
6b3651edb7
commit
940d259bbf
4
Makefile
4
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:
|
||||
|
|
|
@ -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")
|
||||
})
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
6
main.go
6
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()
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue