add download buttons to the go.wit.com/list window
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
fba99bb2f5
commit
c488fcaf6c
|
@ -29,9 +29,12 @@ func quickCmd(fullpath string, cmd []string) bool {
|
|||
if me.autoWorkingPwd.String() != fullpath {
|
||||
me.autoWorkingPwd.SetValue(fullpath)
|
||||
}
|
||||
log.Warn("RUN:", fullpath, cmd)
|
||||
|
||||
if me.autoDryRun.Checked() {
|
||||
log.Warn("RUN --dry-run", fullpath, cmd)
|
||||
return false
|
||||
} else {
|
||||
log.Warn("RUN:", fullpath, cmd)
|
||||
}
|
||||
|
||||
err, b, output = repostatus.RunCmd(fullpath, cmd)
|
||||
|
|
|
@ -9,6 +9,37 @@ import (
|
|||
// "go.wit.com/gui/gadgets"
|
||||
)
|
||||
|
||||
func globalDisplayHide() {
|
||||
for _, repo := range me.allrepos {
|
||||
if me.autoHideReadOnly.Checked() {
|
||||
if repo.status.ReadOnly() {
|
||||
repo.Hide()
|
||||
}
|
||||
}
|
||||
if me.autoHidePerfect.Checked() {
|
||||
if repo.dirtyLabel.String() == "PERFECT" {
|
||||
repo.Hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func globalDisplayShow() {
|
||||
for _, repo := range me.allrepos {
|
||||
if me.autoHideReadOnly.Checked() {
|
||||
if repo.status.ReadOnly() {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if me.autoHidePerfect.Checked() {
|
||||
if repo.dirtyLabel.String() == "PERFECT" {
|
||||
continue
|
||||
}
|
||||
}
|
||||
repo.Show()
|
||||
}
|
||||
}
|
||||
|
||||
func globalDisplayOptions(box *gui.Node) {
|
||||
vbox := box.NewVerticalBox("DISPLAYVBOX")
|
||||
|
||||
|
@ -47,26 +78,18 @@ func globalDisplayOptions(box *gui.Node) {
|
|||
me.autoHideReadOnly = group1.NewCheckbox("Hide read-only repos").SetChecked(true)
|
||||
me.autoHideReadOnly.Custom = func() {
|
||||
if me.autoHideReadOnly.Checked() {
|
||||
for _, repo := range me.allrepos {
|
||||
if repo.status.ReadOnly() {
|
||||
repo.Hide()
|
||||
}
|
||||
}
|
||||
globalDisplayHide()
|
||||
} else {
|
||||
globalDisplayShow()
|
||||
}
|
||||
}
|
||||
|
||||
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(false)
|
||||
me.autoHidePerfect.Custom = func() {
|
||||
if me.autoHidePerfect.Checked() {
|
||||
for _, repo := range me.allrepos {
|
||||
if repo.dirtyLabel.String() == "PERFECT" {
|
||||
repo.Hide()
|
||||
}
|
||||
}
|
||||
globalDisplayHide()
|
||||
} else {
|
||||
for _, repo := range me.allrepos {
|
||||
repo.Show()
|
||||
}
|
||||
globalDisplayShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ func globalTestingOptions(box *gui.Node) {
|
|||
me.downloadEverythingButton.Enable()
|
||||
}
|
||||
})
|
||||
test1.NewButton("build all apps", func() {
|
||||
test1.NewButton("go.wit.com/list", func() {
|
||||
listWindow()
|
||||
})
|
||||
test1.NewButton("repostatus.ListAll()", func() {
|
||||
|
|
|
@ -4,6 +4,7 @@ package main
|
|||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/gui"
|
||||
|
@ -15,13 +16,20 @@ import (
|
|||
var lw *gadgets.BasicWindow
|
||||
var allsections []*section
|
||||
|
||||
type witRepo struct {
|
||||
sec *section
|
||||
path *gui.Node
|
||||
downloadB *gui.Node
|
||||
}
|
||||
|
||||
type section struct {
|
||||
name string
|
||||
parent *gui.Node
|
||||
box *gui.Node
|
||||
group *gui.Node
|
||||
checkbox *gui.Node
|
||||
repos []*gui.Node
|
||||
grid *gui.Node // where the repos are listed
|
||||
hideCB *gui.Node
|
||||
witRepos []*witRepo
|
||||
}
|
||||
|
||||
func listWindow() {
|
||||
|
@ -66,8 +74,19 @@ func (s *section) add(path string) {
|
|||
if s == nil {
|
||||
return
|
||||
}
|
||||
tmp := s.parent.NewLabel(path)
|
||||
s.repos = append(s.repos, tmp)
|
||||
tmp := new(witRepo)
|
||||
tmp.sec = s
|
||||
tmp.path = s.grid.NewLabel(path)
|
||||
tmp.downloadB = s.grid.NewButton("download", func() {
|
||||
lw.Disable()
|
||||
log.Info("downloading", tmp.path.String(), "here")
|
||||
os.Setenv("GO111MODULE", "off")
|
||||
fullpath := "/home/jcarr/go/src/go.wit.com/"
|
||||
quickCmd(fullpath, []string{"go", "get", "-v", tmp.path.String()})
|
||||
lw.Enable()
|
||||
})
|
||||
|
||||
s.witRepos = append(s.witRepos, tmp)
|
||||
}
|
||||
|
||||
func NewSection(parent *gui.Node, path string) *section {
|
||||
|
@ -75,19 +94,21 @@ func NewSection(parent *gui.Node, path string) *section {
|
|||
news.parent = parent
|
||||
news.box = news.parent.NewBox("bw vbox", true)
|
||||
news.group = news.box.NewGroup(path)
|
||||
news.checkbox = news.box.NewCheckbox("hide")
|
||||
news.checkbox.Custom = func() {
|
||||
news.hideCB = news.box.NewCheckbox("hide")
|
||||
news.hideCB.Custom = func() {
|
||||
news.toggle()
|
||||
}
|
||||
news.grid = news.parent.NewGrid("sections", 2, 1)
|
||||
allsections = append(allsections, news)
|
||||
return news
|
||||
}
|
||||
|
||||
func (s *section) toggle() {
|
||||
log.Warn(s.name)
|
||||
for i, n := range s.repos {
|
||||
log.Warn(i, n.String())
|
||||
n.Hide()
|
||||
for i, wrepo := range s.witRepos {
|
||||
log.Warn(i, wrepo.path.String())
|
||||
wrepo.path.Hide()
|
||||
wrepo.downloadB.Hide()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue