Download this file
| 1 | package console |
| 2 | |
| 3 | import ( |
| 4 | "strconv" |
| 5 | "strings" |
| 6 | ) |
| 7 | |
| 8 | // StatusCopy is filled only with language approved through the repository's |
| 9 | // copy-review gate. Keeping the structural status work independent lets its |
| 10 | // state transitions and tests land without smuggling draft prose into the UI. |
| 11 | type StatusCopy struct { |
| 12 | ObservedLabel string |
| 13 | ReportingCount string |
| 14 | Mixed string |
| 15 | NoInstances string |
| 16 | NoVersion string |
| 17 | Partial string |
| 18 | Next string |
| 19 | } |
| 20 | |
| 21 | var approvedStatusCopy = StatusCopy{ |
| 22 | ObservedLabel: "Observed versions", |
| 23 | ReportingCount: "{reported} of {total} instances report a version.", |
| 24 | Mixed: "Multiple versions", |
| 25 | NoInstances: "No instances yet.", |
| 26 | NoVersion: "No instances have reported a version yet.", |
| 27 | Partial: "Some instances have not reported a version.", |
| 28 | Next: "Candidate for promotion: {version}.", |
| 29 | } |
| 30 | |
| 31 | func (d DeploymentStatus) ReportingText() string { |
| 32 | return strings.NewReplacer( |
| 33 | "{reported}", strconv.Itoa(d.ReportedCount), |
| 34 | "{total}", strconv.Itoa(d.ReportableCount), |
| 35 | ).Replace(approvedStatusCopy.ReportingCount) |
| 36 | } |
| 37 | |
| 38 | func (s ReleaseSummary) CandidateText() string { |
| 39 | return strings.ReplaceAll(approvedStatusCopy.Next, "{version}", s.NextVersion) |
| 40 | } |
| 41 | |