adding tempWindow for merging

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-05 01:02:00 -06:00
parent 4fa21db5a9
commit 6601fae571
4 changed files with 115 additions and 11 deletions

View File

@ -103,7 +103,6 @@ func (r *RepoRow) StandardReleaseHeader() string {
return header
}
func (v *RepoList) PrintReleaseReport(w http.ResponseWriter, readonly string, perfect string) {
var count int

View File

@ -23,9 +23,6 @@ func (r *RepoRow) Hide() {
r.gitState.Hide()
r.endBox.Hide()
// r.statusButton.Hide()
// r.diffButton.Hide()
// r.goState.Hide()
r.targetV.Hide()
r.hidden = true
}
@ -42,9 +39,22 @@ func (r *RepoRow) Show() {
r.gitState.Show()
r.endBox.Show()
// r.statusButton.Show()
// r.diffButton.Show()
// r.goState.Show()
r.targetV.Show()
r.hidden = false
}
func (r *RepoRow) Show2() {
r.pLabel.Show()
r.lastTag.Show()
r.currentName.Show()
r.currentVersion.Show()
r.masterVersion.Show()
r.develVersion.Show()
r.userVersion.Show()
r.gitState.Show()
r.endBox.Show()
r.targetV.Show()
r.hidden = false
}
@ -80,9 +90,30 @@ func (r *RepoList) NewRepo(path string) (*RepoRow, error) {
}
r.reposgrid.NextRow()
newRepo.Status.InitOk = true
newRepo.Hide()
return newRepo, nil
}
func (r *RepoList) ShowRepo(repo *RepoRow) error {
newRow := new(RepoRow)
newRow.pLabel = r.reposgrid.NewLabel(repo.Status.Path())
newRow.targetV = r.reposgrid.NewLabel(repo.Status.GetTargetVersion())
newRow.lastTag = r.reposgrid.NewLabel(repo.Status.LastTag())
newRow.currentName = r.reposgrid.NewLabel(repo.Status.GetCurrentBranchName())
newRow.currentVersion = r.reposgrid.NewLabel(repo.Status.GetCurrentVersion())
newRow.gitState = r.reposgrid.NewLabel(repo.Status.GitState())
newRow.masterVersion = r.reposgrid.NewLabel(repo.Status.GetMasterVersion())
newRow.develVersion = r.reposgrid.NewLabel(repo.Status.GetDevelVersion())
newRow.userVersion = r.reposgrid.NewLabel(repo.Status.GetUserVersion())
newRow.hidden = false
r.reposgrid.NextRow()
return nil
}
func (r *RepoList) makeAutotypistView(newRepo *RepoRow) {
grid := r.reposgrid

View File

@ -63,6 +63,16 @@ func (r *RepoList) ReposSortByName() *RepoIterator {
return iterator
}
func (r *RepoList) UnmergedRepos() *RepoIterator {
repoPointers := r.selectRepoAll()
sort.Sort(ByName(repoPointers))
iterator := NewRepoIterator(repoPointers)
return iterator
}
type ByName []*RepoRow
func (a ByName) Len() int { return len(a) }
@ -92,3 +102,36 @@ func (r *RepoList) selectRepoAll() []*RepoRow {
return repoPointers
}
// SelectRepoPointers safely returns a slice of pointers to Repo records.
func (r *RepoList) selectUnmergedRepos() []*RepoRow {
r.RLock()
defer r.RUnlock()
// Create a new slice to hold pointers to each Repo
// repoPointers := make([]*Repo, len(c.E.Repos))
var repoPointers []*RepoRow
for _, repo := range me.allrepos {
if repo == nil {
continue
}
if repo.Status == nil {
continue
}
if !repo.Status.InitOk {
continue
}
if repo.ReadOnly() {
continue
}
if repo.State() == "PERFECT" {
continue
}
if repo.Status.IsReleased() {
continue
}
repoPointers = append(repoPointers, repo) // Copy pointers for safe iteration
}
return repoPointers
}

31
viewTempWindow.go Normal file
View File

@ -0,0 +1,31 @@
package repolist
import "go.wit.com/gui"
// This creates a view of the repos
// you can only have one at this point
func TempWindowView(parent *gui.Node) *RepoList {
tmp := new(RepoList)
tmp.viewName = "autotypist"
// me.reposbox = gui.RawBox()
tmp.reposbox = parent
tmp.reposgroup = tmp.reposbox.NewGroup("git repositories that are not merged")
tmp.reposgrid = tmp.reposgroup.NewGrid("mergegrid", 0, 0)
tmp.reposgrid.NewLabel("") // path goes here
tmp.reposgrid.NewLabel("last tag").SetProgName("last tag")
tmp.reposgrid.NewLabel("master version")
tmp.reposgrid.NewLabel("devel version")
tmp.reposgrid.NewLabel("user version")
tmp.reposgrid.NewLabel("Status")
tmp.reposgrid.NewLabel("Current").SetProgName("CurrentName")
tmp.reposgrid.NewLabel("Version").SetProgName("CurrentVersion")
tmp.reposgrid.NextRow()
tmp.shownCount = me.blind.NewLabel("showCount")
tmp.duration = me.blind.NewLabel("duration")
return tmp
}