summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-16 10:55:47 -0500
committerJeff Carr <[email protected]>2025-09-16 10:55:47 -0500
commitb644b03769fb78bdef07612985317e3233d4e7a6 (patch)
tree8f4b6f3041b40dbd47e9b2589a160a06ca896963
parent2b61abf765e19536a1830e6bc6bc0475d348e67a (diff)
working on fixing andlabs.so
-rw-r--r--table.go63
1 files changed, 61 insertions, 2 deletions
diff --git a/table.go b/table.go
index d1f7f71..63647c0 100644
--- a/table.go
+++ b/table.go
@@ -123,7 +123,7 @@ func (me *TreeInfo) updateTable(t *guipb.Table) {
if me.addTableCol(t, grid, name, w) {
// log.Info("tree:row() COLUMN GOOD", t.Title, name, w, h)
} else {
- log.Info("tree:row() COLOMN FAIL", t.Title, name, w, h)
+ log.Info("tree:row() COLUMN FAIL", t.Title, name, w, h)
}
w += 1
@@ -218,7 +218,7 @@ func (me *TreeInfo) makeTable(t *guipb.Table) {
if me.addTableCol(t, grid, name, w) {
// log.Info("tree:row() COLUMN GOOD", t.Title, name, w, h)
} else {
- log.Log(TREEWARN, "tree:row() COLOMN FAIL", t.Title, name, w, h)
+ log.Log(TREEWARN, "tree:row() COLUMN FAIL", t.Title, name, w, h)
}
w += 1
@@ -318,6 +318,65 @@ func (me *TreeInfo) addTableCol(t *guipb.Table, grid *Node, name string, w int)
return true
}
+ for _, r := range t.AnyCols {
+ if name != r.Header.Name {
+ // log.Info("skip sint row:", r.Header.Name, "!=", name)
+ continue
+ }
+ // log.Info("tree: Add()ing to grid here", r.Header.Id, r.Header.Name, w, h)
+ head := grid.makeGridLabel(r.Header, w, h)
+ me.Add(head)
+ h += 1
+ for _, widg := range r.Widgets {
+ msg, err := anypb.UnmarshalNew(widg.Val, proto.UnmarshalOptions{})
+ if err != nil {
+ log.Fatalf("failed to unmarshal: %v", err)
+ }
+ /*
+ var stringValue wrapperspb.StringValue
+ if err := msg.UnmarshalTo(&stringValue); err == nil {
+ // It's a string, now convert it back to a native Go string
+ goString := stringValue.GetValue()
+ fmt.Printf("Successfully unpacked string: %s\n", goString)
+ }
+ */
+
+ switch v := msg.(type) {
+ // case *protobuf.StringValue:
+ // widg.Name = fmt.Sprintf("stringval %v", v)
+ case *timestamppb.Timestamp:
+ // fmt.Println("Unpacked Timestamp:", shell.FormatDuration(time.Since(v.AsTime())))
+ widg.Name = shell.FormatDuration(time.Since(v.AsTime()))
+ case *wrapperspb.StringValue:
+ /*
+ var stringValue wrapperspb.StringValue
+ if err := widg.Val.UnmarshalTo(&stringValue); err == nil {
+ // It's a string, now convert it back to a native Go string
+ goString := stringValue.GetValue()
+ fmt.Printf("Successfully unpacked string: %s\n", goString)
+ widg.Name = goString
+ } else {
+ widg.Name = "notsure"
+ }
+ */
+ widg.Name = v.GetValue()
+ case *anypb.Any:
+ fmt.Printf("found any! %T\n", v)
+ // widg.Name = v.GetValue()
+ default:
+ fmt.Printf("Unknown type: %T\n", v)
+ // fmt.Println("Unknown type:", v)
+ widg.Name = fmt.Sprintf("%v", v)
+ }
+
+ // log.Info("tree: Add()ing to grid here", widg.Id, widg.Name, w, h)
+ lab := grid.makeGridLabel(widg, w, h)
+ me.Add(lab)
+ h += 1
+ }
+ return true
+ }
+
return false
}