diff --git a/src/components/DataImport/ArtefactUploadView.jsx b/src/components/DataImport/ArtefactUploadView.jsx
index e41d223..5a06d0c 100644
--- a/src/components/DataImport/ArtefactUploadView.jsx
+++ b/src/components/DataImport/ArtefactUploadView.jsx
@@ -1,4 +1,4 @@
-import { Button, Flex, Box, Text } from "@chakra-ui/react";
+import { Button, Flex, Box, Text, Field, Input } from "@chakra-ui/react";
import { useEffect, useRef, useState } from "react";
import { HiUpload } from "react-icons/hi";
import server from "../../networking";
@@ -8,12 +8,13 @@ import { IoArrowBackCircleSharp } from "react-icons/io5";
import PendingBatchCard from "./PendingBatchCard";
import hp1 from "../../assets/hp1.png";
-function ArtefactUploadView({ batch, setBatchID, onClose, fetchBatches, onBackToPending }) {
+function ArtefactUploadView({ batch, setBatchID, fetchBatches, onBackToPending }) {
const batchID = batch?.id;
const fileInputRef = useRef(null);
const [isSubmitting, setIsSubmitting] = useState(false);
const [selectedFiles, setSelectedFiles] = useState([]);
const [fileStatuses, setFileStatuses] = useState({});
+ const [name, setName] = useState(batch?.name || "");
const handleButtonClick = () => {
fileInputRef.current?.click();
@@ -58,6 +59,10 @@ function ArtefactUploadView({ batch, setBatchID, onClose, fetchBatches, onBackTo
ToastWizard.standard("warning", "No Files Selected", "Please choose at least one file before uploading.");
return;
}
+ if (!batchID && !name.trim()) {
+ ToastWizard.standard("error", "Batch Name Required", "Please provide a name for the new batch.");
+ return;
+ }
const formData = new FormData();
selectedFiles.forEach((file) => {
@@ -67,6 +72,9 @@ function ArtefactUploadView({ batch, setBatchID, onClose, fetchBatches, onBackTo
if (batchID) {
formData.append("batchID", batchID);
}
+ if (name) {
+ formData.append("name", name);
+ }
setIsSubmitting(true);
@@ -204,6 +212,11 @@ function ArtefactUploadView({ batch, setBatchID, onClose, fetchBatches, onBackTo
)
}
+
+ Batch Name
+ setName(e.target.value)} />
+
+
- >}
- {username && (
+ nav('/import')} fontSize={'md'}>
+ Data Import
+
+
nav('/profile')} fontSize={'md'}>
My Profile
- )}
+ >}
{superuser === true && (
nav('/admin')} fontSize={'md'}>
diff --git a/src/pages/DataImport.jsx b/src/pages/DataImport.jsx
index 93b0c7f..dff2c0e 100644
--- a/src/pages/DataImport.jsx
+++ b/src/pages/DataImport.jsx
@@ -7,13 +7,12 @@ import ToastWizard from '../components/toastWizard'
import server, { JSONResponse } from "../networking";
import BatchCard from "../components/DataImport/BatchCard";
import ImportMenuDialog from "../components/DataImport/ImportMenuDialog.jsx";
-import CentredSpinner from "../components/centredSpinner.jsx";
+import CentredSpinner from "../components/CentredSpinner.jsx";
const stageCollection = createListCollection({
items: [
{ label: "Pending", value: "upload_pending" },
- { label: "Unprocessed", value: "unprocessed" },
- { label: "Processed", value: "processed" },
+ { label: "Processing", value: "unprocessed" },
{ label: "Vetting", value: "vetting" },
{ label: "Integration", value: "integration" },
{ label: "Completed", value: "completed" },
@@ -65,12 +64,11 @@ function DataImport() {
const { loaded } = useSelector(state => state.auth);
- const stages = ["upload_pending", "unprocessed", "processed", "vetting", "integration", "completed"];
+ const stages = ["upload_pending", "unprocessed", "vetting", "integration", "completed"];
const stageLabels = {
upload_pending: "Pending",
- unprocessed: "Unprocessed",
- processed: "Processed",
+ unprocessed: "Processing",
vetting: "Vetting",
integration: "Integration",
completed: "Completed",
@@ -107,12 +105,14 @@ function DataImport() {
const artefacts = Object.values(batch.artefacts || {});
const processed = artefacts.filter(a => a.stage === "processed").length;
const unprocessed = artefacts.filter(a => a.stage === "unprocessed").length;
- const total = processed + unprocessed
+ const confirmed = artefacts.filter(a => a.stage === "confirmed").length;
+ const integrated = artefacts.filter(a => a.stage === "integrated").length;
+ const total = artefacts.length;
return {
id,
...batch,
- artefactSummary: { processed, total },
+ artefactSummary: { processed, total, confirmed, integrated, unprocessed },
};
});
@@ -133,7 +133,6 @@ function DataImport() {
setBatches(sorted);
setBatchNumberMap(batchNumberMap);
setPendingBatches(pendingBatches);
-
} else {
throw new Error("Unexpected response format");
}
@@ -272,18 +271,9 @@ function DataImport() {
filtered.map((batch, idx) => (
console.log("Clicked batch", batch.id)}
+ batchData={batch}
+ formatTimestamp={formatTimestamp}
+ fetchBatches={fetchBatches}
/>
))