in ui.go [51:90]
func DisplayNodeTable(nodes map[string]cluster.Node) {
columns := []table.Column{
{Title: "Name", Width: 55},
{Title: "Type", Width: 15},
{Title: "Region", Width: 20},
{Title: "Accelerator", Width: 25},
{Title: "Spot?", Width: 10},
}
var rows []table.Row
for _, node := range nodes {
rows = append(rows, table.Row{node.Name, node.InstanceType, node.Region, node.Accelerator, strconv.FormatBool(node.Spot)})
}
tbl := table.New(
table.WithColumns(columns),
table.WithRows(rows),
table.WithFocused(false),
table.WithHeight(len(rows)),
)
stl := table.DefaultStyles()
stl.Header = stl.Header.
BorderStyle(lipgloss.NormalBorder()).
BorderForeground(lipgloss.Color("255")).
BorderBottom(true).
Bold(false)
stl.Selected = stl.Selected.
Foreground(lipgloss.Color("255")).
// Background(lipgloss.Color("57")).
Bold(false)
tbl.SetStyles(stl)
program := tea.NewProgram(tableModel{tbl})
_, err := program.Run()
if err != nil {
fmt.Printf("Error: %v\n", err)
os.Exit(1)
}
}