Skip to content

Commit

Permalink
Merge main into sweep/upgrade-react-query
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Dec 10, 2023
2 parents 9b3dd75 + 6e26b06 commit 64ed2d9
Showing 1 changed file with 1 addition and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function SubmissionForms(props) {
}, [inputFormat]);

useEffect(() => {
// check if conversion can be started
const isOutputFormatSelected = () => Object.values(outputFormats).some(value => value);

const showToast = (id, message) => {
Expand Down Expand Up @@ -161,95 +162,6 @@ export default function SubmissionForms(props) {
setConversionCanBeStarted(filesUploadFinished);
}, [inputFormat, outputFormats, uploadedFiles, runExampleData, filesUploadFinished]);

// useEffect(() => {
// // check if conversion can be started
// const trueVals = Object.values(outputFormats).filter((value) => value);
// if (trueVals.length === 0) {
// // no output format selected
// setConversionCanBeStarted(false);
// return;
// }

// if (runExampleData && trueVals.length !== 0 ) {
// setConversionCanBeStarted(true);
// return;
// }

// if (["redcap", "cdisc"].includes(inputFormat)) {
// if (Object.keys(uploadedFiles).length < 3) {
// setConversionCanBeStarted(false);
// return;
// }

// const acceptedFileExtensionsGeneral = ["txt", "tsv", "csv", "yaml", "yml", "json"];

// if (inputFormat === "cdisc") {
// acceptedFileExtensionsGeneral.push("xml");
// }

// const fileNames = Object.keys(uploadedFiles);
// const fileExtensions=[]
// const filesWithUnacceptedExtensions = fileNames.filter((fileName) => {
// const fileExtension = fileName.split(".").pop();
// fileExtensions.push(fileExtension);
// return !acceptedFileExtensionsGeneral.includes(fileExtension);
// });

// if (inputFormat === "cdisc") {
// if (fileExtensions.filter((fileExtension) => fileExtension === "xml").length !== 1) {
// renderToast({
// id:"oneXmlFileExpected",
// message:"One xml file is expected"
// });
// setConversionCanBeStarted(false);
// return;
// }
// }

// if (filesWithUnacceptedExtensions.length > 0) {
// renderToast({
// id:"unacceptedFileExtension",
// message:"one or more files have an unacceptable file extension"
// });
// setConversionCanBeStarted(false);
// return;
// }
// }

// if (["bff", "pxf", "omop"].includes(inputFormat) && Object.keys(uploadedFiles).length > 1) {
// renderToast({
// id:"onlyOneFileExpected",
// message:"Only one file is expected"
// });
// console.log("only one file expected");
// console.log("uploadedFiles", uploadedFiles)
// setConversionCanBeStarted(false);
// return;
// }

// if (["bff", "pxf", "omop"].includes(inputFormat) && Object.keys(uploadedFiles).length == 1) {
// const fileName = Object.keys(uploadedFiles)[0];
// if (["bff", "pxf"].includes(inputFormat) && !fileName.endsWith(".json")) {
// renderToast({
// id:"jsonFileExpected",
// message:"Please upload a .json file"
// });
// setConversionCanBeStarted(false);
// return;
// }

// if (inputFormat == "omop" && !fileName.endsWith(".sql") && !fileName.endsWith(".gz")) {
// renderToast({
// id:"sqlOrGzFileExpected",
// message:"Please upload a .sql or sql.gz file"
// });
// setConversionCanBeStarted(false);
// return;
// }
// }
// if (filesUploadFinished) setConversionCanBeStarted(true);
// }, [inputFormat, outputFormats, uploadedFiles, runExampleData, filesUploadFinished]);

const handleStartConversionClicked = () => {
if (runExampleData) {
setStartFileConversion(true);
Expand Down

0 comments on commit 64ed2d9

Please sign in to comment.