summaryrefslogtreecommitdiff
path: root/windowFound.go
diff options
context:
space:
mode:
Diffstat (limited to 'windowFound.go')
-rw-r--r--windowFound.go104
1 files changed, 104 insertions, 0 deletions
diff --git a/windowFound.go b/windowFound.go
new file mode 100644
index 0000000..4639835
--- /dev/null
+++ b/windowFound.go
@@ -0,0 +1,104 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+// shows a window of the 'found' repos
+
+import (
+ "go.wit.com/lib/gadgets"
+ "go.wit.com/lib/protobuf/gitpb"
+ "go.wit.com/log"
+
+ "go.wit.com/gui"
+)
+
+type foundWindow struct {
+ win *gadgets.BasicWindow // the patches window
+ stack *gui.Node // the top box set as vertical
+ grid *gui.Node // the list of available patches
+ reason *gadgets.BasicEntry // the name of the patchset
+ submitB *gui.Node // the submit patchet button
+ psetgrid *gui.Node // the list of each patchset
+ totalOL *gadgets.OneLiner
+ dirtyOL *gadgets.OneLiner
+ readonlyOL *gadgets.OneLiner
+ rw *gadgets.OneLiner
+ // checkB *gui.Node
+}
+
+func (r *foundWindow) Hidden() bool {
+ return r.win.Hidden()
+}
+
+func (r *foundWindow) Toggle() {
+ if r.Hidden() {
+ r.Show()
+ } else {
+ r.Hide()
+ }
+}
+
+func (r *foundWindow) Show() {
+ r.win.Show()
+}
+
+func (r *foundWindow) Hide() {
+ r.win.Hide()
+}
+
+// you can only have one of these
+func (r *foundWindow) initWindow() {
+ r.win = gadgets.RawBasicWindow("Found Repos")
+ r.win.Make()
+
+ r.stack = r.win.Box().NewBox("bw vbox", false)
+ // me.reposwin.Draw()
+ r.win.Custom = func() {
+ log.Warn("Found Window close. setting hidden=true")
+ // sets the hidden flag to false so Toggle() works
+ r.win.Hide()
+ }
+ group1 := r.stack.NewGroup("Repo Summary")
+ group1.NewButton("dirty", func() {
+ log.Info("find dirty here")
+ me.found = new(gitpb.Repos)
+ findDirty()
+ me.forge.PrintHumanTable(me.found)
+ })
+ group1.NewButton("all", func() {
+ log.Info("find all here")
+ me.found = new(gitpb.Repos)
+ findAll()
+ me.forge.PrintHumanTable(me.found)
+ })
+
+ r.grid = r.stack.RawGrid()
+
+ group1.NewButton("show", func() {
+ r.listRepos()
+ })
+}
+
+func (r *foundWindow) listRepos() {
+ all := me.found.All()
+ for all.Scan() {
+ repo := all.Next()
+ r.addRepo(repo)
+ }
+}
+
+func (r *foundWindow) addRepo(repo *gitpb.Repo) {
+ r.grid.NewButton("View", func() {
+ })
+ r.grid.NewLabel(repo.GetGoPath())
+ r.grid.NewLabel(repo.GetMasterVersion())
+ r.grid.NewLabel(repo.GetDevelVersion())
+ r.grid.NewLabel(repo.GetUserVersion())
+ r.grid.NewLabel(repo.GetCurrentBranchName())
+ r.grid.NextRow()
+}
+
+// will update this from the current state of the protobuf
+func (r *foundWindow) Update() {
+}