summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-19 02:48:37 -0600
committerJeff Carr <[email protected]>2025-02-19 17:39:45 -0600
commit2a277c147a7593640fc79192d6ae987ec3e4fea0 (patch)
treeaddeaf268f7004d0980b89cbb3f723903548a7f2
parent27c9417a32cb704537037aacc727e53ff933b5f3 (diff)
string rows
-rw-r--r--action.go26
-rw-r--r--table.go66
2 files changed, 66 insertions, 26 deletions
diff --git a/action.go b/action.go
index 896e5d0..19cbb87 100644
--- a/action.go
+++ b/action.go
@@ -10,32 +10,6 @@ import (
"go.wit.com/widget"
)
-// repeated string order = 1;
-//
-// repeated StringRow StringRows = 2;
-// repeated IntRow IntRows = 3;
-// repeated TimeRow TimeRows = 4;
-// repeated BoolRow BoolRows = 5;
-func (me *TreeInfo) doTable(a widget.Action) {
- if a.TablePB == nil {
- log.Log(TREE, "tree: action didn't have a Table PB")
- return
- }
- pb := guipb.NewTables()
- if err := pb.Unmarshal(a.TablePB); err != nil {
- log.Info("unmarshal error", err, "data len =", len(a.TablePB))
- return
- }
- log.Info("dumpTables:")
- all := pb.All()
- for all.Scan() {
- t := all.Next()
- for i, o := range t.Order {
- log.Info("got order:", t.Title, i, o)
- }
- }
-}
-
// everything from the application goes through here
func (me *TreeInfo) doAction(a widget.Action) {
if a.TablePB != nil {
diff --git a/table.go b/table.go
new file mode 100644
index 0000000..1a950ad
--- /dev/null
+++ b/table.go
@@ -0,0 +1,66 @@
+// Although most code from WIT.COM Inc is under the GPL
+// This code is more generic because it must be able
+// to be used in any GUI plugin
+
+package tree
+
+import (
+ "go.wit.com/lib/protobuf/guipb"
+ "go.wit.com/log"
+ "go.wit.com/widget"
+)
+
+// repeated string order = 1;
+//
+// repeated StringRow StringRows = 2;
+// repeated IntRow IntRows = 3;
+// repeated TimeRow TimeRows = 4;
+// repeated BoolRow BoolRows = 5;
+func (me *TreeInfo) doTable(a widget.Action) {
+ if a.TablePB == nil {
+ log.Log(TREE, "tree: action didn't have a Table PB")
+ return
+ }
+ pb := guipb.NewTables()
+ if err := pb.Unmarshal(a.TablePB); err != nil {
+ log.Info("unmarshal error", err, "data len =", len(a.TablePB))
+ return
+ }
+ log.Info("dumpTables:")
+ all := pb.All()
+ for all.Scan() {
+ t := all.Next()
+ for i, o := range t.Order {
+ log.Info("got order:", t.Title, i, o)
+ }
+ me.ShowTable(t)
+ dumpTable(t)
+ }
+}
+
+func dumpTable(t *guipb.Table) {
+ for i, o := range t.Order {
+ log.Info("got order:", t.Title, i, o)
+ }
+ for i, r := range t.StringRows {
+ log.Info("got string row:", t.Title, i, r.Header, r.Vals)
+ for _, v := range r.WidgetS {
+ log.Info("tree: got string widget:", v.Id, v.Name)
+ }
+ }
+ for i, r := range t.IntRows {
+ log.Info("got int row:", t.Title, i, r.Header, r.Vals)
+ for _, v := range r.Widgets {
+ log.Info("tree: got int widget:", v.Id, v.Name)
+ }
+ }
+}
+
+type TreeTable struct {
+ PB *guipb.Table
+ /*
+ hostnames []string
+ columns []*gui.NodeColumn
+ order []*gui.NodeColumn
+ */
+}