mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 09:41:57 +00:00
render: In minor labels, display '0 things' instead of blank if zero things present
This also fixes a bug where k8s controller nodes would show up as 'Deployment of' without any number
This commit is contained in:
@@ -344,13 +344,14 @@ func groupNodeSummary(base NodeSummary, r report.Report, n report.Node) (NodeSum
|
||||
}
|
||||
|
||||
func pluralize(counters report.Counters, key, singular, plural string) string {
|
||||
if c, ok := counters.Lookup(key); ok {
|
||||
if c == 1 {
|
||||
return fmt.Sprintf("%d %s", c, singular)
|
||||
}
|
||||
return fmt.Sprintf("%d %s", c, plural)
|
||||
c, ok := counters.Lookup(key)
|
||||
if !ok {
|
||||
c = 0
|
||||
}
|
||||
return ""
|
||||
if c == 1 {
|
||||
return fmt.Sprintf("%d %s", c, singular)
|
||||
}
|
||||
return fmt.Sprintf("%d %s", c, plural)
|
||||
}
|
||||
|
||||
type nodeSummariesByID []NodeSummary
|
||||
|
||||
Reference in New Issue
Block a user