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

@ -36,7 +36,7 @@ func msg(w http.ResponseWriter, s string) {
func (v *RepoList) PrintReport(w http.ResponseWriter, readonly string, onlydirty string, perfect string) { func (v *RepoList) PrintReport(w http.ResponseWriter, readonly string, onlydirty string, perfect string) {
var count int var count int
header := fmt.Sprintf("%-35s %5s %-20s %-20s %-20s %-20s %-15s", header := fmt.Sprintf("%-35s %5s %-20s %-20s %-20s %-20s %-15s",
"REPO", "AGE", "REPO", "AGE",
"LAST", "MASTER", "DEVEL", "USER", "LAST", "MASTER", "DEVEL", "USER",
"STATE") "STATE")
@ -88,7 +88,7 @@ func (r *RepoRow) StandardReleaseHeader() string {
curname := r.Status.GetCurrentBranchName() curname := r.Status.GetCurrentBranchName()
master := r.Status.GetMasterVersion() master := r.Status.GetMasterVersion()
user := r.Status.GetUserVersion() user := r.Status.GetUserVersion()
target := r.Status.GetTargetVersion() target := r.Status.GetTargetVersion()
header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-10s %-20s %-15s", header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-10s %-20s %-15s",
@ -103,12 +103,11 @@ func (r *RepoRow) StandardReleaseHeader() string {
return header return header
} }
func (v *RepoList) PrintReleaseReport(w http.ResponseWriter, readonly string, perfect string) { func (v *RepoList) PrintReleaseReport(w http.ResponseWriter, readonly string, perfect string) {
var count int var count int
header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-10s %-20s %-15s", header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-10s %-20s %-15s",
"REPO", "AGE", "CUR BR", "REPO", "AGE", "CUR BR",
"LAST", "MASTER", "TARGET", "USER", "LAST", "MASTER", "TARGET", "USER",
"STATE") "STATE")
msg(w, header) msg(w, header)

View File

@ -23,9 +23,6 @@ func (r *RepoRow) Hide() {
r.gitState.Hide() r.gitState.Hide()
r.endBox.Hide() r.endBox.Hide()
// r.statusButton.Hide()
// r.diffButton.Hide()
// r.goState.Hide()
r.targetV.Hide() r.targetV.Hide()
r.hidden = true r.hidden = true
} }
@ -42,9 +39,22 @@ func (r *RepoRow) Show() {
r.gitState.Show() r.gitState.Show()
r.endBox.Show() r.endBox.Show()
// r.statusButton.Show() r.targetV.Show()
// r.diffButton.Show() r.hidden = false
// r.goState.Show() }
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.targetV.Show()
r.hidden = false r.hidden = false
} }
@ -80,9 +90,30 @@ func (r *RepoList) NewRepo(path string) (*RepoRow, error) {
} }
r.reposgrid.NextRow() r.reposgrid.NextRow()
newRepo.Status.InitOk = true newRepo.Status.InitOk = true
newRepo.Hide()
return newRepo, nil 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) { func (r *RepoList) makeAutotypistView(newRepo *RepoRow) {
grid := r.reposgrid grid := r.reposgrid

View File

@ -63,6 +63,16 @@ func (r *RepoList) ReposSortByName() *RepoIterator {
return iterator return iterator
} }
func (r *RepoList) UnmergedRepos() *RepoIterator {
repoPointers := r.selectRepoAll()
sort.Sort(ByName(repoPointers))
iterator := NewRepoIterator(repoPointers)
return iterator
}
type ByName []*RepoRow type ByName []*RepoRow
func (a ByName) Len() int { return len(a) } func (a ByName) Len() int { return len(a) }
@ -92,3 +102,36 @@ func (r *RepoList) selectRepoAll() []*RepoRow {
return repoPointers 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
}