@@ -169,7 +169,11 @@ func (t *tui) handleSearchToggle() {
169169
170170func (t * tui ) handleServerConnect () {
171171 if server , ok := t .serverList .GetSelectedServer (); ok {
172- t .showConnectModal (server )
172+
173+ t .app .Suspend (func () {
174+ _ = t .serverService .SSH (server .Alias )
175+ })
176+ t .refreshServerList ()
173177 }
174178}
175179
@@ -298,38 +302,6 @@ func (t *tui) showSearchBar() {
298302 t .searchVisible = true
299303}
300304
301- func (t * tui ) showConnectModal (server domain.Server ) {
302- msg := fmt .Sprintf ("SSH to %s (%s@%s:%d)\n \n Confirm to start an SSH session ." ,
303- server .Alias , server .User , server .Host , server .Port )
304-
305- modal := tview .NewModal ().
306- SetText (msg ).
307- AddButtons ([]string {"Confirm" , "Cancel" }).
308- SetDoneFunc (func (buttonIndex int , buttonLabel string ) {
309- if buttonIndex == 0 {
310- // Suspend the TUI while running the external ssh command.
311- t .app .Suspend (func () {
312- err := t .serverService .SSH (server .Alias )
313- if err != nil {
314- // Show a brief status after we resume
315- t .app .QueueUpdateDraw (func () {
316- if strings .Contains (strings .ToLower (err .Error ()), "timeout" ) {
317- t .showStatusTempColor ("SSH timeout, returning to list" , "#FF6B6B" )
318- } else {
319- t .showStatusTempColor ("SSH failed: " + err .Error (), "#FF6B6B" )
320- }
321- })
322- }
323- })
324- // Refresh to reflect updated last seen and ssh count
325- t .refreshServerList ()
326- }
327- t .handleModalClose ()
328- })
329-
330- t .app .SetRoot (modal , true )
331- }
332-
333305func (t * tui ) showDeleteConfirmModal (server domain.Server ) {
334306 msg := fmt .Sprintf ("Delete server %s (%s@%s:%d)?\n \n This action cannot be undone." ,
335307 server .Alias , server .User , server .Host , server .Port )
0 commit comments