11import TableSortLabel from '@material-ui/core/TableSortLabel' ;
22
3+ import withDialogProps from '../../hoc/withDialogProps' ;
4+ import CodeModal from '../ui/CodeModal' ;
35import Table from '../ui/Table' ;
46import TableActions from '../ui/TableActions' ;
57import TableBody from '../ui/TableBody' ;
@@ -11,7 +13,9 @@ import TableRow from '../ui/TableRow';
1113
1214import AuditLogRow from './AuditLogRow' ;
1315
14- export default function AuditLogTable ( {
16+ const AUDIT_BODY_MODAL = 'AUDIT_BODY_MODAL' ;
17+
18+ function AuditLogTable ( {
1519 auditLogDocument,
1620 count = 0 ,
1721 page = 0 ,
@@ -20,52 +24,62 @@ export default function AuditLogTable({
2024 onChangeRowsPerPage,
2125 onChangeOrder,
2226 orderDirection,
27+ dialogProps,
28+ onOpen,
2329} ) {
2430 const { entry : entryList = [ ] } = auditLogDocument ;
2531 const rowsPerPageOptions = [ 100 , 250 , 500 ] ;
2632 if ( ! rowsPerPageOptions . includes ( rowsPerPage ) ) {
2733 rowsPerPageOptions . push ( rowsPerPage ) ;
2834 }
2935 return (
30- < Table >
31- < TableHead >
32- < TableRow >
33- < TableCell >
34- < TableSortLabel
35- active = { orderDirection !== undefined }
36- direction = { orderDirection }
37- onClick = { onChangeOrder }
38- >
39- Timestamp
40- </ TableSortLabel >
41- </ TableCell >
42- < TableCell > username</ TableCell >
43- < TableCell > Method</ TableCell >
44- < TableCell > Path</ TableCell >
45- < TableCell > Query Parameters</ TableCell >
46- </ TableRow >
47- </ TableHead >
48- < TableBody >
49- { entryList . map ( ( entry , index ) => (
50- < AuditLogRow
51- key = { index } // eslint-disable-line react/no-array-index-key
52- entry = { entry }
53- />
54- ) ) }
55- </ TableBody >
56- < TableFooter >
57- < TableRow >
58- < TablePagination
59- count = { count }
60- page = { page }
61- rowsPerPage = { rowsPerPage }
62- onPageChange = { onChangePage }
63- onRowsPerPageChange = { onChangeRowsPerPage }
64- ActionsComponent = { TableActions }
65- rowsPerPageOptions = { rowsPerPageOptions }
66- />
67- </ TableRow >
68- </ TableFooter >
69- </ Table >
36+ < >
37+ < Table >
38+ < TableHead >
39+ < TableRow >
40+ < TableCell >
41+ < TableSortLabel
42+ active = { orderDirection !== undefined }
43+ direction = { orderDirection }
44+ onClick = { onChangeOrder }
45+ >
46+ Timestamp
47+ </ TableSortLabel >
48+ </ TableCell >
49+ < TableCell > username</ TableCell >
50+ < TableCell > Method</ TableCell >
51+ < TableCell > Path</ TableCell >
52+ < TableCell > Query Parameters</ TableCell >
53+ < TableCell > Response Code</ TableCell >
54+ < TableCell > Body</ TableCell >
55+ </ TableRow >
56+ </ TableHead >
57+ < TableBody >
58+ { entryList . map ( ( entry , index ) => (
59+ < AuditLogRow
60+ key = { index } // eslint-disable-line react/no-array-index-key
61+ entry = { entry }
62+ onOpenBody = { onOpen ( AUDIT_BODY_MODAL ) }
63+ />
64+ ) ) }
65+ </ TableBody >
66+ < TableFooter >
67+ < TableRow >
68+ < TablePagination
69+ count = { count }
70+ page = { page }
71+ rowsPerPage = { rowsPerPage }
72+ onPageChange = { onChangePage }
73+ onRowsPerPageChange = { onChangeRowsPerPage }
74+ ActionsComponent = { TableActions }
75+ rowsPerPageOptions = { rowsPerPageOptions }
76+ />
77+ </ TableRow >
78+ </ TableFooter >
79+ </ Table >
80+ < CodeModal { ...dialogProps } dialogName = { AUDIT_BODY_MODAL } />
81+ </ >
7082 ) ;
7183}
84+
85+ export default withDialogProps ( AuditLogTable ) ;
0 commit comments