make more widets mirrors. This is very helpful here

This commit is contained in:
Jeff Carr 2024-02-19 16:28:24 -06:00
parent 89e8d79d9b
commit 240da22087
5 changed files with 39 additions and 59 deletions

View File

@ -18,7 +18,7 @@ func (r *Repo) Hide() {
r.develVersion.Hide() r.develVersion.Hide()
r.userVersion.Hide() r.userVersion.Hide()
r.dirtyLabel.Hide() r.gitState.Hide()
r.endBox.Hide() r.endBox.Hide()
// r.statusButton.Hide() // r.statusButton.Hide()
// r.diffButton.Hide() // r.diffButton.Hide()
@ -41,7 +41,7 @@ func (r *Repo) Show() {
r.develVersion.Show() r.develVersion.Show()
r.userVersion.Show() r.userVersion.Show()
r.dirtyLabel.Show() r.gitState.Show()
r.endBox.Show() r.endBox.Show()
// r.statusButton.Show() // r.statusButton.Show()
// r.diffButton.Show() // r.diffButton.Show()
@ -84,11 +84,18 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
case "autotypist": case "autotypist":
newRepo.lastTag = newRepo.Status.MirrorLastTag() newRepo.lastTag = newRepo.Status.MirrorLastTag()
grid.Append(newRepo.lastTag) grid.Append(newRepo.lastTag)
newRepo.masterVersion = grid.NewLabel("").SetProgName("masterVersion")
newRepo.develVersion = grid.NewLabel("").SetProgName("develVersion") newRepo.masterVersion = newRepo.Status.MirrorMasterVersion()
newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion") grid.Append(newRepo.masterVersion)
newRepo.targetV = r.blind.NewLabel("")
newRepo.dirtyLabel = grid.NewLabel("") newRepo.develVersion = newRepo.Status.MirrorDevelVersion()
grid.Append(newRepo.develVersion)
newRepo.userVersion = newRepo.Status.MirrorUserVersion()
grid.Append(newRepo.userVersion)
newRepo.gitState = newRepo.Status.MirrorGitState()
grid.Append(newRepo.gitState)
newRepo.currentName = newRepo.Status.MirrorCurrentName() newRepo.currentName = newRepo.Status.MirrorCurrentName()
grid.Append(newRepo.currentName) grid.Append(newRepo.currentName)
@ -162,9 +169,12 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
newRepo.currentVersion = newRepo.Status.MirrorCurrentVersion() newRepo.currentVersion = newRepo.Status.MirrorCurrentVersion()
grid.Append(newRepo.currentVersion) grid.Append(newRepo.currentVersion)
newRepo.masterVersion = r.blind.NewLabel("").SetProgName("masterVersion") newRepo.gitState = newRepo.Status.MirrorGitState()
newRepo.dirtyLabel = grid.NewLabel("") grid.Append(newRepo.gitState)
newRepo.goState = grid.NewLabel("not in the blind")
newRepo.goState = newRepo.Status.MirrorGoState()
grid.Append(newRepo.goState)
newRepo.endBox = grid.NewHorizontalBox("HBOX") newRepo.endBox = grid.NewHorizontalBox("HBOX")
newRepo.endBox.NewButton("Configure", func() { newRepo.endBox.NewButton("Configure", func() {
if newRepo.Status == nil { if newRepo.Status == nil {
@ -191,8 +201,6 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
newRepo.Status.Build() newRepo.Status.Build()
}) })
} }
newRepo.develVersion = r.blind.NewLabel("").SetProgName("develVersion")
newRepo.userVersion = r.blind.NewLabel("").SetProgName("userVersion")
default: default:
} }
grid.NextRow() grid.NextRow()

View File

@ -41,7 +41,7 @@ func AllRepos() []*Repo {
// a human readable state of the current repo // a human readable state of the current repo
func (r *Repo) State() string { func (r *Repo) State() string {
return r.dirtyLabel.String() return r.gitState.String()
} }
func (r *Repo) Scan() bool { func (r *Repo) Scan() bool {
@ -113,10 +113,10 @@ func (r *Repo) SetGoState(s string) {
} }
func (r *Repo) IsPerfect() bool { func (r *Repo) IsPerfect() bool {
if r.dirtyLabel.String() == "PERFECT" { if r.gitState.String() == "PERFECT" {
return true return true
} }
if r.dirtyLabel.String() == "unchanged" { if r.gitState.String() == "unchanged" {
return true return true
} }
return false return false

45
scan.go
View File

@ -2,7 +2,6 @@ package repolist
import ( import (
"fmt" "fmt"
"os/user"
"strings" "strings"
"go.wit.com/log" "go.wit.com/log"
@ -21,7 +20,7 @@ func (r *RepoList) ScanRepositories() (int, string) {
} }
}) })
s := fmt.Sprint(t) s := fmt.Sprint(t)
log.Info("Scanned", i, "repositories. todo: count/show changes", s) log.Info("Scanned", i, "repositories. todo: count/show changes in", s)
return i, s return i, s
} }
@ -31,52 +30,24 @@ func (r *Repo) NewScan() bool {
return false return false
} }
// first run the repostatus update // run the repostatus update
r.Status.UpdateNew() r.Status.UpdateNew()
// now read those values and display them in our table // print out whatever changes have happened
mname := r.Status.GetMasterBranchName()
mver := r.Status.GetMasterVersion()
mver = mver + " (" + mname + ")"
r.masterVersion.SetLabel(mver)
dname := r.Status.GetDevelBranchName()
dver := r.Status.GetDevelVersion()
if dname != "devel" {
dver = dver + " (" + dname + ")"
}
r.develVersion.SetLabel(dver)
uname := r.Status.GetUserBranchName()
uver := r.Status.GetUserVersion()
usr, _ := user.Current()
if uname != usr.Username {
uver = uver + " (" + uname + ")"
}
r.userVersion.SetLabel(uver)
// cbname := r.Status.GetCurrentBranchName()
// cbversion := r.Status.GetCurrentBranchVersion()
// lasttag := r.Status.GetLastTagVersion()
// r.lastTag.SetLabel(lasttag)
// r.currentName.SetLabel(cbname)
// r.currentVersion.SetLabel(cbversion)
if c, ok := r.Status.Changed(); ok { if c, ok := r.Status.Changed(); ok {
c := strings.TrimSpace(c) c := strings.TrimSpace(c)
for _, line := range strings.Split(c, "\n") { for _, line := range strings.Split(c, "\n") {
log.Info(r.Status.Path(), line) log.Info(r.Status.Path(), line)
} }
} }
// r.targetV.SetText(r.Status.GetTargetVersion())
status := r.Status.GetStatus() // hide or show repos based on the checkboxes
r.dirtyLabel.SetLabel(status)
if status == "PERFECT" {
if me.autoHidePerfect { if me.autoHidePerfect {
if r.IsPerfect() {
r.Hide() r.Hide()
} else {
r.Show()
}
} }
return true return true
} }
return false
}

View File

@ -45,7 +45,7 @@ type Repo struct {
lastTag *gui.Node // last tagged version label lastTag *gui.Node // last tagged version label
currentName *gui.Node // current branch name currentName *gui.Node // current branch name
currentVersion *gui.Node // current branch version currentVersion *gui.Node // current branch version
dirtyLabel *gui.Node // git state (dirty or not?) gitState *gui.Node // git state (dirty or not?)
goState *gui.Node // what is the state of the go.sum file goState *gui.Node // what is the state of the go.sum file
masterVersion *gui.Node // the master branch version masterVersion *gui.Node // the master branch version

View File

@ -24,7 +24,8 @@ func AutotypistView(parent *gui.Node) *RepoList {
me.reposgrid.NewLabel("devel version") me.reposgrid.NewLabel("devel version")
me.reposgrid.NewLabel("user version") me.reposgrid.NewLabel("user version")
me.reposgrid.NewLabel("Status") me.reposgrid.NewLabel("Status")
me.reposgrid.NewLabel("Current Version").SetProgName("Current Version") me.reposgrid.NewLabel("Current").SetProgName("CurrentName")
me.reposgrid.NewLabel("Version").SetProgName("CurrentVersion")
me.reposgrid.NextRow() me.reposgrid.NextRow()
me.blind = gui.RawBox() me.blind = gui.RawBox()
return me return me