diff --git a/web/src/components/forms/create-schema-form.tsx b/web/src/components/forms/create-schema-form.tsx index d853c812..9bdbc8f8 100644 --- a/web/src/components/forms/create-schema-form.tsx +++ b/web/src/components/forms/create-schema-form.tsx @@ -55,7 +55,7 @@ const CombinedErrorMessage = (props: CombinedErrorMessageProps) => { if (nameError == 'empty') { msg = 'Schema Name must not be empty.'; } else if (nameError == 'invalid') { - msg = "Schema Name must contain only alphanumeric characters, '-', or '_'."; + msg = "Schema Name must contain only alphanumeric characters, '.', '-', or '_'."; } if (nameError) { @@ -134,7 +134,7 @@ export const CreateSchemaForm = (props: Props) => { message: "empty", }, pattern: { - value: /^[a-zA-Z0-9_-]+$/, + value: /^[a-zA-Z0-9_.-]+$/, message: "invalid", }, })} diff --git a/web/src/components/forms/upload-schema-form.tsx b/web/src/components/forms/upload-schema-form.tsx index 1f563dd7..40f07a9f 100644 --- a/web/src/components/forms/upload-schema-form.tsx +++ b/web/src/components/forms/upload-schema-form.tsx @@ -34,7 +34,7 @@ const CombinedErrorMessage = (props: CombinedErrorMessageProps) => { if (nameError == 'empty') { msg = 'Schema Name must not be empty.'; } else if (nameError == 'invalid') { - msg = "Schema Name must contain only alphanumeric characters, '-', or '_'."; + msg = "Schema Name must contain only alphanumeric characters, '.', '-', or '_'."; } if (nameError) { @@ -125,7 +125,7 @@ export const SchemaUploadForm = (props: Props) => { message: "empty", }, pattern: { - value: /^[a-zA-Z0-9_-]+$/, + value: /^[a-zA-Z0-9_.-]+$/, message: "invalid", }, })} diff --git a/web/src/components/modals/standardize-metadata.tsx b/web/src/components/modals/standardize-metadata.tsx index 86972c3f..53e9ac6b 100644 --- a/web/src/components/modals/standardize-metadata.tsx +++ b/web/src/components/modals/standardize-metadata.tsx @@ -14,6 +14,7 @@ import { formatToPercentage } from '../../utils/etc'; import { arraysToSampleList, sampleListToArrays } from '../../utils/sample-table'; import { ProjectMetaEditForm } from '../forms/edit-project-meta'; import { LoadingSpinner } from '../spinners/loading-spinner'; +import { StandardizerTable } from '../tables/standardizer-table'; type Props = { namespace: string; @@ -265,122 +266,17 @@ export const StandardizeMetadataModal = (props: Props) => {
{Object.keys(standardizedData).map((key, index) => ( -
-
- {key === sampleTableIndex ? ( -

- SampleTableIndex must also be updated in project config! -

- ) : null} -
-
- -
-
-
-
-
- handleRadioChange(key, null)} - /> - - - {Object.entries(standardizedData[key]).map(([subKey, value], index, array) => ( - - handleRadioChange(key, subKey)} - /> - - - ))} -
-
-
-
-
-
+ ))} diff --git a/web/src/components/tables/standardizer-table.tsx b/web/src/components/tables/standardizer-table.tsx new file mode 100644 index 00000000..7684b640 --- /dev/null +++ b/web/src/components/tables/standardizer-table.tsx @@ -0,0 +1,151 @@ +import React from 'react'; +import { HotTable } from '@handsontable/react'; +import Handsontable from 'handsontable'; +import { formatToPercentage } from '../../utils/etc'; + +type StandardizerTableProps = { + columnKey: string; + columnIndex: number; + standardizedData: Record; + selectedValues: string; + whereDuplicates: number[] | null; + sampleTableIndex: string; + tabData: string[]; + handleRadioChange: (key: string, value: string | null) => void; + tableData: string[][]; +}; + +export const StandardizerTable = (props: StandardizerTableProps) => { + const { + columnKey, + columnIndex, + standardizedData, + selectedValues, + whereDuplicates, + sampleTableIndex, + tabData, + handleRadioChange, + tableData, + } = props; + + return ( + <> +
+
+ {columnKey === sampleTableIndex ? ( +

+ SampleTableIndex must also be updated in project config! +

+ ) : null} +
+
+ +
+
+
+
+
+ handleRadioChange(columnKey, null)} + /> + + + {Object.entries(standardizedData).map(([subKey, value]) => ( + + handleRadioChange(columnKey, subKey)} + /> + + + ))} +
+
+
+
+
+
+ + ); +}; \ No newline at end of file