app: move routable columnin to a group label
@@ -767,10 +767,15 @@ func renderUnits(buf *bytes.Buffer, units []unit, metrics []unitMetrics, provisi
type unitsKey struct {
process string
version int
+ routable bool
}
groupedUnits := map[unitsKey][]unit{}
for _, u := range units {
- key := unitsKey{process: u.ProcessName, version: u.Version}
+ routable := false
+ if u.Routable != nil {
+ routable = *u.Routable
+ }
+ key := unitsKey{process: u.ProcessName, version: u.Version, routable: routable}
groupedUnits[key] = append(groupedUnits[key], u)
}
keys := make([]unitsKey, 0, len(groupedUnits))
@@ -783,10 +788,6 @@ func renderUnits(buf *bytes.Buffer, units []unit, metrics []unitMetrics, provisi
}
return keys[i].version < keys[j].version
})
- includeRoutable := false
- if len(units) > 0 {
- includeRoutable = units[0].Routable != nil
- }
var titles []string
if provisioner == "kubernetes" {
@@ -799,9 +800,6 @@ func renderUnits(buf *bytes.Buffer, units []unit, metrics []unitMetrics, provisi
mapUnitMetrics[unitMetric.ID] = unitMetric
}
- if includeRoutable {
- titles = append(titles, "Routable")
- }
for _, key := range keys {
units := groupedUnits[key]
unitsTable := tablecli.NewTable()
@@ -834,9 +832,6 @@ func renderUnits(buf *bytes.Buffer, units []unit, metrics []unitMetrics, provisi
}
}
- if includeRoutable {
- row = append(row, checkedChar(unit.Routable))
- }
unitsTable.AddRow(row)
}
if unitsTable.Rows() > 0 {
@@ -849,6 +844,9 @@ func renderUnits(buf *bytes.Buffer, units []unit, metrics []unitMetrics, provisi
if key.version != 0 {
groupLabel = fmt.Sprintf("%s [version %d]", groupLabel, key.version)
}
+ if key.routable {
+ groupLabel = fmt.Sprintf("%s [routable]", groupLabel)
+ }
buf.WriteString(fmt.Sprintf("Units%s: %d\n", groupLabel, unitsTable.Rows()))
buf.WriteString(unitsTable.String())
}
