Skip to content

Commit

Permalink
[grid] UI Sessions view sort Duration in asc by default
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Oct 14, 2024
1 parent c7daf73 commit ae1a741
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ import LiveView from '../LiveView/LiveView'
import SessionData, { createSessionData } from '../../models/session-data'

function descendingComparator<T> (a: T, b: T, orderBy: keyof T): number {
if (orderBy === 'sessionDurationMillis') {
return Number(b[orderBy]) - Number(a[orderBy])
}
if (b[orderBy] < a[orderBy]) {
return -1
}
Expand Down Expand Up @@ -94,7 +97,7 @@ const headCells: HeadCell[] = [
{ id: 'id', numeric: false, label: 'Session' },
{ id: 'capabilities', numeric: false, label: 'Capabilities' },
{ id: 'startTime', numeric: false, label: 'Start time' },
{ id: 'sessionDurationMillis', numeric: false, label: 'Duration' },
{ id: 'sessionDurationMillis', numeric: true, label: 'Duration' },
{ id: 'nodeUri', numeric: false, label: 'Node URI' }
]

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

0 comments on commit ae1a741

Please sign in to comment.