summaryrefslogtreecommitdiff
path: root/table.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-23 12:59:19 -0600
committerJeff Carr <[email protected]>2025-02-23 13:13:30 -0600
commit4046e33a6399141636678a54be0902f573c3a300 (patch)
tree296232721165a9c0a98a8ef01503315202cc92d5 /table.go
parent344b3ab1d1dd1f44699e4d2858b7fc16d277703e (diff)
times kinda updatev0.22.18
Diffstat (limited to 'table.go')
-rw-r--r--table.go42
1 files changed, 35 insertions, 7 deletions
diff --git a/table.go b/table.go
index a8cf488..c790946 100644
--- a/table.go
+++ b/table.go
@@ -42,9 +42,9 @@ func (me *TreeInfo) doTable(a widget.Action) {
// }
// dumpTable(t)
// me.ShowTable(t)
- log.Info("TREE FOUND TABLE UUID", t.Uuid)
+ // log.Info("TREE FOUND TABLE UUID", t.Uuid)
for i, ot := range me.currentTables {
- log.Info("TREE already has UUID", i, ot.Uuid)
+ // log.Info("TREE already has UUID", i, ot.Uuid)
if t.Uuid == ot.Uuid {
log.Info("TREE found UUID! update table here", i, ot.Uuid)
me.updateTable(t)
@@ -102,11 +102,12 @@ func (me *TreeInfo) updateTable(t *guipb.Table) {
func (me *TreeInfo) updateRow(t *guipb.Table, name string) {
for _, r := range t.StringRows {
if name == r.Header.Name {
- id := r.Header.Id
- n := treeRoot.FindWidgetId(int(id))
- if n == nil {
- log.Info("could not find widget id", id)
- }
+ // debugging code
+ // id := r.Header.Id
+ // n := treeRoot.FindWidgetId(int(id))
+ // if n == nil {
+ // log.Info("could not find widget id", id)
+ // }
// log.Info("tree.updateRow() start found header", id, r.Header, "len =", len(r.Widgets))
// if r.Header.Name == "Hostname" {
// }
@@ -127,6 +128,33 @@ func (me *TreeInfo) updateRow(t *guipb.Table, name string) {
return
}
}
+
+ for _, r := range t.TimeRows {
+ if name != r.Header.Name {
+ continue
+ }
+ for i, _ := range r.Vals {
+ // log.Info("tree: Hostname Widget", i, v, w.Name)
+ w := r.Widgets[i]
+ n := treeRoot.FindWidgetId(int(w.Id))
+ if n == nil {
+ log.Info("tree.TableUpdate() err n == nil ", w.Id, w.Name)
+ continue
+ }
+ msg, err := anypb.UnmarshalNew(w.Val, proto.UnmarshalOptions{})
+ if err != nil {
+ log.Fatalf("failed to unmarshal: %v", err)
+ }
+
+ switch v := msg.(type) {
+ case *timestamppb.Timestamp:
+ me.SetText(n, shell.FormatDuration(time.Since(v.AsTime())))
+ default:
+ me.SetText(n, fmt.Sprintf("%v", v))
+ }
+ }
+ return
+ }
}
func (me *TreeInfo) makeTable(t *guipb.Table) {