tag from the parent
@@ -115,17 +151,41 @@ const DatasetCard = ({ dataset, recommender, toggleAI }) => {
// and the last element is the dataset id
let dataset_id = href.split("/").pop();
+ await removeDatasetFiles(dataset_id);
+
console.log(dataset_id);
// api call to remove dataset
}
+ // api call to remove all files related to the data id
+ async function removeDatasetFiles(dataset_id) {
+ // api call to remove dataset files example
+ // /api/v1/datasets/63f6e4947c5f93004a3e3ca7
+
+ await fetch("/api/v1/datasets/" + dataset_id, {
+ method: "DELETE",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ })
+ .then((res) => res.json())
+ .then((data) => {
+ console.log("removeDatasetFiles", data);
+ return data;
+ })
+ .catch((err) => {
+ console.log("err--removeDatasetFiles", err);
+ return err;
+ });
+ }
+
function mouseEnterCardDelectButton(e) {
console.log("mouseoverCardDelectButton");
console.log(e.target);
// make the red boundary in the trash can emoji
- e.target.style.cssText += ";border: 0.5px solid red;";
+ e.target.style.cssText += ";border: 0.1px solid red;";
}
function mouseLeaveCardDelectButton(e) {
@@ -188,17 +248,18 @@ const DatasetCard = ({ dataset, recommender, toggleAI }) => {
}
/>
-
+ {/* */}
{/* trash emoji */}
- {/* {
style={{ cursor: "pointer" }}
>
🗑
- */}
+
{
toggleAI={toggleAI}
/>
+ {/*
*/}
}
position="bottom right"
@@ -344,16 +406,17 @@ const DatasetCard = ({ dataset, recommender, toggleAI }) => {
}
/>
{/* trash emoji */}
- {/* {
style={{ cursor: "pointer" }}
>
🗑
- */}
+