fix patches stats
This commit is contained in:
parent
1b145d1f04
commit
3870959747
|
@ -4,6 +4,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
|
@ -30,7 +31,7 @@ func (w *stdPatchTableWin) Toggle() {
|
||||||
w.win.Toggle()
|
w.win.Toggle()
|
||||||
}
|
}
|
||||||
|
|
||||||
func makePatchesWin(p *forgepb.Patches) *stdPatchTableWin {
|
func makePatchesWin(patches *forgepb.Patches) *stdPatchTableWin {
|
||||||
dwin := new(stdPatchTableWin)
|
dwin := new(stdPatchTableWin)
|
||||||
dwin.win = gadgets.NewGenericWindow("current patches", "patching options")
|
dwin.win = gadgets.NewGenericWindow("current patches", "patching options")
|
||||||
dwin.win.Custom = func() {
|
dwin.win.Custom = func() {
|
||||||
|
@ -39,16 +40,18 @@ func makePatchesWin(p *forgepb.Patches) *stdPatchTableWin {
|
||||||
}
|
}
|
||||||
grid := dwin.win.Group.RawGrid()
|
grid := dwin.win.Group.RawGrid()
|
||||||
|
|
||||||
grid.NewLabel(fmt.Sprintf("%d", p.Len())
|
grid.NewLabel(fmt.Sprintf("%d", patches.Len()))
|
||||||
grid.NewLabel(fmt.Sprintf("total patches")
|
grid.NewLabel(fmt.Sprintf("total patches"))
|
||||||
grid.NextRow()
|
grid.NextRow()
|
||||||
|
|
||||||
all := p.All()
|
repomap := make(map[string]int)
|
||||||
|
all := patches.All()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
patch := all.Next()
|
||||||
|
repomap[patch.RepoNamespace] += 1
|
||||||
}
|
}
|
||||||
grid.NewLabel(fmt.Sprintf("%d", p.Len())
|
grid.NewLabel(fmt.Sprintf("%d", len(repomap)))
|
||||||
grid.NewLabel(fmt.Sprintf("total repos")
|
grid.NewLabel(fmt.Sprintf("total repos"))
|
||||||
grid.NextRow()
|
grid.NextRow()
|
||||||
|
|
||||||
grid.NewButton("reload", func() {
|
grid.NewButton("reload", func() {
|
||||||
|
@ -57,8 +60,8 @@ func makePatchesWin(p *forgepb.Patches) *stdPatchTableWin {
|
||||||
// make a box at the bottom of the window for the protobuf table
|
// make a box at the bottom of the window for the protobuf table
|
||||||
dwin.box = dwin.win.Bottom.Box().SetProgName("TBOX")
|
dwin.box = dwin.win.Bottom.Box().SetProgName("TBOX")
|
||||||
|
|
||||||
if p != nil {
|
if patches != nil {
|
||||||
dwin.doPatchesTable(p)
|
dwin.doPatchesTable(patches)
|
||||||
}
|
}
|
||||||
|
|
||||||
return dwin
|
return dwin
|
||||||
|
|
Loading…
Reference in New Issue