redo repos window

This commit is contained in:
Jeff Carr 2025-05-31 11:31:11 -05:00
parent 8a24141803
commit ad5d8dbb87
2 changed files with 52 additions and 2 deletions

View File

@ -214,9 +214,19 @@ func drawWindow(win *gadgets.GenericWindow) {
})
*/
var newWin *gadgets.GenericWindow
s := fmt.Sprintf("Repos (%d)", me.forge.Repos.Len())
me.reposWinB = gridM.NewButton(s, func() {
if newWin != nil {
newWin.Toggle()
return
}
newWin = makeReposWindowNew()
})
// var reposWin *gadgets.GenericWindow
var reposWin *stdReposTableWin
me.reposWinB = gridM.NewButton("Repos", func() {
gridM.NewButton("Fix Repos", func() {
if reposWin != nil {
reposWin.Toggle()
return

View File

@ -223,7 +223,7 @@ func makeReposWin() *stdReposTableWin {
hbox.NewButton("test", func() {
})
t := makeStandardReposGrid(found)
t := makeDevelBehindMaster(found)
t.SetParent(box)
t.ShowTable()
})
@ -301,6 +301,25 @@ func makeReposWin() *stdReposTableWin {
return rwin
}
// table of devel errors behind master
func makeDevelBehindMaster(pb *gitpb.Repos) *gitpb.ReposTable {
t := pb.NewTable("testDirty")
t.NewUuid()
sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string {
return r.GetGoPath()
})
sf.Custom = func(r *gitpb.Repo) {
log.Info("merge master into devel here", r.GetGoPath())
}
t.AddTimeFunc("age", func(repo *gitpb.Repo) time.Time {
return repo.NewestTime()
})
t.AddMasterVersion()
t.AddDevelVersion()
t.AddState()
return t
}
// default window for active running droplets
func (rwin *stdReposTableWin) doReposTable(pb *gitpb.Repos) {
rwin.Lock()
@ -573,3 +592,24 @@ func addWindowPB(win *gadgets.GenericWindow, pb *gitpb.Repos) *gitpb.ReposTable
t.ShowTable()
return t
}
func makeReposWindowNew() *gadgets.GenericWindow {
win := gadgets.NewGenericWindow("git repos", "Filter")
win.Custom = func() {
// sets the hidden flag to false so Toggle() works
win.Hide()
}
hbox := win.Group.Box().Horizontal()
hbox.NewCheckbox("broken")
hbox.NewCheckbox("dirty")
hbox.NewCheckbox("mine")
hbox.NewButton("fix all", func() {
log.Info("try to fix everything here")
})
t := makeStandardReposGrid(me.forge.Repos)
t.SetParent(win.Bottom)
t.ShowTable()
return win
}