remove splash screen and confirm model

This commit is contained in:
Adem Baccara
2025-09-04 23:59:04 +01:00
parent c1e31290ac
commit f05f70e937
3 changed files with 7 additions and 129 deletions
+5 -33
View File
@@ -169,7 +169,11 @@ func (t *tui) handleSearchToggle() {
func (t *tui) handleServerConnect() {
if server, ok := t.serverList.GetSelectedServer(); ok {
t.showConnectModal(server)
t.app.Suspend(func() {
_ = t.serverService.SSH(server.Alias)
})
t.refreshServerList()
}
}
@@ -298,38 +302,6 @@ func (t *tui) showSearchBar() {
t.searchVisible = true
}
func (t *tui) showConnectModal(server domain.Server) {
msg := fmt.Sprintf("SSH to %s (%s@%s:%d)\n\nConfirm to start an SSH session .",
server.Alias, server.User, server.Host, server.Port)
modal := tview.NewModal().
SetText(msg).
AddButtons([]string{"Confirm", "Cancel"}).
SetDoneFunc(func(buttonIndex int, buttonLabel string) {
if buttonIndex == 0 {
// Suspend the TUI while running the external ssh command.
t.app.Suspend(func() {
err := t.serverService.SSH(server.Alias)
if err != nil {
// Show a brief status after we resume
t.app.QueueUpdateDraw(func() {
if strings.Contains(strings.ToLower(err.Error()), "timeout") {
t.showStatusTempColor("SSH timeout, returning to list", "#FF6B6B")
} else {
t.showStatusTempColor("SSH failed: "+err.Error(), "#FF6B6B")
}
})
}
})
// Refresh to reflect updated last seen and ssh count
t.refreshServerList()
}
t.handleModalClose()
})
t.app.SetRoot(modal, true)
}
func (t *tui) showDeleteConfirmModal(server domain.Server) {
msg := fmt.Sprintf("Delete server %s (%s@%s:%d)?\n\nThis action cannot be undone.",
server.Alias, server.User, server.Host, server.Port)