func()

in pkg/model/uimodel.go [60:85]


func (u *UIModel) View() string {
	b := strings.Builder{}

	stats := u.cluster.Stats()
	if stats.NumNodes == 0 {
		return "Waiting for update or no nodes found..."
	}

	ctw := text.NewColorTabWriter(&b, 0, 8, 1)
	u.writeClusterSummary(u.cluster.resources, stats, ctw)
	ctw.Flush()
	u.progress.ShowPercentage = true

	fmt.Fprintf(&b, "%d pods (%d pending %d running %d bound)\n", stats.TotalPods,
		stats.PodsByPhase[v1.PodPending], stats.PodsByPhase[v1.PodRunning], stats.BoundPodCount)

	fmt.Fprintln(&b)
	for _, n := range stats.Nodes {
		u.writeNodeInfo(n, ctw, u.cluster.resources)
	}
	ctw.Flush()

	fmt.Fprintln(&b, helpStyle("Press any key to refresh"))
	fmt.Fprintln(&b, helpStyle("Press q to quit"))
	return b.String()
}