diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index ad4b43a..637ad6b 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -3329,7 +3329,6 @@ exports[`App Route /packages authenticated 1`] = ` /> -
@@ -3460,6 +3459,7 @@ exports[`App Route /packages authenticated 1`] = ` +
diff --git a/src/components/Manifest/List/index.jsx b/src/components/Manifest/List/index.jsx index 907ed71..253c1bf 100644 --- a/src/components/Manifest/List/index.jsx +++ b/src/components/Manifest/List/index.jsx @@ -68,7 +68,11 @@ const MainForm = () => { const [orderBy, setOrderBy] = useState("id"); const [order, setOrder] = useState("asc"); const [search, setSearch] = useState(""); + const [showDeleteModal, setShowDeleteModal] = useState(false); + const [deleteId, setDeleteId] = useState(""); + const [deleteRowName, setDeleteRowName] = useState(""); + const { getManifests, deleteManifest, manifests, totalManifests } = useManifestsContext(); const { setMessage, setTitle, setSitePath } = useStatusContext(); @@ -133,6 +137,12 @@ const MainForm = () => { setSearch(query); }; + const setDeletePopup = (id, row) => { + setDeleteId(id); + setDeleteRowName(`${row.name} ${row.version}`); + setShowDeleteModal(true); + } + const onDelete = async (manifest_id) => { try { await deleteManifest(parseInt(manifest_id), token); @@ -182,16 +192,10 @@ const MainForm = () => { return (
- onDelete(action.id)}> + setDeletePopup(action.id, row)}> {action.icon} - setShowDeleteModal(false)} - deleteFunction={() => onDelete(action.id)} - />
); } @@ -261,6 +265,11 @@ const MainForm = () => { + setShowDeleteModal(false)} + deleteFunction={() => onDelete(deleteId)} /> ); };