@@ -189,11 +189,11 @@ class Top extends React.PureComponent<Props, State> {
189
189
return M
190
190
} , { } as Record < string , Omit < State [ "groups" ] [ number ] , "groupIdx" > > )
191
191
)
192
- . map ( ( group , groupIdx ) => Object . assign ( group , { groupIdx } ) )
193
192
. sort ( this . sorter )
193
+ . map ( ( group , groupIdx ) => Object . assign ( group , { groupIdx } ) )
194
194
}
195
195
196
- private readonly sorter = ( a : Group , b : Group ) => {
196
+ private readonly sorter = ( a : Omit < Group , "groupIdx" > , b : Omit < Group , "groupIdx" > ) => {
197
197
return (
198
198
a . stats . tot . cpu + a . stats . tot . mem + a . stats . tot . gpu - ( b . stats . tot . cpu + b . stats . tot . mem + b . stats . tot . gpu ) ||
199
199
a . job . name . localeCompare ( b . job . name )
@@ -314,19 +314,23 @@ class Top extends React.PureComponent<Props, State> {
314
314
? {
315
315
inverse : true ,
316
316
}
317
- : { }
317
+ : this . hasSelection
318
+ ? { dimColor : true }
319
+ : { bold : true }
318
320
319
321
return (
320
322
< Box key = { group . job . name } flexDirection = "column" borderStyle = { isSelected ? "bold" : "single" } >
321
323
< Box >
322
324
< Box flexGrow = { 1 } >
323
- < Text bold { ...titleStyle } >
324
- { group . job . name }
325
- </ Text >
325
+ < Text { ...titleStyle } > { group . job . name . slice ( 0 , 34 ) + ( group . job . name . length > 34 ? "…" : "" ) } </ Text >
326
326
</ Box >
327
327
< Box justifyContent = "flex-end" marginLeft = { 2 } >
328
328
< Text color = "cyan" >
329
- { prettyMillis ( Date . now ( ) - group . ctime , { unitCount : 2 , secondsDecimalDigits : 0 } ) }
329
+ {
330
+ prettyMillis ( Date . now ( ) - group . ctime , { unitCount : 2 , secondsDecimalDigits : 0 } ) . padEnd (
331
+ 7
332
+ ) /* 'XXm YYs'.length */
333
+ }
330
334
</ Text >
331
335
</ Box >
332
336
</ Box >
@@ -352,11 +356,7 @@ class Top extends React.PureComponent<Props, State> {
352
356
} else if ( this . state . groups . length === 0 ) {
353
357
return < Text > No active jobs</ Text >
354
358
} else {
355
- return (
356
- < Box flexWrap = "wrap" gap = { 1 } >
357
- { this . state . groups . map ( ( _ , idx ) => this . group ( _ , idx ) ) }
358
- </ Box >
359
- )
359
+ return < Box flexWrap = "wrap" > { this . state . groups . map ( ( _ , idx ) => this . group ( _ , idx ) ) } </ Box >
360
360
}
361
361
}
362
362
}
0 commit comments