diff --git a/apps/backend/app.py b/apps/backend/app.py
index 73fcfc66..cd8b67c8 100644
--- a/apps/backend/app.py
+++ b/apps/backend/app.py
@@ -102,8 +102,8 @@ def check_mongo():
@flaskApp.get("/downloadExpFile")
def download_exp_file():
try:
- experiment_id = request.args.get('expId', default='', type=str)
- file_data = download_experiment_file(experiment_id, mongoClient)
+ file_id = request.args.get('fileId', default='', type=str)
+ file_data = download_experiment_file(file_id, mongoClient)
file_stream = io.BytesIO(file_data)
return send_file(file_stream, as_attachment=True, download_name="experiment_file", mimetype="application/octet-stream")
except Exception:
diff --git a/apps/backend/modules/mongo.py b/apps/backend/modules/mongo.py
index ccd3eb6f..747b21b0 100644
--- a/apps/backend/modules/mongo.py
+++ b/apps/backend/modules/mongo.py
@@ -70,12 +70,12 @@ def insertExperiments():
# keep trying
check_insert_default_experiments(mongoClient)
-def download_experiment_file(expId: str, mongoClient: pymongo.MongoClient):
+def download_experiment_file(file_id: str, mongoClient: pymongo.MongoClient):
# we are going to have to get the binary data from mongo here
# setup the bucket
db = mongoClient["gladosdb"]
bucket = GridFSBucket(db, bucket_name='fileBucket')
- files = bucket.find({"metadata.expId": expId}).to_list()
+ files = bucket.find({"_id": ObjectId(file_id)}).to_list() # type: ignore
num_files = 0
file_name = ""
for file in files:
diff --git a/apps/frontend/app/components/auth/SignUpModal.tsx b/apps/frontend/app/components/auth/SignUpModal.tsx
index cefcb129..27d52da3 100644
--- a/apps/frontend/app/components/auth/SignUpModal.tsx
+++ b/apps/frontend/app/components/auth/SignUpModal.tsx
@@ -67,9 +67,9 @@ export const SignUpModal = ({ afterSignUp }) => {
- {/* For dev testing!!! */}
- {/* */}
+ {/* For dev testing!!! */}
+ {/* */}
diff --git a/apps/frontend/app/components/flows/AddExperiment/NewExperiment.tsx b/apps/frontend/app/components/flows/AddExperiment/NewExperiment.tsx
index 072e533f..30491118 100644
--- a/apps/frontend/app/components/flows/AddExperiment/NewExperiment.tsx
+++ b/apps/frontend/app/components/flows/AddExperiment/NewExperiment.tsx
@@ -11,9 +11,11 @@ import { ParamStep } from './stepComponents/ParamStep';
import { PostProcessStep } from './stepComponents/PostProcessStep';
import { ConfirmationStep } from './stepComponents/ConfirmationStep';
import { DumbTextArea } from './stepComponents/DumbTextAreaStep';
-import { DB_COLLECTION_EXPERIMENTS } from '../../../../lib/db';
+import { DB_COLLECTION_EXPERIMENTS, submitExperiment } from '../../../../lib/db';
-import { getDocumentFromId } from '../../../../lib/mongodb_funcs';
+import { getDocumentFromId, updateLastUsedDateFile } from '../../../../lib/mongodb_funcs';
+import { useSession } from 'next-auth/react';
+import toast, { Toaster } from 'react-hot-toast';
const DEFAULT_TRIAL_TIMEOUT_SECONDS = 5 * 60 * 60; // 5 hours in seconds
@@ -63,6 +65,8 @@ const Steps = ({ steps }) => {
const NewExperiment = ({ formState, setFormState, copyID, setCopyId, ...rest }) => {
+ const { data: session } = useSession();
+
const form = useForm({
// TODO make this follow the schema as closely as we can
initialValues: {
@@ -124,11 +128,7 @@ const NewExperiment = ({ formState, setFormState, copyID, setCopyId, ...rest })
const [status, setStatus] = useState(0);
const [id, setId] = useState(null);
- const onDropComplete = () => {
- setFormState(-1);
- localStorage.removeItem('ID');
- setStatus(FormStates.Info);
- };
+ const [fileId, setFileId] = useState
();
useLayoutEffect(() => {
if (formState === FormStates.Info) {
@@ -142,123 +142,154 @@ const NewExperiment = ({ formState, setFormState, copyID, setCopyId, ...rest })
}, [formState]); // TODO adding 'form' causes an update loop
return (
-
-