Skip to content

Commit c6e78d8

Browse files
authoredOct 15, 2024··
[grid] UI Sessions view sort Duration in ascending by default (#14599)
1 parent a75cd4b commit c6e78d8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

Diff for: ‎javascript/grid-ui/src/components/RunningSessions/RunningSessions.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ import LiveView from '../LiveView/LiveView'
5252
import SessionData, { createSessionData } from '../../models/session-data'
5353

5454
function descendingComparator<T> (a: T, b: T, orderBy: keyof T): number {
55+
if (orderBy === 'sessionDurationMillis') {
56+
return Number(b[orderBy]) - Number(a[orderBy])
57+
}
5558
if (b[orderBy] < a[orderBy]) {
5659
return -1
5760
}
@@ -94,7 +97,7 @@ const headCells: HeadCell[] = [
9497
{ id: 'id', numeric: false, label: 'Session' },
9598
{ id: 'capabilities', numeric: false, label: 'Capabilities' },
9699
{ id: 'startTime', numeric: false, label: 'Start time' },
97-
{ id: 'sessionDurationMillis', numeric: false, label: 'Duration' },
100+
{ id: 'sessionDurationMillis', numeric: true, label: 'Duration' },
98101
{ id: 'nodeUri', numeric: false, label: 'Node URI' }
99102
]
100103

@@ -170,7 +173,7 @@ function RunningSessions (props) {
170173
const [rowOpen, setRowOpen] = useState('')
171174
const [rowLiveViewOpen, setRowLiveViewOpen] = useState('')
172175
const [order, setOrder] = useState<Order>('asc')
173-
const [orderBy, setOrderBy] = useState<keyof SessionData>('startTime')
176+
const [orderBy, setOrderBy] = useState<keyof SessionData>('sessionDurationMillis')
174177
const [selected, setSelected] = useState<string[]>([])
175178
const [page, setPage] = useState(0)
176179
const [dense, setDense] = useState(false)

0 commit comments

Comments
 (0)
Please sign in to comment.