AnubisLMS/Anubis

ADD column to superuser playground table for if docker is enabled

wabscale opened this issue · 1 comments

Add column for new docker row column with mui icon to indicate if it is on or off.

Column definitions here:

const useColumns = (state, enqueueSnackbar) => ([
{field: 'netid', headerName: 'Netid'},
{field: 'name', headerName: 'Name', width: 300},
{field: 'state', headerName: 'State', width: 200},
{field: 'image', headerName: 'Image', width: 150, valueGetter: (params) => params.value.title},
{field: 'image_tag', headerName: 'Tag', width: 150, valueGetter: (params) => params.value?.title ?? 'latest'},
{field: 'created', headerName: 'Created', type: 'dateTime', width: 170},
{field: 'created_delta', headerName: 'Age', width: 170},
{field: 'last_proxy_delta', headerName: 'Last Ping', width: 170},
{
field: 'redirect_url', headerName: 'Go To IDE', width: 120, renderCell: ({row}) => (
<React.Fragment>
{row.state === 'Running' && (
<Button
style={{
buttonSuccess: {
'backgroundColor': green[500],
'&:hover': {
backgroundColor: green[700],
},
},
}}
variant={'contained'}
color={'primary'}
component={'a'}
href={row.redirect_url}
target={'_blank'}
>
Go To IDE
</Button>
)}
</React.Fragment>
),
},
{
field: 'kill', headerName: 'Kill Session', width: 150, renderCell: ({row}) => (
<Button
variant={'contained'}
color={'error'}
size={'small'}
startIcon={<DeleteForeverIcon/>}
onClick={stopSession(row.id, state, enqueueSnackbar)}
>
Kill Session
</Button>
),
},
]);

Hi @wabscale, created a PR for this, please review #449.

Thanks!