(counts *status.ReplicaCounts)
| 22 | ) |
| 23 | |
| 24 | func replicaCountTable(counts *status.ReplicaCounts) table.Table { |
| 25 | var rows [][]interface{} |
| 26 | for _, replicaCountType := range status.ReplicaCountTypes { |
| 27 | count := counts.GetCountBy(replicaCountType) |
| 28 | canBeHiddenIfZero := false |
| 29 | switch replicaCountType { |
| 30 | case status.ReplicaCountFailed: |
| 31 | canBeHiddenIfZero = true |
| 32 | case status.ReplicaCountKilled: |
| 33 | canBeHiddenIfZero = true |
| 34 | case status.ReplicaCountKilledOOM: |
| 35 | canBeHiddenIfZero = true |
| 36 | case status.ReplicaCountErrImagePull: |
| 37 | canBeHiddenIfZero = true |
| 38 | case status.ReplicaCountUnknown: |
| 39 | canBeHiddenIfZero = true |
| 40 | case status.ReplicaCountStalled: |
| 41 | canBeHiddenIfZero = true |
| 42 | } |
| 43 | if count == 0 && canBeHiddenIfZero { |
| 44 | continue |
| 45 | } |
| 46 | rows = append(rows, []interface{}{ |
| 47 | replicaCountType, |
| 48 | count, |
| 49 | }) |
| 50 | } |
| 51 | |
| 52 | return table.Table{ |
| 53 | Headers: []table.Header{ |
| 54 | {Title: _titleReplicaStatus, MinWidth: 32, MaxWidth: 32}, |
| 55 | {Title: _titleReplicaCount}, |
| 56 | }, |
| 57 | Rows: rows, |
| 58 | } |
| 59 | } |
no test coverage detected