diff --git a/frontend/components/ProductGrid.js b/frontend/components/ProductGrid.js index dab10de..c6609c9 100644 --- a/frontend/components/ProductGrid.js +++ b/frontend/components/ProductGrid.js @@ -3,6 +3,7 @@ import DeleteIcon from '@mui/icons-material/Delete' import DownloadIcon from '@mui/icons-material/Download' import ShareIcon from '@mui/icons-material/Share' import Alert from '@mui/material/Alert' +import Tooltip from '@mui/material/Tooltip' import Link from '@mui/material/Link' import Snackbar from '@mui/material/Snackbar' import { DataGrid, GridActionsCellItem } from '@mui/x-data-grid' @@ -158,11 +159,21 @@ export default function ProductGrid(props) { width: 120, sortable: false, renderCell: params => ( - } - onClick={() => handleDelete(params.row)} - disabled={!params.row.can_delete} - /> + +
+ } + onClick={() => handleDelete(params.row)} + disabled={!params.row.can_delete} + /> +
+
) } ] diff --git a/frontend/components/ProductRemove.js b/frontend/components/ProductRemove.js index 61ac625..0a84a78 100644 --- a/frontend/components/ProductRemove.js +++ b/frontend/components/ProductRemove.js @@ -1,14 +1,13 @@ -import LoadingButton from '@mui/lab/LoadingButton' -import Button from '@mui/material/Button' +import React from 'react' +import PropTypes from 'prop-types' import Dialog from '@mui/material/Dialog' import DialogActions from '@mui/material/DialogActions' import DialogContent from '@mui/material/DialogContent' import DialogContentText from '@mui/material/DialogContentText' import DialogTitle from '@mui/material/DialogTitle' -import PropTypes from 'prop-types' -import React from 'react' +import Button from '@mui/material/Button' +import LoadingButton from '@mui/lab/LoadingButton' import { deleteProduct } from '../services/product' - export default function ProductRemove({ recordId, onRemoveSuccess, @@ -16,7 +15,6 @@ export default function ProductRemove({ onError }) { const [isLoading, setLoading] = React.useState(false) - const [isAuthorized, setAuthorized] = React.useState(true) const handleDelete = async () => { setLoading(true) @@ -25,13 +23,9 @@ export default function ProductRemove({ onRemoveSuccess() onClose() } catch (error) { - if (error.response && error.response.status === 403) { - setAuthorized(false) - } else { - onError( - 'Failed to remove the product. Please try again later or contact the helpdesk.' - ) - } + onError( + 'Failed to remove the product. Please try again later or contact the helpdesk.' + ) setLoading(false) } } @@ -48,30 +42,14 @@ export default function ProductRemove({ - {isAuthorized && ( - - Delete - - )} + + Delete + - {!isAuthorized && ( - - - - { - 'You cannot delete this data product because it belongs to another user.' - } - - - - - - - )} ) }