02c03e4dfbe6b6d89a457daf75cf231d36477e76
chmalee
  Wed Jan 8 11:29:13 2025 -0800
Remove some dead template code and TODO comments, refs #31058

diff --git src/hg/js/hgMyData.js src/hg/js/hgMyData.js
index e4b9315..3342e9c 100644
--- src/hg/js/hgMyData.js
+++ src/hg/js/hgMyData.js
@@ -594,111 +594,64 @@
         DataTable.feature.register('quota', function(settings, opts) {
             let options = Object.assign({option1: false, option2: false}, opts);
             let container = document.createElement("div");
             if (isLoggedIn) {
                 container.textContent = `Using ${prettyFileSize(userQuota)} of ${prettyFileSize(maxQuota)}`;
             }
             return container;
         });
         let table = new DataTable("#filesTable", tableInitOptions);
         table.on("select", function(e, dt, type, indexes) {
             doRowSelect(e, dt, indexes);
         });
         table.on("deselect", function(e, dt, type, indexes) {
             doRowSelect(e, dt, indexes);
         });
-        table.on('order', function() {
-            let order = table.order();
-            if (order.length > 0) {
-                console.log(`ordering table on column ${order[0].name}`);
-            }
-        });
         _.each(d, function(f) {
             filesHash[f.fullPath] = f;
         });
         return table;
     }
 
-    function checkJsonData(jsonData, callerName) {
-        // Return true if jsonData isn't empty and doesn't contain an error;
-        // otherwise complain on behalf of caller.
-        if (! jsonData) {
-            alert(callerName + ': empty response from server');
-        } else if (jsonData.error) {
-            console.error(jsonData.error);
-            alert(callerName + ': error from server: ' + jsonData.error);
-        } else if (jsonData.warning) {
-            alert("Warning: " + jsonData.warning);
-            return true;
-        } else {
-            if (debugCartJson) {
-                console.log('from server:\n', jsonData);
-            }
-            return true;
-        }
-        return false;
-    }
-
-    function updateStateAndPage(jsonData, doSaveHistory) {
-        // Update uiState with new values and update the page.
-        _.assign(uiState, jsonData);
-    }
-
-    function handleRefreshState(jsonData) {
-        if (checkJsonData(jsonData, 'handleRefreshState')) {
-            updateStateAndPage(jsonData, true);
-        }
-        $("#spinner").remove();
-    }
-
     function init() {
         cart.setCgi('hgMyData');
         cart.debug(debugCartJson);
 
         if (typeof cartJson !== "undefined") {
             if (typeof cartJson.warning !== "undefined") {
                 alert("Warning: " + cartJson.warning);
             }
             var urlParts = {};
             if (debugCartJson) {
                 console.log('from server:\n', cartJson);
             }
             _.assign(uiState,cartJson);
             saveHistory(cartJson, urlParts, true);
         } else {
             // no cartJson object means we are coming to the page for the first time:
-            //cart.send({ getUiState: {} }, handleRefreshState);
-            //cart.flush();
-            // TODO: initialize buttons, check if there are already files
             // TODO: write functions for
-            //     after picking files
-            //     choosing file types
             //     creating default trackDbs
             //     editing trackDbs
             let fileDiv = document.getElementById('filesDiv');
             if (typeof userFiles !== 'undefined' && Object.keys(userFiles).length > 0) {
                 uiState.fileList = userFiles.fileList;
                 uiState.hubList = userFiles.hubList;
                 uiState.userUrl = userFiles.userUrl;
             }
             // first add the top level directories/files
-            //let table = showExistingFiles(uiState.fileList.filter((row) => row.parentDir === ""));
             let table = showExistingFiles(uiState.fileList);
-            // now add any subdirs and files
-            //addChildRows(table, uiState.fileList.filter((row) => row.parentDir !== ""));
             // TODO: add event handlers for editing defaults, grouping into hub
-            // TODO: display quota somewhere
         }
         $("#newTrackHubDialog").dialog({
             modal: true,
             autoOpen: false,
             title: "Create new track hub",
             closeOnEscape: true,
             minWidth: 400,
             minHeight: 120
         });
         // create a custom uppy plugin to batch change the type and db fields
         class BatchChangePlugin extends Uppy.BasePlugin {
             constructor(uppy, opts) {
                 super(uppy, opts);
                 this.id = "BatchChangePlugin";
                 this.type = "progressindicator";
@@ -967,24 +920,15 @@
                 "fileSize": 0,
                 "fileType": "dir",
                 "genome": metadata.genome,
                 "parentDir": "",
                 "fullPath": metadata.parentDir + "/",
             };
             addNewUploadedFileToTable(parentDirObj);
             addNewUploadedFileToTable(hubTxtObj);
             addNewUploadedFileToTable(newReqObj);
         });
     }
     return { init: init,
              uiState: uiState,
            };
 }());
-
-
-
-// when a user reaches this page from the back button we can display our saved state
-// instead of sending another network request
-window.onpopstate = function(event) {
-    event.preventDefault();
-    hubCreate.updateStateAndPage(event.state, false);
-};