From 5ce1de6072eccb42f15917796b9a00e90456e12b Mon Sep 17 00:00:00 2001 From: Nathan LeRoy Date: Thu, 25 Jul 2024 14:00:12 -0400 Subject: [PATCH] fix schema bug --- pephub/routers/api/v1/namespace.py | 3 +-- web/src/api/namespace.ts | 2 +- web/src/components/forms/blank-project-form.tsx | 2 +- web/src/components/forms/project-upload-form.tsx | 6 +++--- .../project/project-validation-and-edit-buttons.tsx | 2 +- web/src/hooks/mutations/useBlankProjectFormMutation.ts | 1 + 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pephub/routers/api/v1/namespace.py b/pephub/routers/api/v1/namespace.py index 566116b8..408f2147 100644 --- a/pephub/routers/api/v1/namespace.py +++ b/pephub/routers/api/v1/namespace.py @@ -1,4 +1,3 @@ -import json import shutil import tempfile from typing import List, Literal, Optional, Union @@ -204,7 +203,7 @@ async def create_pep( # create a blank peppy.Project object with fake files else: raise HTTPException( - detail=f"Project files were not provided", + detail="Project files were not provided", status_code=400, ) diff --git a/web/src/api/namespace.ts b/web/src/api/namespace.ts index 2fda1475..769738fd 100644 --- a/web/src/api/namespace.ts +++ b/web/src/api/namespace.ts @@ -207,12 +207,12 @@ export const submitProjectJSON = ( pep_dict: { config: config_json, sample_list: sample_table, - pep_schema: pep_schema, }, description: description || '', name: name, is_private: is_private || false, tag: tag || 'default', + pep_schema: pep_schema, }, { headers: { diff --git a/web/src/components/forms/blank-project-form.tsx b/web/src/components/forms/blank-project-form.tsx index cd101dee..b72f437f 100644 --- a/web/src/components/forms/blank-project-form.tsx +++ b/web/src/components/forms/blank-project-form.tsx @@ -90,7 +90,7 @@ export const BlankProjectForm = (props: Props) => { config: `pep_version: 2.1.0 sample_table: samples.csv `, - pep_schema: 'pep/2.1.0', + pep_schema: undefined, }, }); diff --git a/web/src/components/forms/project-upload-form.tsx b/web/src/components/forms/project-upload-form.tsx index 007a61d8..3aeb25c5 100644 --- a/web/src/components/forms/project-upload-form.tsx +++ b/web/src/components/forms/project-upload-form.tsx @@ -1,5 +1,5 @@ import { ErrorMessage } from '@hookform/error-message'; -import { FC, useRef } from 'react'; +import { useRef } from 'react'; import { Controller, FieldErrors, useForm } from 'react-hook-form'; import toast from 'react-hot-toast'; @@ -54,7 +54,7 @@ const CombinedErrorMessage = (props: CombinedErrorMessageProps) => { return null; }; -export const ProjectUploadForm: FC = ({ onHide, defaultNamespace }) => { +export const ProjectUploadForm = ({ onHide, defaultNamespace }: Props) => { // get user info const { user } = useSession(); @@ -70,7 +70,7 @@ export const ProjectUploadForm: FC = ({ onHide, defaultNamespace }) => { mode: 'onChange', defaultValues: { is_private: false, - pep_schema: 'databio/pep-2.1.0', + pep_schema: undefined, namespace: defaultNamespace || user?.login || '', }, }); diff --git a/web/src/components/project/project-validation-and-edit-buttons.tsx b/web/src/components/project/project-validation-and-edit-buttons.tsx index d8467c78..87b8320e 100644 --- a/web/src/components/project/project-validation-and-edit-buttons.tsx +++ b/web/src/components/project/project-validation-and-edit-buttons.tsx @@ -64,7 +64,7 @@ export const ProjectValidationAndEditButtons = (props: ProjectValidationAndEditB >
- Add schema to PEP to validate + No schema
diff --git a/web/src/hooks/mutations/useBlankProjectFormMutation.ts b/web/src/hooks/mutations/useBlankProjectFormMutation.ts index bbf6e1d8..0e57b5a2 100644 --- a/web/src/hooks/mutations/useBlankProjectFormMutation.ts +++ b/web/src/hooks/mutations/useBlankProjectFormMutation.ts @@ -25,6 +25,7 @@ export const useBlankProjectFormMutation = (namespace: string) => { const mutation = useMutation({ mutationFn: (data: NewBlankProject) => { const { projectName, tag, isPrivate, description, config, pepSchema, sampleTable } = data; + debugger; return submitProjectJSON( { namespace: namespace,