65d4e214bd753220cd3f1b9700f107ef1ae648da
chmalee
  Fri May 24 09:36:42 2024 -0700
Make hubSpace autoSql files, haven't created the table yet

diff --git src/hg/js/hgMyData.js src/hg/js/hgMyData.js
index 0882dd3..2c1377b 100644
--- src/hg/js/hgMyData.js
+++ src/hg/js/hgMyData.js
@@ -193,95 +193,55 @@
         };
 
         let onError = function(err) {
             removeCancelAllButton();
             if (err.originalResponse !== null) {
                 alert(err.originalResponse._xhr.responseText);
             } else {
                 alert(err);
             }
         };
 
         let onProgress = function(bytesSent, bytesTotal) {
             this.updateProgress((bytesSent / bytesTotal) * 100);
         };
 
-        let createdHubs = {}; // object of {name, db} objects keyed by file names
-        let allSameHub = true; // by default, for multiple files, put them in the same hub
-        let getOrCreateHub = function(fileName) {
-            let valueStr = document.getElementById(`${fileName}#hubInput`).selectedOptions[0].value;
-            if (valueStr !== "Create New") {
-                return valueStr;
-            }
-            let hubName = "test"; // default to test
-            let db = "hg38";
-            // create a dialog:
-            let dialog = document.createElement("dialog");
-            dialog.id = "hubCreate";
-            let closeBtn = document.createElement("button");
-            closeBtn.textContent = "Create Hub";
-            let cancelBtn = document.createElement("button");
-            cancelBtn.textContent = "Cancel";
-            dialog.appendChild(closeBtn);
-            dialog.appendChild(cancelBtn);
-            document.body.appendChild(dialog);
-
-            // open the dialog in modal mode to block the rest of the page:
-            if (allSameHub)
-                dialog.showModal();
-
-            // on close update the right variables
-            closeBtn.addEventListener("click", () => {
-                createdHubs[fileName] = {"name": hubName, "db": db};
-                dialog.close();
-            });
-            // on cancel do nothing and don't submit:
-            cancelBtn.addEventListener("click", () => {
-                dialog.close();
-            });
-        };
-
         for (let f in uiState.toUpload) {
             file = uiState.toUpload[f];
             if (useTus) {
                 let progMeter = makeNewProgMeter(file.name);
                 let tusOptions = {
                     endpoint: tusdServer,
                     metadata: {
                         filename: file.name,
                         fileSize: file.size,
                         fileType: document.getElementById(`${file.name}#typeInput`).selectedOptions[0].value,
-                        hub: getOrCreateHub(file.name),
                         genome: document.getElementById(`${file.name}#genomeInput`).selectedOptions[0].value,
                     },
                     onProgress: onProgress.bind(progMeter),
                     onBeforeRequest: onBeforeRequest,
                     onSuccess: onSuccess.bind(null, file),
                     onError: onError,
-                    retryDelays: [1000],
+                    retryDelays: null,
                 };
                 // TODO: get the uploadUrl from the tusd server
                 // use a pre-create hook to validate the user
                 // and get an uploadUrl
-                if (tusOptions.metadata.hub !== null)  {
                 let tusUpload = new tus.Upload(file, tusOptions);
                 uiState.pendingQueue.push([tusUpload, file]);
                 tusUpload.start();
             } else {
-                    break; // cancel button was clicked when creating a hub, stop uploads for now
-                }
-            } else {
                 // make a new XMLHttpRequest for each file, if tusd-tusclient not supported
                 new sendFile(file);
             }
         }
         addCancelAllButton();
         return;
     }
 
     function clearPickedFiles() {
         while (uiState.pickedList.firstChild) {
             uiState.pickedList.removeChild(uiState.pickedList.firstChild);
         }
         uiState.input = createInput();
         uiState.toUpload = {};
         togglePickStateMessage(true);
@@ -320,89 +280,65 @@
         genomeInp.classList.add("genomePicker");
         genomeInp.name = `${fileName}#genomeInput`;
         genomeInp.id = `${fileName}#genomeInput`;
         genomeInp.form = formName;
         let labelChoice = document.createElement("option");
         labelChoice.label = "Choose Genome";
         labelChoice.value = "Choose Genome";
         labelChoice.selected = true;
         labelChoice.disabled = true;
         genomeInp.appendChild(labelChoice);
         let choices = ["Human hg38", "Human T2T", "Human hg19", "Mouse mm39", "Mouse mm10"];
         choices.forEach( (e) =>  {
             let choice = document.createElement("option");
             choice.id = e;
             choice.label = e;
-            choice.value = e;
+            choice.value = e.split(" ")[1];
             genomeInp.appendChild(choice);
         });
         return genomeInp;
     }
 
     function makeTypeSelect(formName, fileName) {
         let typeInp = document.createElement("select");
         typeInp.classList.add("typePicker");
         typeInp.name = `${fileName}#typeInput`;
         typeInp.id = `${fileName}#typeInput`;
         typeInp.form = formName;
         let labelChoice = document.createElement("option");
         labelChoice.label = "Choose File Type";
         labelChoice.value = "Choose File Type";
         labelChoice.selected = true;
         labelChoice.disabled = true;
         typeInp.appendChild(labelChoice);
         let choices = ["hub.txt", "bigBed", "bam", "vcf", "bigWig"];
         choices.forEach( (e) =>  {
             let choice = document.createElement("option");
             choice.id = e;
             choice.label = e;
             choice.value = e;
             typeInp.appendChild(choice);
         });
         return typeInp;
     }
 
-    function makeHubSelect(formName, fileName) {
-        let hubInp = document.createElement("select");
-        hubInp.classList.add("hubPicker");
-        hubInp.name = `${fileName}#hubInput`;
-        hubInp.id = `${fileName}#hubInput`;
-        hubInp.form = formName;
-        let labelChoice = document.createElement("option");
-        labelChoice.label = "Choose Hub";
-        labelChoice.value = "Choose Hub";
-        labelChoice.selected = true;
-        labelChoice.disabled = true;
-        hubInp.appendChild(labelChoice);
-        let choices = ["Create New", "temp"];
-        choices.forEach( (e) =>  {
-            let choice = document.createElement("option");
-            choice.id = e;
-            choice.label = e;
-            choice.value = e;
-            hubInp.appendChild(choice);
-        });
-        return hubInp;
-    }
 
     function makeFormControlsForFile(li, formName, fileName) {
         typeInp = makeTypeSelect(formName, fileName);
         genomeInp = makeGenomeSelect(formName, fileName);
-        hubInp = makeHubSelect(formName, fileName);
         li.append(typeInp);
         li.append(genomeInp);
-        li.append(hubInp);
     }
 
     function listPickedFiles() {
         // let the user choose files:
         if (uiState.input.files.length === 0) {
             console.log("not input");
             return;
         } else {
             let displayList;
             let displayListForm = document.getElementsByClassName("pickedFilesForm");
             if (displayListForm.length === 0) {
                 displayListForm = document.createElement("form");
                 displayListForm.id = "displayListForm";
                 displayListForm.classList.add("pickedFilesForm");
                 displayList = document.createElement("ul");
@@ -508,31 +444,30 @@
                 render: function(data, type, row) {
                     // click to call hgHubDelete file
                     return "<button class='deleteFileBtn'>Delete</button><button class='viewInBtn'>View In GB</button>";
                 }
             },
             {
                 targets: 3,
                 render: function(data, type, row) {
                     return dataTablePrintSize(data);
                 }
             }
         ],
         columns: [
             {data: "", },
             {data: "", },
-            {data: "hub", title: "Hub"},
             {data: "genome", title: "Genome"},
             {data: "name", title: "File name"},
             {data: "size", title: "File size", render: dataTablePrintSize},
             {data: "createTime", title: "Creation Time"},
         ],
         order: [[6, 'desc']],
         drawCallback: function(settings) {
             let btns = document.querySelectorAll('.deleteFileBtn');
             let i;
             for (i = 0; i < btns.length; i++) {
                 let fnameNode = btns[i].parentNode.nextElementSibling.childNodes[0];
                 if (fnameNode.nodeName !== "#text") {continue;}
                 let fname = fnameNode.nodeValue;
                 btns[i].addEventListener("click", (e) => {
                     deleteFile(i, fname);