Skip to content

Commit b61d089

Browse files
committed
better connection progress ui for when adding a new host with c
1 parent 87efbdd commit b61d089

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

internal/ui.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ func (m Model) View() string {
327327
currentHost := m.selectedHosts[m.currentHostIdx]
328328

329329
if m.clients[currentHost.Name] == nil || m.sysInfos[currentHost.Name] == nil {
330-
return m.renderLoading(fmt.Sprintf("Loading %s...", currentHost.Name))
330+
return m.renderConnectingProgress()
331331
}
332332

333333
sysInfo := m.sysInfos[currentHost.Name]
@@ -339,7 +339,7 @@ func (m Model) View() string {
339339
}
340340
return renderDashboard(currentHost.Name+hostIndicator, sysInfo, m.updateInterval, lastUpdate, m.width, m.height, len(m.selectedHosts) > 1)
341341
}
342-
return m.renderLoading("Initializing...")
342+
return m.renderConnectingProgress()
343343

344344
case ScreenOverview:
345345
return m.renderOverview()
@@ -438,11 +438,6 @@ var (
438438
Bold(true).
439439
Foreground(lipgloss.Color("196")).
440440
Padding(1, 2)
441-
442-
boxStyle = lipgloss.NewStyle().
443-
Border(lipgloss.RoundedBorder()).
444-
BorderForeground(lipgloss.Color("63")).
445-
Padding(1, 2)
446441
)
447442

448443
func renderProgressBar(percent float64, width int, color lipgloss.Color) string {
@@ -465,17 +460,13 @@ func renderProgressBar(percent float64, width int, color lipgloss.Color) string
465460
return bar
466461
}
467462

468-
func (m Model) renderLoading(message string) string {
469-
return boxStyle.Render(fmt.Sprintf("%s %s", m.spinner.View(), message))
470-
}
471-
472463
func (m Model) renderConnectingProgress() string {
473464
var b strings.Builder
474465

475466
title := " System Dashboard - Connecting "
476467
connectedCount := len(m.clients)
477468
totalCount := len(m.selectedHosts)
478-
subtitle := fmt.Sprintf("Connecting to %d host(s) in parallel... (%d/%d ready)", totalCount, connectedCount, totalCount)
469+
subtitle := fmt.Sprintf("Connecting to %d host(s)... (%d/%d ready)", totalCount, connectedCount, totalCount)
479470

480471
b.WriteString(titleStyle.Render(title))
481472
b.WriteString("\n")

0 commit comments

Comments
 (0)