Skip to content

Commit 9a76acc

Browse files
committed
fix: improve grid legend 'mem' -> 'Memory'
1 parent f315efc commit 9a76acc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: plugins/plugin-codeflare-dashboard/src/controller/dashboard/utilization.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import stripAnsi from "strip-ansi"
1818
import type { TextProps } from "ink"
1919

20+
import type Kind from "./kinds.js"
2021
import type { Tail } from "./tailf.js"
2122
import type Options from "./options.js"
2223
import { isValidTheme, themes } from "./themes/utilization.js"
@@ -183,8 +184,14 @@ class Demo {
183184
}
184185
}
185186

187+
/** foo => Foo; fOO => Foo; FOO => Foo */
186188
function capitalize(str: string) {
187-
return str[0].toUpperCase() + str.slice(1)
189+
return str[0].toUpperCase() + str.slice(1).toLowerCase()
190+
}
191+
192+
/** Displayed variant of `Kind` */
193+
function titleFor(kind: Kind) {
194+
return capitalize(kind).replace(/(.*)mem/i, (_, p1) => p1 + (!p1 ? "" : " ") + "Memory")
188195
}
189196

190197
export default function utilizationDashboard(
@@ -214,5 +221,5 @@ export default function utilizationDashboard(
214221
}
215222

216223
const styledStates = states.map((state) => ({ state, style: styleOf[state] }))
217-
return { title: capitalize(kind), initWatcher, states: styledStates }
224+
return { title: titleFor(kind), initWatcher, states: styledStates }
218225
}

0 commit comments

Comments
 (0)