Skip to content

Commit

Permalink
Update datagrid tables with better displays and pagination (#682)
Browse files Browse the repository at this point in the history
  • Loading branch information
ameliav authored Oct 9, 2024
1 parent fa8f95b commit 7bfe865
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 33 deletions.
54 changes: 29 additions & 25 deletions frontend/src/components/Logs/Logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ export const Logs: FC<LogsProps> = () => {
}, [filters]);

return (
<Box>
<Paper elevation={2} sx={{ width: '100%' }}>
<Box display="flex">
<Paper elevation={2} sx={{ width: '100%', minHeight: '200px' }}>
<DataGrid
rows={logs.result}
columns={logCols}
Expand All @@ -175,31 +175,35 @@ export const Logs: FC<LogsProps> = () => {
onFilterModelChange={(model) => {
setFilters(model.items);
}}
initialState={{
pagination: { paginationModel: { pageSize: 15 } }
}}
pageSizeOptions={[15, 30, 50, 100]}
/>
<Dialog
open={openDialog}
onClose={() => setOpenDialog(false)}
scroll="paper"
fullWidth
maxWidth="lg"
>
<DialogTitle>Payload Details</DialogTitle>
<DialogContent>
<Box
sx={{
fontSize: '12px',
padding: 2,
margin: 0,
backgroundColor: 'black',
color: 'white',
width: '100%'
}}
>
<pre>{JSON.stringify(dialogDetails?.payload, null, 2)}</pre>
</Box>
</DialogContent>
</Dialog>
</Paper>
<Dialog
open={openDialog}
onClose={() => setOpenDialog(false)}
scroll="paper"
fullWidth
maxWidth="lg"
>
<DialogTitle>Payload Details</DialogTitle>
<DialogContent>
<Box
sx={{
fontSize: '12px',
padding: 2,
margin: 0,
backgroundColor: 'black',
color: 'white',
width: '100%'
}}
>
<pre>{JSON.stringify(dialogDetails?.payload, null, 2)}</pre>
</Box>
</DialogContent>
</Dialog>
</Box>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,18 @@ export const OrganizationList: React.FC<{

return (
<>
<Paper elevation={2} sx={{ width: '100%' }}>
<Paper elevation={2} sx={{ width: '100%', minHeight: '200px' }}>
<DataGrid
rows={organizations}
columns={orgCols}
slots={{ toolbar: CustomToolbar }}
slotProps={{
toolbar: { children: addOrgButton }
}}
initialState={{
pagination: { paginationModel: { pageSize: 15 } }
}}
pageSizeOptions={[15, 30, 50, 100]}
/>
</Paper>
<OrganizationForm
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Domains/Domains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export const Domains: React.FC = () => {
</Button>
</Stack>
) : isLoading === false && loadingError === false ? (
<Paper elevation={2} sx={{ width: '90%' }}>
<Paper elevation={2} sx={{ width: '90%', minHeight: '200px' }}>
<DataGrid
rows={domRows}
rowCount={totalResults}
Expand Down
12 changes: 8 additions & 4 deletions frontend/src/pages/Organization/OrgMembers.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useAuthContext } from 'context';
import { Organization as OrganizationType, Role } from 'types';
import { Alert, IconButton, Paper, Typography } from '@mui/material';
import { Alert, Box, IconButton, Paper, Typography } from '@mui/material';
import { DataGrid, GridColDef, GridRenderCellParams } from '@mui/x-data-grid';
import { CheckCircleOutline, RemoveCircleOutline } from '@mui/icons-material';
import CustomToolbar from 'components/DataGrid/CustomToolbar';
Expand Down Expand Up @@ -117,12 +117,16 @@ export const OrgMembers: React.FC<OrgMemberProps> = ({
};

return (
<React.Fragment>
<Paper elevation={0}>
<Box display="flex">
<Paper elevation={2} sx={{ width: '100%', minHeight: '200px' }}>
<DataGrid
rows={userRoles}
columns={userRoleColumns}
slots={{ toolbar: CustomToolbar }}
initialState={{
pagination: { paginationModel: { pageSize: 15 } }
}}
pageSizeOptions={[15, 30, 50, 100]}
/>
</Paper>
<ConfirmDialog
Expand Down Expand Up @@ -167,7 +171,7 @@ export const OrgMembers: React.FC<OrgMemberProps> = ({
</Typography>
}
/>
</React.Fragment>
</Box>
);
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Users/Users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export const Users: React.FC = () => {
</Button>
</Stack>
) : isLoading === false && loadingError === false ? (
<Paper elevation={2} sx={{ width: '100%' }}>
<Paper elevation={2} sx={{ width: '100%', minHeight: '200px' }}>
<DataGrid
rows={users}
columns={userCols}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Vulnerabilities/Vulnerabilities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ export const Vulnerabilities: React.FC<{ groupBy?: string }> = ({
</Button>
</Stack>
) : isLoading === false && loadingError === false ? (
<Paper elevation={2} sx={{ width: '90%' }}>
<Paper elevation={2} sx={{ width: '90%', minHeight: '200px' }}>
<DataGrid
rows={vulRows}
rowCount={totalResults}
Expand Down

0 comments on commit 7bfe865

Please sign in to comment.