about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--uploader/templates/phenotypes/add-phenotypes-raw-files.html29
1 files changed, 24 insertions, 5 deletions
diff --git a/uploader/templates/phenotypes/add-phenotypes-raw-files.html b/uploader/templates/phenotypes/add-phenotypes-raw-files.html
index e76657a..2a5fd51 100644
--- a/uploader/templates/phenotypes/add-phenotypes-raw-files.html
+++ b/uploader/templates/phenotypes/add-phenotypes-raw-files.html
@@ -753,6 +753,7 @@
   ].map((row) => {
       r = makeResumableObject(row[0], row[1], row[2], row[3]);
       r.preview_table = $("#" + row[3]);
+      r.data_file_type = row[3].slice("tbl-preview".length + 1);
       return r;
   }).filter((val) => {
       return Boolean(val);
@@ -769,17 +770,35 @@
       // TODO: Verify that files are not duplicated
       var filenames = [];
       var nondupfiles = [];
+      var missing = [];
       resumables.forEach((r) => {
-          var fname = r.files[0].file.name;
-          filenames.push(fname);
-          if(!nondupfiles.includes(fname)) {
-              nondupfiles.push(fname);
+          var fileobj = r.files[0];
+          if(typeof fileobj !== "undefined" && Object.hasOwn(fileobj, "file")) {
+              var fname = fileobj.file.name;
+              filenames.push(fname);
+              if(!nondupfiles.includes(fname)) {
+                  nondupfiles.push(fname);
+              }
+          } else {
+              missing.push(r.data_file_type);
           }
       });
 
       // Check that all files were provided
       if(resumables.length !== filenames.length) {
-          window.alert("You MUST provide all the files requested.");
+          var _missingmap = {
+              "pheno-desc": "Phenotype descriptions",
+              "pheno-data": "Phenotype data",
+              "pheno-se": "Phenotype standard-errors",
+              "pheno-n": "Phenotype sample counts"
+          }
+          window.alert(
+              "You MUST provide all the requested files. Expected " +
+                  String(resumables.length) + " files but received " +
+                  String(filenames.length) + ".\r\n" +
+                  "Missing files:\r\n\t- " + missing.map((item) => {
+                      return _missingmap[item];
+                  }).join("\r\n\t- "));
           event.target.removeAttribute("disabled");
           return false;
       }