Skip to content

Commit

Permalink
show pending pod count even if no nodes are present
Browse files Browse the repository at this point in the history
  • Loading branch information
tzneal committed Jul 20, 2023
1 parent 230fe4d commit 9b5e12e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/model/uimodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ func (u *UIModel) View() string {
b := strings.Builder{}

stats := u.cluster.Stats()
if stats.NumNodes == 0 {
fmt.Fprintln(&b, "Waiting for update or no nodes found...")
fmt.Fprintln(&b, u.paginator.View())
fmt.Fprintln(&b, helpStyle("←/→ page • q: quit"))

return b.String()
}

ctw := text.NewColorTabWriter(&b, 0, 8, 1)
u.writeClusterSummary(u.cluster.resources, stats, ctw)
Expand All @@ -93,6 +86,14 @@ func (u *UIModel) View() string {
fmt.Fprintf(&b, "%d pods (%d pending %d running %d bound)\n", stats.TotalPods,
stats.PodsByPhase[v1.PodPending], stats.PodsByPhase[v1.PodRunning], stats.BoundPodCount)

if stats.NumNodes == 0 {
fmt.Fprintln(&b)
fmt.Fprintln(&b, "Waiting for update or no nodes found...")
fmt.Fprintln(&b, u.paginator.View())
fmt.Fprintln(&b, helpStyle("←/→ page • q: quit"))
return b.String()
}

fmt.Fprintln(&b)
u.paginator.PerPage = u.computeItemsPerPage(stats.Nodes, &b)
u.paginator.SetTotalPages(stats.NumNodes)
Expand Down

0 comments on commit 9b5e12e

Please sign in to comment.