File tree 1 file changed +9
-2
lines changed
plugins/plugin-codeflare-dashboard/src/controller/dashboard
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 17
17
import stripAnsi from "strip-ansi"
18
18
import type { TextProps } from "ink"
19
19
20
+ import type Kind from "./kinds.js"
20
21
import type { Tail } from "./tailf.js"
21
22
import type Options from "./options.js"
22
23
import { isValidTheme , themes } from "./themes/utilization.js"
@@ -183,8 +184,14 @@ class Demo {
183
184
}
184
185
}
185
186
187
+ /** foo => Foo; fOO => Foo; FOO => Foo */
186
188
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 ( / ( .* ) m e m / i, ( _ , p1 ) => p1 + ( ! p1 ? "" : " " ) + "Memory" )
188
195
}
189
196
190
197
export default function utilizationDashboard (
@@ -214,5 +221,5 @@ export default function utilizationDashboard(
214
221
}
215
222
216
223
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 }
218
225
}
You can’t perform that action at this time.
0 commit comments