package zoopb import ( "go.wit.com/gui" "go.wit.com/lib/protobuf/guipb" "go.wit.com/log" ) func (x *Machines) NewTable(title string) *MachinesTable { t := new(MachinesTable) // t.gt = gui.NewTable(title) t.x = x pb := new(guipb.Table) pb.Title = title // pb.Order = append(pb.Order, "Hostname") pb.Order = append(pb.Order, "Memory") // pb.Order = append(pb.Order, "Cpus") t.pb = pb return t } func (t *MachinesTable) AddHostname() { log.Info("zoopb: GOT TO AddHostname()") t.pb.Order = append(t.pb.Order, "Hostname") t.pb.Order = append(t.pb.Order, "Cpus") r := new(guipb.StringRow) r.Header = "Hostname" all := t.x.All() for all.Scan() { m := all.Next() r.Vals = append(r.Vals, m.Hostname) log.Info("zoopb: adding hostname", r.Vals) } t.pb.StringRows = append(t.pb.StringRows, r) i := new(guipb.IntRow) r.Header = "Cpus" all = t.x.All() for all.Scan() { m := all.Next() i.Vals = append(i.Vals, m.Cpus) log.Info("zoopb: adding cpus", i.Vals) } t.pb.IntRows = append(t.pb.IntRows, i) } func (mt *MachinesTable) ShowTable() { log.Info("zoopb.ShowTable() SENDING TO GUI") gui.ShowTable(mt.pb) } type MachinesTable struct { // gt *gui.NodeTable pb *guipb.Table x *Machines hostnames []string // columns []*gui.NodeColumn // order []*gui.NodeColumn } /* type RepoTableRow struct { nodes []*gui.Node } type repoTableFullPath struct { } func (x *repoTableFullPath) Add(s string) { } func (x *RepoTable) FullPath() *RepoTableFullPath { } func (x *RepoTable) AddFullPath() { x.order = append(x.order, x.n.AddStringFunc( f() string { return t.x.getRepoFullPath(rx *RepoTableRow) })) return *RepoTableRow } func (x *RepoTable) Show() { x.order.f() ZZ } func (x *RepoTable) AddMasterVersion() { all := x.x.SortByFullPath() for all.Scan() { repo := all.Next() for x.order return *RepoTableRow } func (x *RepoTable) NewColumn() *RepoRow { t := new(RepoTableRow) return *RepoTableRow } */