Skip to content

Commit

Permalink
Merge branch 'mvp-2' of https://github.com/CBIIT/crdc-datahub-ui into C…
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro-Vega committed Nov 8, 2023
2 parents be0e17d + a68db56 commit 805925b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/DataSubmissions/DataSubmissionUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const DataSubmissionUpload = ({ submitterID, readOnly, onUpload }: Props) => {
}

// Filter out any file that is not tsv
const filteredFiles = Array.from(files)?.filter((file: File) => file.type === "text/tab-separated-values");
const filteredFiles = Array.from(files)?.filter((file: File) => file.name?.toLowerCase()?.endsWith(".tsv"));
if (!filteredFiles?.length) {
setSelectedFiles(null);
return;
Expand Down Expand Up @@ -275,6 +275,9 @@ const DataSubmissionUpload = ({ submitterID, readOnly, onUpload }: Props) => {
onUpload(`${selectedFiles.length} ${selectedFiles.length > 1 ? "Files" : "File"} successfully uploaded`, "success");
setIsUploading(false);
setSelectedFiles(null);
if (uploadMetatadataInputRef.current) {
uploadMetatadataInputRef.current.value = "";
}
} catch (err) {
// Unable to let BE know of upload result so all fail
onUploadFail(selectedFiles?.length);
Expand All @@ -285,6 +288,9 @@ const DataSubmissionUpload = ({ submitterID, readOnly, onUpload }: Props) => {
onUpload(`${fileCount} ${fileCount > 1 ? "Files" : "File"} failed to upload`, "error");
setSelectedFiles(null);
setIsUploading(false);
if (uploadMetatadataInputRef.current) {
uploadMetatadataInputRef.current.value = "";
}
};

return (
Expand Down

0 comments on commit 805925b

Please sign in to comment.