preliminary table

This commit is contained in:
Jeff Carr 2025-02-15 06:44:25 -06:00
parent 875da60adb
commit d3b6c1725d
2 changed files with 18 additions and 1 deletions

View File

@ -6,6 +6,7 @@ package main
// An app to submit patches for the 30 GO GUI repos
import (
"fmt"
"os"
"time"
@ -58,6 +59,7 @@ func drawWindow(win *gadgets.BasicWindow) {
if tbwin == nil {
log.Info("show zoo here")
tbwin = makeTableWindow()
tbwin.showTable(me.machines)
}
if tbwin.Hidden() {
@ -86,6 +88,19 @@ func (tw *tableWindow) showTable(allm *zoopb.Machines) {
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"))
tw.grid.NextRow()
}
}
func findVersion(m *zoopb.Machine, pkgname string) string {
zood := m.Packages.FindByName(pkgname)
if zood == nil {
return "n/a"
}
return zood.Version
}

View File

@ -6,6 +6,7 @@ import (
"net/http"
"strings"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/zoopb"
"go.wit.com/log"
)
@ -39,7 +40,8 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
var m *zoopb.Machine
m = new(zoopb.Machine)
if err := m.Unmarshal(msg); err != nil {
log.Info("proto.Unmarshal() failed on wire message len", len(msg))
log.Info("zoo host sent unknown machine protobuf len", len(msg))
forgepb.IdentifyProtobuf(msg)
log.Info("error =", err)
return
}