You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: convertPheno_client/src/code/views/conversion/ components/submission/components/submissionForms/components/fileUpload/components/inputFilesPond/InputFilesPond.jsx
+37-9Lines changed: 37 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -120,6 +120,39 @@ export default function InputFilesPond(props) {
120
120
}
121
121
},[files]);
122
122
123
+
constinferPotentialFileType=(file)=>{
124
+
/*
125
+
inferPotentialFileType function
126
+
127
+
Props:
128
+
- filename (string): name of the file that was uploaded
129
+
130
+
Functionality:
131
+
- tries to infer based on the file name and extension the file type
132
+
(input file, dictionary, mapping file)
133
+
134
+
Purpose:
135
+
- To update the state uploadedFiles with the file that was uploaded
136
+
*/
137
+
const{ filename, fileExtension }=file;
138
+
139
+
if(
140
+
filename.includes("dictionary")&&
141
+
["csv","tsv","txt"].includes(fileExtension)
142
+
){
143
+
return"redcap-dictionary";
144
+
}
145
+
146
+
if(
147
+
filename.includes("mapping")&&
148
+
["yaml","yml","json"].includes(fileExtension)
149
+
){
150
+
return"mapping-file";
151
+
}
152
+
153
+
return"input-file";
154
+
};
155
+
123
156
consthandleFileUploadFinished=(_,file)=>{
124
157
/*
125
158
handleFileUploadFinished function
@@ -131,25 +164,20 @@ export default function InputFilesPond(props) {
131
164
- tries to infer based on the file name and extension the file type
132
165
(input file, dictionary, mapping file)
133
166
134
-
Purpose:
135
-
- To update the state uploadedFiles with the file that was uploaded
167
+
Purpose:
168
+
- To update the state uploadedFiles with the file that was uploaded
0 commit comments