diff options
| author | Jeff Carr <[email protected]> | 2025-02-15 07:17:35 -0600 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-15 07:28:42 -0600 | 
| commit | 8ad5e779311a5b7be1dd22ee92e582902ba33ed1 (patch) | |
| tree | 465c0072e2abfcffa6c4bc1ace69684c55ecdd27 | |
| parent | d3b6c1725d1657d20ba843e5f1323ab8019ea9d1 (diff) | |
show some more details in the tablev0.0.25
| -rw-r--r-- | doGui.go | 15 | ||||
| -rw-r--r-- | machine.go | 4 | ||||
| -rw-r--r-- | tableWindow.go | 12 | 
3 files changed, 17 insertions, 14 deletions
@@ -71,28 +71,25 @@ func drawWindow(win *gadgets.BasicWindow) {  	}) -	grid.NewButton("addTable", func() { -		if tbwin == nil { -			log.Info("show the table first") -			return -		} -		tbwin.showTable(me.machines) +	grid.NewButton("update table", func() { +		newwin := makeTableWindow() +		newwin.showTable(me.machines) +		newwin.Show()  	})  }  func (tw *tableWindow) showTable(allm *zoopb.Machines) { -  	all := allm.All()  	for all.Scan() {  		m := all.Next() -		tw.grid.NewLabel("hello") -  		tw.grid.NewLabel(m.Hostname)  		tw.grid.NewLabel(fmt.Sprintf("%d", m.Cpus))  		tw.grid.NewLabel(fmt.Sprintf("%d", m.Memory))  		tw.grid.NewLabel(m.Distro)  		tw.grid.NewLabel(findVersion(m, "zood"))  		tw.grid.NewLabel(findVersion(m, "bash")) +		dur := m.Laststamp.AsTime() +		tw.grid.NewLabel(fmt.Sprintf("%v", time.Since(dur)))  		tw.grid.NextRow()  	}  } @@ -1,8 +1,11 @@  package main  import ( +	"time" +  	"go.wit.com/lib/protobuf/zoopb"  	"go.wit.com/log" +	"google.golang.org/protobuf/types/known/timestamppb"  )  // someone sent machine 'u' is it new? @@ -41,6 +44,7 @@ func updateMachine(u *zoopb.Machine) string {  	if zood := m.Packages.FindByName("zood"); zood != nil {  		log.Log(INFO, m.Hostname, "has zood version", zood.Version)  	} +	m.Laststamp = timestamppb.New(time.Now())  	updatePackages(m, u.Packages)  	return "upgrade" diff --git a/tableWindow.go b/tableWindow.go index 17c7cfa..39e21b9 100644 --- a/tableWindow.go +++ b/tableWindow.go @@ -82,11 +82,13 @@ func makeTableWindow() *tableWindow {  	// make a grid to put the list of git repos that have patches  	// in this particular patchset  	pw.grid = g.NewGrid("", 0, 0) -	pw.grid.NewLabel("repo") -	pw.grid.NewLabel("patch name") -	pw.grid.NewLabel("Applied in current branch?") -	pw.grid.NewLabel("start hash") -	pw.grid.NewLabel("") +	pw.grid.NewLabel("hostname") +	pw.grid.NewLabel("cpus") +	pw.grid.NewLabel("Memory") +	pw.grid.NewLabel("distro") +	pw.grid.NewLabel("zood") +	pw.grid.NewLabel("bash") +	pw.grid.NewLabel("age")  	pw.grid.NextRow()  	// add the patches to the grid  | 
