diff options
| author | Jeff Carr <[email protected]> | 2025-03-04 15:45:52 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-04 15:45:52 -0600 |
| commit | aa229b8778d3e17fb7551d33772cc82da7cde6c0 (patch) | |
| tree | cd6a2b92909cda241e87f8772936b1d8f5cd2aa7 /windowRepos.go | |
| parent | 2098040d62368e748bb8996ea37c580f5edc33bb (diff) | |
insert PB table seems to work
Diffstat (limited to 'windowRepos.go')
| -rw-r--r-- | windowRepos.go | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/windowRepos.go b/windowRepos.go index db853b7..2e76a24 100644 --- a/windowRepos.go +++ b/windowRepos.go @@ -8,6 +8,7 @@ package main import ( "fmt" "os" + "time" "go.wit.com/lib/gadgets" "go.wit.com/lib/protobuf/gitpb" @@ -81,6 +82,40 @@ func makeReposWin() *gadgets.GenericWindow { makeStandardReposWindow("All repos", me.found) }) + var insertWin *gadgets.GenericWindow + me.repoWritableB = grid.NewButton("insert test", func() { + // if the window exists, just toggle it open or closed + if insertWin != nil { + insertWin.Toggle() + return + } + + insertWin = makeWindowForPB() + insertWin.Win.Custom = func() { + log.Info("test delete window here") + } + grid := insertWin.Group.RawGrid() + grid.NewButton("do something", func() { + log.Info("do something on each pb row") + }) + grid.NewButton("attempt to insert table", func() { + // make the window for the first time + found := new(gitpb.Repos) + all := me.forge.Repos.SortByFullPath() + for all.Scan() { + repo := all.Next() + if me.forge.Config.IsReadOnly(repo.GetGoPath()) { + continue + } + + found.AppendByGoPath(repo) + + } + t := addWindowPB(insertWin, found) + log.Info("table has uuid", t.GetUuid()) + }) + }) + grid.NewButton("Configure", func() { log.Info("add a forge config window here") }) @@ -277,3 +312,68 @@ func masterRemoteProblem() *gitpb.Repos { } return found } + +func makeWritableWindow(pb *gitpb.Repos) (*gadgets.GenericWindow, *gitpb.ReposTable) { + win := gadgets.NewGenericWindow("Repos You have write access to", "Configure") + t := pb.NewTable("testForgeRepos") + t.NewUuid() + + grid := win.Group.RawGrid() + grid.NewButton("git pull", func() { + log.Info("todo: run git pull on each repo") + }) + + grid.NewButton("do repos.ReScan()", func() { + t.Update() + }) + + tbox := win.Bottom.Box() + t.SetParent(tbox) + + sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string { + return r.GetGoPath() + }) + sf.Custom = func(r *gitpb.Repo) { + log.Info("do button click on", r.GetGoPath()) + } + t.AddTimeFunc("age", func(repo *gitpb.Repo) time.Time { + return repo.NewestTime() + }) + t.AddMasterVersion() + t.AddDevelVersion() + t.AddUserVersion() + t.AddCurrentBranchName() + t.AddState() + t.ShowTable() + return win, t +} + +func makeWindowForPB() *gadgets.GenericWindow { + win := gadgets.NewGenericWindow("Raw PB View", "Configure") + + return win +} + +func addWindowPB(win *gadgets.GenericWindow, pb *gitpb.Repos) *gitpb.ReposTable { + t := pb.NewTable("testForgeRepos") + t.NewUuid() + tbox := win.Bottom.Box() + t.SetParent(tbox) + + sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string { + return r.GetGoPath() + }) + sf.Custom = func(r *gitpb.Repo) { + log.Info("do button click on", r.GetGoPath()) + } + t.AddTimeFunc("age", func(repo *gitpb.Repo) time.Time { + return repo.NewestTime() + }) + t.AddMasterVersion() + t.AddDevelVersion() + t.AddUserVersion() + t.AddCurrentBranchName() + t.AddState() + t.ShowTable() + return t +} |
