2019-05-28 19:00:56 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
import "image/color"
|
|
|
|
import "runtime"
|
|
|
|
|
|
|
|
import pb "git.wit.com/wit/witProtobuf"
|
|
|
|
import "git.wit.com/wit/gui"
|
|
|
|
|
|
|
|
var windowsTextVeryLightGrey = color.RGBA{10, 10, 10, 10}
|
2019-06-21 12:31:37 -05:00
|
|
|
var windowsTextBlack = color.RGBA{0, 0, 0, 255}
|
2019-05-28 19:00:56 -05:00
|
|
|
var windowsTextWhite = color.RGBA{255, 255, 255, 255}
|
|
|
|
var windowsTextYellow = color.RGBA{200, 200, 0, 200}
|
|
|
|
var windowsTextRed = color.RGBA{200, 0, 0, 200}
|
|
|
|
var windowsTextBlue = color.RGBA{0, 100, 200, 100}
|
|
|
|
var windowsBgGrey = color.RGBA{100, 100, 100, 142}
|
|
|
|
var windowsBgBlack = color.RGBA{55, 55, 55, 255}
|
|
|
|
|
|
|
|
var linuxTextBlue = color.RGBA{0, 100, 200, 100}
|
2019-06-21 16:33:34 -05:00
|
|
|
var linuxTextBlack = color.RGBA{0, 0, 0, 255}
|
2019-05-28 19:00:56 -05:00
|
|
|
var linuxTextYellow = color.RGBA{200, 200, 0, 200}
|
|
|
|
var linuxBgMauve = color.RGBA{72, 0, 0, 142}
|
|
|
|
var linuxBgBlack = color.RGBA{55, 55, 55, 255}
|
|
|
|
var linuxBgWhite = color.RGBA{0, 0, 0, 0}
|
2019-05-28 19:34:21 -05:00
|
|
|
var linuxBgYellow = color.RGBA{255, 255, 0, 255}
|
2019-05-28 19:00:56 -05:00
|
|
|
|
|
|
|
func setRowValues(mh *gui.TableData, row int, vm *pb.Event_VM) {
|
2019-06-21 16:33:34 -05:00
|
|
|
defaultTextColor := linuxTextBlack
|
|
|
|
defaultTextYellow := linuxTextBlack
|
2019-05-28 19:00:56 -05:00
|
|
|
defaultTextBlack := linuxTextBlack
|
|
|
|
|
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
defaultTextColor = windowsTextRed
|
|
|
|
defaultTextBlack = windowsTextBlack
|
|
|
|
}
|
2019-06-21 16:33:34 -05:00
|
|
|
if (row % 2) == 1 {
|
|
|
|
mh.Rows[row].HumanData[0].Color = color.RGBA{200, 200, 200, 100} // odd columns are light grey
|
|
|
|
} else {
|
|
|
|
mh.Rows[row].HumanData[0].Color = color.RGBA{255, 255, 255, 255} // white
|
|
|
|
}
|
|
|
|
/*if (row == 1) {
|
2019-05-28 19:00:56 -05:00
|
|
|
mh.Rows[row].HumanData[0].Color = color.RGBA{100, 100, 100, 142} // makes the background of each other row grey
|
|
|
|
} else if (row == 2) {
|
|
|
|
mh.Rows[row].HumanData[0].Color = color.RGBA{0, 0, 0, 0} // makes the background of each other row grey
|
|
|
|
} else if (row == 3) {
|
|
|
|
mh.Rows[row].HumanData[0].Color = color.RGBA{255, 255, 255, 255} // makes the background of each other row grey
|
|
|
|
} else if (row == 4) {
|
|
|
|
mh.Rows[row].HumanData[0].Color = color.RGBA{255, 255, 255, 0} // makes the background of each other row grey
|
|
|
|
} else if (row == 5) {
|
|
|
|
mh.Rows[row].HumanData[0].Color = color.RGBA{55, 55, 55, 255} // makes the background of each other row grey
|
2019-05-28 19:34:21 -05:00
|
|
|
} else if (row == 6) {
|
|
|
|
mh.Rows[row].HumanData[0].Color = linuxBgYellow
|
2019-05-28 19:00:56 -05:00
|
|
|
} else if (row < 10) {
|
|
|
|
mh.Rows[row].HumanData[0].Color = linuxBgMauve
|
|
|
|
} else {
|
|
|
|
mh.Rows[row].HumanData[0].Color = color.RGBA{250, 250, 250, 250}
|
2019-06-21 16:33:34 -05:00
|
|
|
}*/
|
2019-05-28 19:00:56 -05:00
|
|
|
mh.Rows[row].HumanData[1].Text = vm.Name
|
|
|
|
mh.Rows[row].HumanData[1].Color = defaultTextColor
|
|
|
|
mh.Rows[row].HumanData[2].Text = vm.Hostname
|
|
|
|
mh.Rows[row].HumanData[2].Color = defaultTextYellow
|
|
|
|
mh.Rows[row].HumanData[3].Text = fmt.Sprintf("%d",vm.Cpus)
|
|
|
|
mh.Rows[row].HumanData[3].Color = defaultTextColor
|
|
|
|
mh.Rows[row].HumanData[4].Text = fmt.Sprintf("%d",vm.Memory)
|
|
|
|
mh.Rows[row].HumanData[4].Color = defaultTextBlack
|
|
|
|
mh.Rows[row].HumanData[5].Text = fmt.Sprintf("%d",vm.Disk)
|
|
|
|
mh.Rows[row].HumanData[5].Color = defaultTextBlack
|
|
|
|
mh.Rows[row].HumanData[6].Text = fmt.Sprintf("Details %s",vm.Name)
|
|
|
|
}
|