insert PB table seems to work
This commit is contained in:
parent
2098040d62
commit
aa229b8778
35
doGui.go
35
doGui.go
|
@ -354,41 +354,6 @@ func makeStandardReposWindow(title string, pb *gitpb.Repos) (*gitpb.ReposTable,
|
||||||
return t, box
|
return t, box
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeWritableWindow(pb *gitpb.Repos) (*gadgets.GenericWindow, *gitpb.ReposTable) {
|
|
||||||
win := gadgets.NewGenericWindow("Repos You have write access to", "Configure")
|
|
||||||
t := pb.NewTable("testForgeRepos")
|
|
||||||
t.NewUuid()
|
|
||||||
|
|
||||||
grid := win.Group.RawGrid()
|
|
||||||
grid.NewButton("git pull", func() {
|
|
||||||
log.Info("todo: run git pull on each repo")
|
|
||||||
})
|
|
||||||
|
|
||||||
grid.NewButton("do repos.ReScan()", func() {
|
|
||||||
t.Update()
|
|
||||||
})
|
|
||||||
|
|
||||||
tbox := win.Bottom.Box()
|
|
||||||
t.SetParent(tbox)
|
|
||||||
|
|
||||||
sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string {
|
|
||||||
return r.GetGoPath()
|
|
||||||
})
|
|
||||||
sf.Custom = func(r *gitpb.Repo) {
|
|
||||||
log.Info("do button click on", r.GetGoPath())
|
|
||||||
}
|
|
||||||
t.AddTimeFunc("age", func(repo *gitpb.Repo) time.Time {
|
|
||||||
return repo.NewestTime()
|
|
||||||
})
|
|
||||||
t.AddMasterVersion()
|
|
||||||
t.AddDevelVersion()
|
|
||||||
t.AddUserVersion()
|
|
||||||
t.AddCurrentBranchName()
|
|
||||||
t.AddState()
|
|
||||||
t.ShowTable()
|
|
||||||
return win, t
|
|
||||||
}
|
|
||||||
|
|
||||||
func findMergeToDevel() *gitpb.Repos {
|
func findMergeToDevel() *gitpb.Repos {
|
||||||
found := gitpb.NewRepos()
|
found := gitpb.NewRepos()
|
||||||
|
|
||||||
|
|
100
windowRepos.go
100
windowRepos.go
|
@ -8,6 +8,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
|
@ -81,6 +82,40 @@ func makeReposWin() *gadgets.GenericWindow {
|
||||||
makeStandardReposWindow("All repos", me.found)
|
makeStandardReposWindow("All repos", me.found)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var insertWin *gadgets.GenericWindow
|
||||||
|
me.repoWritableB = grid.NewButton("insert test", func() {
|
||||||
|
// if the window exists, just toggle it open or closed
|
||||||
|
if insertWin != nil {
|
||||||
|
insertWin.Toggle()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
insertWin = makeWindowForPB()
|
||||||
|
insertWin.Win.Custom = func() {
|
||||||
|
log.Info("test delete window here")
|
||||||
|
}
|
||||||
|
grid := insertWin.Group.RawGrid()
|
||||||
|
grid.NewButton("do something", func() {
|
||||||
|
log.Info("do something on each pb row")
|
||||||
|
})
|
||||||
|
grid.NewButton("attempt to insert table", func() {
|
||||||
|
// make the window for the first time
|
||||||
|
found := new(gitpb.Repos)
|
||||||
|
all := me.forge.Repos.SortByFullPath()
|
||||||
|
for all.Scan() {
|
||||||
|
repo := all.Next()
|
||||||
|
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
found.AppendByGoPath(repo)
|
||||||
|
|
||||||
|
}
|
||||||
|
t := addWindowPB(insertWin, found)
|
||||||
|
log.Info("table has uuid", t.GetUuid())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
grid.NewButton("Configure", func() {
|
grid.NewButton("Configure", func() {
|
||||||
log.Info("add a forge config window here")
|
log.Info("add a forge config window here")
|
||||||
})
|
})
|
||||||
|
@ -277,3 +312,68 @@ func masterRemoteProblem() *gitpb.Repos {
|
||||||
}
|
}
|
||||||
return found
|
return found
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func makeWritableWindow(pb *gitpb.Repos) (*gadgets.GenericWindow, *gitpb.ReposTable) {
|
||||||
|
win := gadgets.NewGenericWindow("Repos You have write access to", "Configure")
|
||||||
|
t := pb.NewTable("testForgeRepos")
|
||||||
|
t.NewUuid()
|
||||||
|
|
||||||
|
grid := win.Group.RawGrid()
|
||||||
|
grid.NewButton("git pull", func() {
|
||||||
|
log.Info("todo: run git pull on each repo")
|
||||||
|
})
|
||||||
|
|
||||||
|
grid.NewButton("do repos.ReScan()", func() {
|
||||||
|
t.Update()
|
||||||
|
})
|
||||||
|
|
||||||
|
tbox := win.Bottom.Box()
|
||||||
|
t.SetParent(tbox)
|
||||||
|
|
||||||
|
sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string {
|
||||||
|
return r.GetGoPath()
|
||||||
|
})
|
||||||
|
sf.Custom = func(r *gitpb.Repo) {
|
||||||
|
log.Info("do button click on", r.GetGoPath())
|
||||||
|
}
|
||||||
|
t.AddTimeFunc("age", func(repo *gitpb.Repo) time.Time {
|
||||||
|
return repo.NewestTime()
|
||||||
|
})
|
||||||
|
t.AddMasterVersion()
|
||||||
|
t.AddDevelVersion()
|
||||||
|
t.AddUserVersion()
|
||||||
|
t.AddCurrentBranchName()
|
||||||
|
t.AddState()
|
||||||
|
t.ShowTable()
|
||||||
|
return win, t
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeWindowForPB() *gadgets.GenericWindow {
|
||||||
|
win := gadgets.NewGenericWindow("Raw PB View", "Configure")
|
||||||
|
|
||||||
|
return win
|
||||||
|
}
|
||||||
|
|
||||||
|
func addWindowPB(win *gadgets.GenericWindow, pb *gitpb.Repos) *gitpb.ReposTable {
|
||||||
|
t := pb.NewTable("testForgeRepos")
|
||||||
|
t.NewUuid()
|
||||||
|
tbox := win.Bottom.Box()
|
||||||
|
t.SetParent(tbox)
|
||||||
|
|
||||||
|
sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string {
|
||||||
|
return r.GetGoPath()
|
||||||
|
})
|
||||||
|
sf.Custom = func(r *gitpb.Repo) {
|
||||||
|
log.Info("do button click on", r.GetGoPath())
|
||||||
|
}
|
||||||
|
t.AddTimeFunc("age", func(repo *gitpb.Repo) time.Time {
|
||||||
|
return repo.NewestTime()
|
||||||
|
})
|
||||||
|
t.AddMasterVersion()
|
||||||
|
t.AddDevelVersion()
|
||||||
|
t.AddUserVersion()
|
||||||
|
t.AddCurrentBranchName()
|
||||||
|
t.AddState()
|
||||||
|
t.ShowTable()
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue