Skip to content

Commit c9b874f

Browse files
authored
feat(ui): remove splash screen and confirm ssh modal (#23)
1 parent c1e3129 commit c9b874f

File tree

3 files changed

+7
-129
lines changed

3 files changed

+7
-129
lines changed

internal/adapters/ui/handlers.go

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,11 @@ func (t *tui) handleSearchToggle() {
169169

170170
func (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\nConfirm 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-
333305
func (t *tui) showDeleteConfirmModal(server domain.Server) {
334306
msg := fmt.Sprintf("Delete server %s (%s@%s:%d)?\n\nThis action cannot be undone.",
335307
server.Alias, server.User, server.Host, server.Port)

internal/adapters/ui/splash.go

Lines changed: 0 additions & 81 deletions
This file was deleted.

internal/adapters/ui/tui.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
package ui
1616

1717
import (
18-
"time"
19-
2018
"github.com/gdamore/tcell/v2"
2119
"go.uber.org/zap"
2220

@@ -65,7 +63,8 @@ func (t *tui) Run() error {
6563
}
6664
}()
6765
t.app.EnableMouse(true)
68-
t.initializeTheme().buildComponents().buildLayout().bindEvents().loadInitialData().loadSplashScreen()
66+
t.initializeTheme().buildComponents().buildLayout().bindEvents().loadInitialData()
67+
t.app.SetRoot(t.root, true)
6968
t.logger.Infow("starting TUI application", "version", t.version, "commit", t.commit)
7069
if err := t.app.Run(); err != nil {
7170
t.logger.Errorw("application run error", "error", err)
@@ -141,15 +140,3 @@ func (t *tui) updateListTitle() {
141140
t.serverList.SetTitle("Servers — Sort: " + t.sortMode.String())
142141
}
143142
}
144-
145-
func (t *tui) loadSplashScreen() *tui {
146-
splash, stop := buildSplash(t.app)
147-
t.app.SetRoot(splash, true)
148-
time.AfterFunc(SplashScreenDuration, func() {
149-
stop()
150-
t.app.QueueUpdateDraw(func() {
151-
t.app.SetRoot(t.root, true)
152-
})
153-
})
154-
return t
155-
}

0 commit comments

Comments
 (0)