diff --git a/newRepo.go b/newRepo.go index 3dbde0e..b0c583f 100644 --- a/newRepo.go +++ b/newRepo.go @@ -131,75 +131,7 @@ func (r *RepoList) AddRepo(pb *gitpb.Repo) (*RepoRow, error) { r.reposbox.Enable() }) - /* - if strings.HasPrefix(newRepo.GoPath(), "go.wit.com/apps") { - var showBuildB bool = false - switch newRepo.Status.RepoType() { - case "binary": - // log.Info("showing compile here button") - showBuildB = true - case "library": - // log.Info("library here. Hide()") - default: - // log.Info("unknown RepoType", newRepo.Status.RepoType()) - } - if showBuildB { - newRepo.endBox.NewButton("build", func() { - newRepo.Status.Build() - }) - } - } - */ r.reposgrid.NextRow() newRepo.Status.InitOk = true return newRepo, nil } - -func (r *RepoList) makeGuireleaserView(newRepo *RepoRow) { - grid := r.reposgrid - - newRepo.targetV = newRepo.Status.MirrorTargetVersion() - grid.Append(newRepo.targetV) - - newRepo.lastTag = newRepo.Status.MirrorLastTag() - grid.Append(newRepo.lastTag) - - newRepo.currentName = newRepo.Status.MirrorCurrentName() - grid.Append(newRepo.currentName) - newRepo.currentVersion = newRepo.Status.MirrorCurrentVersion() - grid.Append(newRepo.currentVersion) - - newRepo.gitState = newRepo.Status.MirrorGitState() - grid.Append(newRepo.gitState) - - // newRepo.goState = grid.NewLabel("goState") - - newRepo.endBox = grid.NewHorizontalBox("HBOX") - newRepo.endBox.NewButton("Configure", func() { - if newRepo.Status == nil { - // this should never happen, but it does happen because I'm not that smart and forget I can nil Status - // for some reason that makes sense in my head. again, I'm not that smart - log.Warn("status window wasn't created") - return - } - newRepo.Status.Toggle() - }) - newRepo.endBox.NewButton("Whitelist", func() { - log.Info("need to implement this") - newRepo.Hide() - }) - /* - newRepo.endBox.NewButton("CheckValidGoSum()", func() { - ok, err := r.CheckValidGoSum(newRepo) - if err != nil { - log.Info("go mod tidy did not work err =", err) - return - } - if ok { - log.Info("repo has go.sum requirements that are clean") - // newRepo.goState.SetText("GOOD") - return - } - }) - */ -} diff --git a/viewGuiReleaser.go b/viewGuiReleaser.go deleted file mode 100644 index 972ae1d..0000000 --- a/viewGuiReleaser.go +++ /dev/null @@ -1,34 +0,0 @@ -package repolist - -import "go.wit.com/gui" - -// This creates a view of the repos -// you can only have one at this point -func GuireleaserView(parent *gui.Node) *RepoList { - if me != nil { - return me - } - me = new(RepoList) - me.allrepos = make(map[string]*RepoRow) - me.viewName = "guireleaser" - - // me.reposbox = gui.RawBox() - me.reposbox = parent - - me.reposgroup = me.reposbox.NewGroup("GUI repositories (configure in ~/.config/guireleaser)") - me.reposgrid = me.reposgroup.NewGrid("test", 0, 0) - - me.reposgrid.NewLabel("") // path goes here - me.reposgrid.NewLabel("target") - me.reposgrid.NewLabel("last tag").SetProgName("last tag") - me.reposgrid.NewLabel("Current") - me.reposgrid.NewLabel("Version") - me.reposgrid.NewLabel("git State") - // me.reposgrid.NewLabel("GO State") - me.reposgrid.NextRow() - - me.blind = gui.RawBox() - me.shownCount = me.blind.NewLabel("showCount") - me.duration = me.blind.NewLabel("duration") - return me -} diff --git a/viewTempWindow.go b/viewTempWindow.go deleted file mode 100644 index ffb99e5..0000000 --- a/viewTempWindow.go +++ /dev/null @@ -1,96 +0,0 @@ -package repolist - -import ( - "go.wit.com/gui" - "go.wit.com/log" -) - -// 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("Current Branch") - tmp.reposgrid.NewLabel("last tag") - tmp.reposgrid.NewLabel("master") - tmp.reposgrid.NewLabel("devel") - tmp.reposgrid.NewLabel("user") - tmp.reposgrid.NewLabel("?") - - tmp.reposgrid.NextRow() - - tmp.shownCount = me.blind.NewLabel("showCount") - tmp.duration = me.blind.NewLabel("duration") - return tmp -} - -func (r *RepoList) ListRows() { - for i, row := range r.rows { - log.Warn("i, row:", i, row.Status.Name(), "curname", row.Status.GetCurrentBranchName()) - row.currentName.SetLabel(row.Status.GetCurrentBranchName()) - } -} - -func (r *RepoList) ShowRepo(repo *RepoRow) error { - // this is the gui grid. all the widgets get added here - // at the end we tell the grid go to NextRow() - grid := r.reposgrid - - // make a new row of gui widgets - newRow := new(RepoRow) - newRow.Status = repo.Status - - newRow.pLabel = grid.NewLabel(repo.Status.Path()) - newRow.currentName = grid.NewLabel(repo.Status.GetCurrentBranchName()) - - newRow.lastTag = grid.NewLabel(repo.Status.LastTag()) - newRow.masterVersion = grid.NewLabel(repo.Status.GetMasterVersion()) - newRow.develVersion = grid.NewLabel(repo.Status.GetDevelVersion()) - newRow.userVersion = grid.NewLabel(repo.Status.GetUserVersion()) - - newRow.gitState = grid.NewLabel(repo.Status.GitState()) - - newRow.endBox = grid.NewHorizontalBox("HBOX") - newRow.endBox.NewButton("Repo Window", func() { - newRow.Status.Toggle() - }) - - newRow.endBox.NewButton("show diff", func() { - log.Log(REPOWARN, "show diff currentName =", newRow.currentName.String()) - log.Log(REPOWARN, "show diff masterVersion =", newRow.masterVersion.String()) - // newRow.Status.XtermNohup([]string{"git diff"}) - newRow.Status.Xterm("git diff; bash") - }) - - newRow.endBox.NewButton("commit all", func() { - if !newRow.Status.IsUserBranch() { - log.Log(REPOWARN, "can not commit on non user branch") - return - } - // restore anything staged so everything can be reviewed - newRow.Status.Run([]string{"git", "restore", "--staged", "."}) - newRow.Status.XtermWait("git diff") - newRow.Status.XtermWait("git add --all") - newRow.Status.XtermWait("git commit -a") - newRow.Status.XtermWait("git push") - if newRow.Status.CheckDirty() { - // commit was not done, restore diff - newRow.Status.Run([]string{"git", "restore", "--staged", "."}) - } else { - newRow.NewScan() - } - }) - - newRow.hidden = false - r.reposgrid.NextRow() - r.rows = append(r.rows, newRow) - return nil -}