different tables with different numbers of rows

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-06 14:22:40 -07:00
parent 229b470935
commit 42f722fada
1 changed files with 13 additions and 5 deletions

View File

@ -7,8 +7,6 @@ import "log"
import "github.com/andlabs/ui"
import "github.com/davecgh/go-spew/spew"
const rows int = 20
type vmRowData struct {
hostname string
size int
@ -20,13 +18,19 @@ type vmRowData struct {
type modelHandler struct {
name string
rows int
yellowRow int
checkStates [rows]int
vms [rows]vmRowData
checkStates []int
vms []vmRowData
tests []int
}
func newDefaultModelHandler() *modelHandler {
mh := new(modelHandler)
mh.rows = 20
mh.checkStates = make([]int, mh.rows)
mh.tests = make([]int, mh.rows)
mh.vms = make([]vmRowData, mh.rows)
mh.vms[8].hostname = "fire"
mh.vms[9].hostname = "librem15.this.is.a.really.long.string.test"
mh.yellowRow = -1
@ -37,6 +41,10 @@ func newDefaultModelHandler() *modelHandler {
func newJcarrModelHandler() *modelHandler {
mh := new(modelHandler)
mh.rows = 10
mh.checkStates = make([]int, mh.rows)
mh.tests = make([]int, mh.rows)
mh.vms = make([]vmRowData, mh.rows)
mh.vms[8].hostname = "jcarr"
mh.vms[9].hostname = "jcarr2"
mh.yellowRow = -1
@ -70,7 +78,7 @@ func (mh *modelHandler) ColumnTypes(m *ui.TableModel) []ui.TableValue {
func (mh *modelHandler) NumRows(m *ui.TableModel) int {
// log.Println("NumRows() with m=", m)
return rows
return mh.rows
}
var img [2]*ui.Image