@@ -24,6 +24,8 @@ type TUI struct {
2424 table table.Table
2525
2626 showDebuggableContainers bool
27+
28+ gcvalues * command.GenericParams
2729}
2830
2931// Styles - move to `common`
@@ -58,11 +60,12 @@ func LoadTUI() *TUI {
5860}
5961
6062// InitialTUI returns the initial state of the model.
61- func InitialTUI (standalone bool ) * TUI {
63+ func InitialTUI (standalone bool , gcvalues * command. GenericParams ) * TUI {
6264 m := & TUI {
6365 standalone : standalone ,
6466 width : 20 ,
6567 height : 15 ,
68+ gcvalues : gcvalues ,
6669 }
6770
6871 return m
@@ -156,6 +159,7 @@ func (m TUI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
156159 }()
157160
158161 <- doneCh
162+ m .showDebuggableContainers = ! m .showDebuggableContainers
159163 return m , nil
160164 case tea.KeyMsg :
161165 switch {
@@ -166,6 +170,17 @@ func (m TUI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
166170 case key .Matches (msg , keys .Global .Back ):
167171 return common .TUIsInstance .Home , nil
168172 case key .Matches (msg , keys .Debug .LoadDebuggableContainers ):
173+ // Kickoff loading of debuggable containers in standable.
174+ if m .standalone {
175+ loadDebuggableContainers := common.Event {
176+ Type : common .LaunchDebugEvent ,
177+ Data : m .gcvalues ,
178+ }
179+ m , _ := m .Update (loadDebuggableContainers )
180+ return m , nil
181+ }
182+
183+ // When used via `tui -> debug`
169184 m .showDebuggableContainers = ! m .showDebuggableContainers
170185 return m , nil
171186
@@ -215,12 +230,13 @@ func (m TUI) View() string {
215230 // 4. Connect to a debug session
216231 // 5. Start a new debug session
217232
218- content := "Debug View "
233+ content := "Debug Dashboard \n "
219234
220235 components = append (components , content )
221236
222237 if m .showDebuggableContainers {
223- components = append (components , m .table .String ())
238+ header := "Debuggable Containers\n "
239+ components = append (components , header , m .table .String ())
224240 }
225241
226242 components = append (components , m .help ())
@@ -231,8 +247,17 @@ func (m TUI) View() string {
231247}
232248
233249func (m TUI ) help () string {
250+ var listOrHide string
251+
252+ if m .showDebuggableContainers {
253+ listOrHide = "hide"
254+ } else {
255+ listOrHide = "list"
256+ }
257+
234258 if m .standalone {
235- return common .HelpStyle ("• l list debuggable containers • q: quit" )
259+ return common .HelpStyle ("• l: " + listOrHide + " debuggable containers • q: quit" )
236260 }
237- return common .HelpStyle ("• l list debuggable containers • esc: back • q: quit" )
261+
262+ return common .HelpStyle ("• l: " + listOrHide + " debuggable containers • esc: back • q: quit" )
238263}
0 commit comments