diff --git a/infoTabUI.go b/infoTabUI.go index 2357681..3c02c28 100644 --- a/infoTabUI.go +++ b/infoTabUI.go @@ -154,33 +154,6 @@ func setupCloudUI() { cloudwin.Show() } -func addVmsTab() { - var parts []gui.InputData - - for key, foo := range []string{"BG", "TEXTCOLOR", "TEXT", "BUTTON"} { - log.Println(key, foo) - - var b gui.InputData - b.CellType = foo - b.Heading = fmt.Sprintf("heading%d", key) - parts = append(parts, b) - } - - var b gui.InputData - b.CellType = "TEXTCOLOR" - b.Heading = fmt.Sprintf("cpus") - parts = append(parts, b) - - var c gui.InputData - c.CellType = "TEXTCOLOR" - c.Heading = fmt.Sprintf("memory") - parts = append(parts, c) - - // log.Println("Sleep for 2 seconds, then try to add new tabs") - // time.Sleep(1 * 1000 * 1000 * 1000) - gui.AddTableTab(cloudtab, 1, "Virtual Machines", 7, parts) -} - func addTableTab() { var parts []gui.InputData @@ -214,3 +187,61 @@ func addProtobufTab() { time.Sleep(1 * 1000 * 1000 * 1000) gui.AddTableTab(cloudtab, 1, "test seven", 7, parts) } + +type aheader struct { + headtype string + name string +} + +func addVmsTab() { + var parts []gui.InputData + + var headers []aheader + + tmp := aheader{} + tmp.headtype = "BG" + tmp.name = "background" + headers = append(headers, tmp) + + tmp = aheader{} + tmp.headtype = "TEXTCOLOR" + tmp.name = "cpus" + headers = append(headers, tmp) + + tmp = aheader{} + tmp.headtype = "TEXTCOLOR" + tmp.name = "name" + headers = append(headers, tmp) + + tmp = aheader{} + tmp.headtype = "TEXTCOLOR" + tmp.name = "hostname" + headers = append(headers, tmp) + + tmp = aheader{} + tmp.headtype = "TEXTCOLOR" + tmp.name = "IPv6" + headers = append(headers, tmp) + + tmp = aheader{} + tmp.headtype = "TEXTCOLOR" + tmp.name = "memory" + headers = append(headers, tmp) + + tmp = aheader{} + tmp.headtype = "BUTTON" + tmp.name = "Details" + headers = append(headers, tmp) + + for i, key := range headers { + log.Println("header = ", i, key) + log.Println("headtype, name = ", key.headtype, key.name) + + var b gui.InputData + b.CellType = key.headtype + b.Heading = key.name + parts = append(parts, b) + } + + gui.AddTableTab(cloudtab, 1, "Virtual Machines", 7, parts) +}