NewTasksList creates a new tasks list panel.
()
| 63 | |
| 64 | // NewTasksList creates a new tasks list panel. |
| 65 | func NewTasksList() *TasksList { |
| 66 | activeTable := tview.NewTable() |
| 67 | activeTable.SetBorders(false) |
| 68 | activeTable.SetBorder(true) |
| 69 | activeTable.SetSelectable(true, false) |
| 70 | activeTable.SetFixed(1, 0) |
| 71 | activeTable.SetSelectedStyle(tcell.StyleDefault.Background(theme.Colors.Selection).Foreground(theme.Colors.Primary).Attributes(tcell.AttrReverse)) |
| 72 | |
| 73 | historyTable := tview.NewTable() |
| 74 | historyTable.SetBorders(false) |
| 75 | historyTable.SetTitle(" Task History ") |
| 76 | historyTable.SetBorder(true) |
| 77 | historyTable.SetSelectable(true, false) |
| 78 | historyTable.SetFixed(1, 0) |
| 79 | historyTable.SetSelectedStyle(tcell.StyleDefault.Background(theme.Colors.Selection).Foreground(theme.Colors.Primary).Attributes(tcell.AttrReverse)) |
| 80 | |
| 81 | flex := tview.NewFlex().SetDirection(tview.FlexRow) |
| 82 | |
| 83 | tl := &TasksList{ |
| 84 | Flex: flex, |
| 85 | activeTable: activeTable, |
| 86 | historyTable: historyTable, |
| 87 | showActive: true, |
| 88 | tasks: make([]*api.ClusterTask, 0), |
| 89 | } |
| 90 | |
| 91 | tl.updateActiveTableTitle() |
| 92 | tl.setupKeyHandlers() |
| 93 | tl.syncLayout() |
| 94 | |
| 95 | return tl |
| 96 | } |
| 97 | |
| 98 | // SetApp sets the application reference. |
| 99 | func (tl *TasksList) SetApp(app *App) { |
no test coverage detected