You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

83 lines
2.4 KiB

  1. // material-ui
  2. import {
  3. // Box,
  4. Typography
  5. } from '@mui/material';
  6. import MainCard from "components/MainCard";
  7. import * as React from "react";
  8. import { FiDataGrid } from "components/FiDataGrid";
  9. import { GET_SYS_PARAMS } from "utils/ApiPathConst";
  10. import SafeHtml from 'components/SafeHtml';
  11. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  12. const Table = ({onRowClick, searchCriteria, refreshTrigger}) => {
  13. const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria);
  14. React.useEffect(() => {
  15. set_searchCriteria(searchCriteria);
  16. }, [searchCriteria]);
  17. const columns = [
  18. {
  19. field: 'name',
  20. headerName: 'Name',
  21. width: 300,
  22. },
  23. {
  24. id: 'type',
  25. field: 'type',
  26. headerName: 'Type',
  27. width: 150,
  28. valueGetter: (params) => {
  29. return params.row.type
  30. }
  31. },
  32. {
  33. id: 'category',
  34. field: 'category',
  35. headerName: 'Category',
  36. width: 150,
  37. },
  38. {
  39. id: 'value',
  40. field: 'value',
  41. headerName: 'Value',
  42. flex: 1,
  43. minWidth: 400,
  44. renderCell:(params)=>{
  45. return <SafeHtml html={params.value} />
  46. }
  47. },
  48. ];
  49. return (
  50. <MainCard elevation={0}
  51. border={false}
  52. content={false}
  53. height='100%'
  54. >
  55. <Typography variant="h5" sx={{mt: 3, ml: 3, mr: 3, borderBottom: "1px solid black"}}>
  56. System Params
  57. </Typography>
  58. <div style={{ width: { xs: '92vw', sm: '96.5vw', md: "auto" }, }}>
  59. {/* <Box width= '100%' sx={{ backgroundColor: "#fff", ml: 2 }} height='100%'> */}
  60. <FiDataGrid
  61. columns={columns}
  62. customPageSize={10}
  63. getRowHeight={() => 'auto'}
  64. onRowClick={onRowClick}
  65. doLoad={React.useMemo(() => ({
  66. url:GET_SYS_PARAMS,
  67. params:_searchCriteria
  68. }), [_searchCriteria, refreshTrigger])}
  69. />
  70. {/* </Box> */}
  71. </div>
  72. </MainCard>
  73. );
  74. };
  75. export default Table;