gui patchset cleanups
This commit is contained in:
parent
d16f4d4d32
commit
ca92a4f4e4
|
@ -12,10 +12,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type patchesWindow struct {
|
type patchesWindow struct {
|
||||||
once sync.Once // only init() the window once
|
once sync.Once // only init() the window once
|
||||||
win *gadgets.BasicWindow // the patches window
|
win *gadgets.BasicWindow // the patches window
|
||||||
stack *gui.Node // the top box set as vertical
|
stack *gui.Node // the top box set as vertical
|
||||||
shelf *gui.Node // the first box in the stack, set as horizontal
|
// shelf *gui.Node // the first box in the stack, set as horizontal
|
||||||
grid *gui.Node // the list of available patches
|
grid *gui.Node // the list of available patches
|
||||||
summary *patchSummary // summary of current patches
|
summary *patchSummary // summary of current patches
|
||||||
setgrid *gui.Node // the list of each patchset
|
setgrid *gui.Node // the list of each patchset
|
||||||
|
@ -66,50 +66,34 @@ func (r *patchesWindow) initWindow() {
|
||||||
|
|
||||||
r.grid = r.stack.NewGrid("", 0, 0)
|
r.grid = r.stack.NewGrid("", 0, 0)
|
||||||
|
|
||||||
r.shelf = r.initGroup()
|
/*
|
||||||
|
r.shelf = r.initGroup()
|
||||||
|
group1 := r.stack.NewGroup("stuff")
|
||||||
|
vbox := group1.Box()
|
||||||
|
vbox.Vertical()
|
||||||
|
*/
|
||||||
|
|
||||||
r.summary = r.submitPatchesBox(r.stack)
|
r.summary = r.submitPatchesBox(r.stack)
|
||||||
r.initSetList()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *patchesWindow) initGroup() *gui.Node {
|
// update the stats about the repos and patches
|
||||||
group1 := r.stack.NewGroup("stuff")
|
r.summary.Update()
|
||||||
|
|
||||||
vbox := group1.Box()
|
g := r.stack.NewGroup("PatchSet List")
|
||||||
vbox.Vertical()
|
|
||||||
|
|
||||||
hbox := vbox.Box().Horizontal()
|
// add the grid
|
||||||
|
r.setgrid = g.NewGrid("", 0, 0)
|
||||||
dirty := hbox.NewCheckbox("dirty")
|
|
||||||
dirty.Custom = func() {
|
|
||||||
log.Info("filter dirty =", dirty.Checked())
|
|
||||||
}
|
|
||||||
|
|
||||||
hbox.NewButton("update patch summary", func() {
|
|
||||||
r.summary.Update()
|
|
||||||
})
|
|
||||||
hbox.NewButton("test add", func() {
|
|
||||||
me.patchWin.initGroup()
|
|
||||||
})
|
|
||||||
|
|
||||||
hbox.NewButton("Get Patchsets", func() {
|
|
||||||
psets, err := me.forge.GetPatchesets()
|
|
||||||
if err != nil {
|
|
||||||
log.Info(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
all := psets.All()
|
|
||||||
for all.Scan() {
|
|
||||||
pset := all.Next()
|
|
||||||
log.Info(pset)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return vbox
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *patchesWindow) initSetList() *gui.Node {
|
|
||||||
r.setgrid = r.stack.NewGrid("", 0, 0)
|
|
||||||
r.setlist = make(map[string]*forgepb.Patchset)
|
r.setlist = make(map[string]*forgepb.Patchset)
|
||||||
return nil
|
|
||||||
|
// query for current patchsets
|
||||||
|
lines, err := listPatches()
|
||||||
|
if err != nil {
|
||||||
|
log.Info(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for i, line := range lines {
|
||||||
|
log.Info(i, line)
|
||||||
|
r.addPatchset(line)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *patchesWindow) addPatchset(line string) {
|
func (r *patchesWindow) addPatchset(line string) {
|
||||||
|
@ -151,5 +135,22 @@ func (r *patchesWindow) addPatchset(line string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
r.setgrid.NewButton("Apply", func() {
|
||||||
|
pset := r.setlist[name]
|
||||||
|
if pset == nil {
|
||||||
|
log.Info(name, "was nil")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, _, _, err := IsEverythingOnDevel(); err != nil {
|
||||||
|
log.Info("You can only apply patches to the devel branch")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if IsAnythingDirty() {
|
||||||
|
log.Info("You can't apply patches when repos are dirty")
|
||||||
|
me.forge.PrintHumanTable(me.found)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
applyPatchset(pset)
|
||||||
|
})
|
||||||
r.setgrid.NextRow()
|
r.setgrid.NextRow()
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type patchSummary struct {
|
type patchSummary struct {
|
||||||
|
@ -60,8 +59,13 @@ func (r *patchesWindow) submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
s.fileCount = s.grid.NewLabel("x files")
|
s.fileCount = s.grid.NewLabel("x files")
|
||||||
s.grid.NextRow()
|
s.grid.NextRow()
|
||||||
|
|
||||||
group1 = box.NewGroup("Submit Patch Set")
|
group1 = box.NewGroup("PatchSet Create")
|
||||||
s.grid = group1.RawGrid()
|
s.grid = group1.RawGrid()
|
||||||
|
|
||||||
|
s.grid.NewButton("update patch summary", func() {
|
||||||
|
s.Update()
|
||||||
|
})
|
||||||
|
|
||||||
s.reason = gadgets.NewBasicEntry(s.grid, "set name:")
|
s.reason = gadgets.NewBasicEntry(s.grid, "set name:")
|
||||||
s.reason.Custom = func() {
|
s.reason.Custom = func() {
|
||||||
if s.reason.String() != "" {
|
if s.reason.String() != "" {
|
||||||
|
@ -70,39 +74,29 @@ func (r *patchesWindow) submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
s.submitB.Disable()
|
s.submitB.Disable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.submitB = s.grid.NewButton("Submit", func() {
|
s.submitB = s.grid.NewButton("Create", func() {
|
||||||
doSubmit(s.reason.String())
|
doSubmit(s.reason.String())
|
||||||
})
|
})
|
||||||
|
|
||||||
s.grid.NewButton("List Patchsets", func() {
|
/*
|
||||||
lines, err := listPatches()
|
s.grid.NewButton("Apply Latest Patchset", func() {
|
||||||
if err != nil {
|
lastp := lastPatch()
|
||||||
log.Info(err)
|
pset, err := getPatch(lastp)
|
||||||
return
|
if err != nil {
|
||||||
}
|
return
|
||||||
for i, line := range lines {
|
}
|
||||||
log.Info(i, line)
|
if _, _, _, err := IsEverythingOnDevel(); err != nil {
|
||||||
r.addPatchset(line)
|
log.Info("You can only apply patches to the devel branch")
|
||||||
}
|
return
|
||||||
})
|
}
|
||||||
|
if IsAnythingDirty() {
|
||||||
s.grid.NewButton("Apply Latest Patchset", func() {
|
log.Info("You can't apply patches when repos are dirty")
|
||||||
lastp := lastPatch()
|
me.forge.PrintHumanTable(me.found)
|
||||||
pset, err := getPatch(lastp)
|
return
|
||||||
if err != nil {
|
}
|
||||||
return
|
applyPatchset(pset)
|
||||||
}
|
})
|
||||||
if _, _, _, err := IsEverythingOnDevel(); err != nil {
|
*/
|
||||||
log.Info("You can only apply patches to the devel branch")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if IsAnythingDirty() {
|
|
||||||
log.Info("You can't apply patches when repos are dirty")
|
|
||||||
me.forge.PrintHumanTable(me.found)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
applyPatchset(pset)
|
|
||||||
})
|
|
||||||
|
|
||||||
// disable these until there are not dirty repos
|
// disable these until there are not dirty repos
|
||||||
// s.reason.Disable()
|
// s.reason.Disable()
|
||||||
|
|
Loading…
Reference in New Issue