d4fe91a0b0657952985cc2cac9660ba9bb407f7b chmalee Wed Apr 9 12:58:32 2025 -0700 add a back button to the hubspace ui when navigating into a subdirectory, refs #31058 diff --git src/hg/js/hgMyData.js src/hg/js/hgMyData.js index dc60b4117e4..9c60b647cbf 100644 --- src/hg/js/hgMyData.js +++ src/hg/js/hgMyData.js @@ -602,32 +602,50 @@ if (!rowNode) { // if we are using the breadcrumb to jump back 2 directories or doing an upload // while a subdirectory is opened, we won't have a rowNode because the row will // not have been rendered yet. So draw the table with the oldRowData restored table.draw(); // and now we can try again row = table.row((idx,data) => data.fullPath === dirData.fullPath); rowNode = row.node(); } oldRowData = row.data(); // put the data in the header: let rowClone = rowNode.cloneNode(true); // match the background color of the normal rows: rowClone.style.backgroundColor = "#fff9d2"; let thead = document.querySelector(".dt-scroll-headInner > table:nth-child(1) > thead:nth-child(1)"); - // remove the checkbox because it doesn't do anything: - rowClone.replaceChild(document.createElement("td"), rowClone.childNodes[0]); + // remove the checkbox because it doesn't do anything, and replace it + // with a back arrow 'button' + let btn = document.createElement("button"); + btn.id = "backButton"; + $(btn).button({icon: "ui-icon-triangle-1-w"}); + btn.addEventListener("click", (e) => { + let parentDir = dirData.parentDir; + let parentDirPath = dirData.fullPath.slice(0,-dirData.fullPath.length); + if (parentDirPath.length) { + dataTableShowDir(table, parentDir, parentDirPath); + } else { + dataTableShowTopLevel(table); + dataTableCustomOrder(table); + dataTableEmptyBreadcrumb(table); + } + table.draw(); + }); + let tdBtn = document.createElement("td"); + tdBtn.appendChild(btn); + rowClone.replaceChild(tdBtn, rowClone.childNodes[0]); if (thead.childNodes.length === 1) { thead.appendChild(rowClone); } else { thead.replaceChild(rowClone, thead.lastChild); } // remove the row row.remove(); // now do a regular order table.order([{name: "uploadTime", dir: "desc"}]); } } function parseFileListIntoHash(fileList) { // Hash the uiState fileList by the fullPath, and also store the children // for each directory