@@ -268,58 +268,43 @@ export default function RunningSessions(props) {
268268
269269 return (
270270 < div className = { classes . root } >
271- < Paper className = { classes . paper } >
272- < EnhancedTableToolbar title = { "Running" } />
273- < TableContainer >
274- < Table
275- className = { classes . table }
276- aria-labelledby = "tableTitle"
277- size = { dense ? 'small' : 'medium' }
278- aria-label = "enhanced table"
279- >
280- < EnhancedTableHead
281- classes = { classes }
282- order = { order }
283- orderBy = { orderBy }
284- onRequestSort = { handleRequestSort }
285- />
286- < TableBody >
287- { stableSort ( rows , getComparator ( order , orderBy ) )
288- . slice ( page * rowsPerPage , page * rowsPerPage + rowsPerPage )
289- . map ( ( row , index ) => {
290- const isItemSelected = isSelected ( row . id as string ) ;
291- const labelId = `enhanced-table-checkbox-${ index } ` ;
292- return (
293- < TableRow
294- hover
295- onClick = { ( event ) => handleClick ( event , row . id as string ) }
296- role = "checkbox"
297- aria-checked = { isItemSelected }
298- tabIndex = { - 1 }
299- key = { row . id }
300- selected = { isItemSelected }
301- >
302- < TableCell component = "th" id = { labelId } scope = "row" >
303- { row . id }
304- </ TableCell >
305- < TableCell align = "right" >
306- < img
307- src = { osLogo ( row . platformName as string ) }
308- className = { classes . logo }
309- alt = "OS Logo"
310- />
311- < img
312- src = { browserLogo ( row . browserName as string ) }
313- className = { classes . logo }
314- alt = "Browser Logo"
315- />
316- { browserVersion ( row . browserVersion as string ) }
317- < IconButton className = { classes . buttonMargin } onClick = { ( ) => handleDialogOpen ( row . id as string ) } >
318- < InfoIcon />
319- </ IconButton >
320- < Dialog onClose = { handleDialogClose } aria-labelledby = "session-info-dialog"
321- open = { rowOpen === row . id } >
322- < DialogTitle id = "session-info-dialog" >
271+ { rows . length > 0 && (
272+ < div >
273+ < Paper className = { classes . paper } >
274+ < EnhancedTableToolbar title = { "Running" } />
275+ < TableContainer >
276+ < Table
277+ className = { classes . table }
278+ aria-labelledby = "tableTitle"
279+ size = { dense ? 'small' : 'medium' }
280+ aria-label = "enhanced table"
281+ >
282+ < EnhancedTableHead
283+ classes = { classes }
284+ order = { order }
285+ orderBy = { orderBy }
286+ onRequestSort = { handleRequestSort }
287+ />
288+ < TableBody >
289+ { stableSort ( rows , getComparator ( order , orderBy ) )
290+ . slice ( page * rowsPerPage , page * rowsPerPage + rowsPerPage )
291+ . map ( ( row , index ) => {
292+ const isItemSelected = isSelected ( row . id as string ) ;
293+ const labelId = `enhanced-table-checkbox-${ index } ` ;
294+ return (
295+ < TableRow
296+ hover
297+ onClick = { ( event ) => handleClick ( event , row . id as string ) }
298+ role = "checkbox"
299+ aria-checked = { isItemSelected }
300+ tabIndex = { - 1 }
301+ key = { row . id }
302+ selected = { isItemSelected }
303+ >
304+ < TableCell component = "th" id = { labelId } scope = "row" >
305+ { row . id }
306+ </ TableCell >
307+ < TableCell align = "right" >
323308 < img
324309 src = { osLogo ( row . platformName as string ) }
325310 className = { classes . logo }
@@ -331,52 +316,72 @@ export default function RunningSessions(props) {
331316 alt = "Browser Logo"
332317 />
333318 { browserVersion ( row . browserVersion as string ) }
334- </ DialogTitle >
335- < DialogContent dividers >
336- < Typography gutterBottom >
337- Capabilities:
338- </ Typography >
339- < Typography gutterBottom component = { 'span' } >
319+ < IconButton className = { classes . buttonMargin }
320+ onClick = { ( ) => handleDialogOpen ( row . id as string ) } >
321+ < InfoIcon />
322+ </ IconButton >
323+ < Dialog onClose = { handleDialogClose } aria-labelledby = "session-info-dialog"
324+ open = { rowOpen === row . id } >
325+ < DialogTitle id = "session-info-dialog" >
326+ < img
327+ src = { osLogo ( row . platformName as string ) }
328+ className = { classes . logo }
329+ alt = "OS Logo"
330+ />
331+ < img
332+ src = { browserLogo ( row . browserName as string ) }
333+ className = { classes . logo }
334+ alt = "Browser Logo"
335+ />
336+ { browserVersion ( row . browserVersion as string ) }
337+ </ DialogTitle >
338+ < DialogContent dividers >
339+ < Typography gutterBottom >
340+ Capabilities:
341+ </ Typography >
342+ < Typography gutterBottom component = { 'span' } >
340343 < pre >
341344 { JSON . stringify ( JSON . parse ( row . rawCapabilities as string ) , null , 2 ) }
342345 </ pre >
343- </ Typography >
344- </ DialogContent >
345- < DialogActions >
346- < Button onClick = { handleDialogClose } color = "primary" variant = "outlined" >
347- Close
348- </ Button >
349- </ DialogActions >
350- </ Dialog >
351- </ TableCell >
352- < TableCell align = "right" > { row . startTime } </ TableCell >
353- < TableCell align = "right" > { row . sessionDurationMillis } </ TableCell >
354- < TableCell align = "right" > { row . nodeUri } </ TableCell >
346+ </ Typography >
347+ </ DialogContent >
348+ < DialogActions >
349+ < Button onClick = { handleDialogClose } color = "primary" variant = "outlined" >
350+ Close
351+ </ Button >
352+ </ DialogActions >
353+ </ Dialog >
354+ </ TableCell >
355+ < TableCell align = "right" > { row . startTime } </ TableCell >
356+ < TableCell align = "right" > { row . sessionDurationMillis } </ TableCell >
357+ < TableCell align = "right" > { row . nodeUri } </ TableCell >
358+ </ TableRow >
359+ ) ;
360+ } ) }
361+ { emptyRows > 0 && (
362+ < TableRow style = { { height : ( dense ? 33 : 53 ) * emptyRows } } >
363+ < TableCell colSpan = { 6 } />
355364 </ TableRow >
356- ) ;
357- } ) }
358- { emptyRows > 0 && (
359- < TableRow style = { { height : ( dense ? 33 : 53 ) * emptyRows } } >
360- < TableCell colSpan = { 6 } />
361- </ TableRow >
362- ) }
363- </ TableBody >
364- </ Table >
365- </ TableContainer >
366- < TablePagination
367- rowsPerPageOptions = { [ 5 , 10 , 15 ] }
368- component = "div"
369- count = { rows . length }
370- rowsPerPage = { rowsPerPage }
371- page = { page }
372- onChangePage = { handleChangePage }
373- onChangeRowsPerPage = { handleChangeRowsPerPage }
374- />
375- </ Paper >
376- < FormControlLabel
377- control = { < Switch checked = { dense } onChange = { handleChangeDense } /> }
378- label = "Dense padding"
379- />
365+ ) }
366+ </ TableBody >
367+ </ Table >
368+ </ TableContainer >
369+ < TablePagination
370+ rowsPerPageOptions = { [ 5 , 10 , 15 ] }
371+ component = "div"
372+ count = { rows . length }
373+ rowsPerPage = { rowsPerPage }
374+ page = { page }
375+ onChangePage = { handleChangePage }
376+ onChangeRowsPerPage = { handleChangeRowsPerPage }
377+ />
378+ </ Paper >
379+ < FormControlLabel
380+ control = { < Switch checked = { dense } onChange = { handleChangeDense } /> }
381+ label = "Dense padding"
382+ />
383+ </ div >
384+ ) }
380385 </ div >
381386 ) ;
382387}
0 commit comments