@@ -189,11 +189,11 @@ class Top extends React.PureComponent<Props, State> {
189189 return M
190190 } , { } as Record < string , Omit < State [ "groups" ] [ number ] , "groupIdx" > > )
191191 )
192- . map ( ( group , groupIdx ) => Object . assign ( group , { groupIdx } ) )
193192 . sort ( this . sorter )
193+ . map ( ( group , groupIdx ) => Object . assign ( group , { groupIdx } ) )
194194 }
195195
196- private readonly sorter = ( a : Group , b : Group ) => {
196+ private readonly sorter = ( a : Omit < Group , "groupIdx" > , b : Omit < Group , "groupIdx" > ) => {
197197 return (
198198 a . stats . tot . cpu + a . stats . tot . mem + a . stats . tot . gpu - ( b . stats . tot . cpu + b . stats . tot . mem + b . stats . tot . gpu ) ||
199199 a . job . name . localeCompare ( b . job . name )
@@ -314,19 +314,23 @@ class Top extends React.PureComponent<Props, State> {
314314 ? {
315315 inverse : true ,
316316 }
317- : { }
317+ : this . hasSelection
318+ ? { dimColor : true }
319+ : { bold : true }
318320
319321 return (
320322 < Box key = { group . job . name } flexDirection = "column" borderStyle = { isSelected ? "bold" : "single" } >
321323 < Box >
322324 < 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 >
326326 </ Box >
327327 < Box justifyContent = "flex-end" marginLeft = { 2 } >
328328 < 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+ }
330334 </ Text >
331335 </ Box >
332336 </ Box >
@@ -352,11 +356,7 @@ class Top extends React.PureComponent<Props, State> {
352356 } else if ( this . state . groups . length === 0 ) {
353357 return < Text > No active jobs</ Text >
354358 } 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 >
360360 }
361361 }
362362}
0 commit comments