869e1a36ed23af200ec55157d1f2a2f2aea1ea19 chmalee Thu Apr 3 13:40:40 2025 -0700 Add search box to genome metadata field in hubSpace ui, allows searching for a genome like hgGateway, refs #31058 diff --git src/hg/js/autocompleteCat.js src/hg/js/autocompleteCat.js index d98b28bd234..ae7d362c227 100644 --- src/hg/js/autocompleteCat.js +++ src/hg/js/autocompleteCat.js @@ -74,31 +74,35 @@ // options.onServerReply (if given) is a function (Array, term) -> Array that // post-processes the list of items returned by the server before the list is // passed back to autocomplete for rendering. // The following two options apply only when using our locally modified jquery-ui: // If options.enterSelectsIdentical is true, then if the user hits Enter in the text input // and their term has an exact match in the autocomplete results, that result is selected. // options.onEnterTerm (if provided) is a callback function (jqEvent, jqUi) invoked // when the user hits Enter, after handling enterSelectsIdentical. // The function closure allows us to keep a private cache of past searches. var cache = {}; var doSearch = function(term, acCallback) { // Look up term in searchObj and by sending an ajax request var timestamp = new Date().getTime(); - var url = options.baseUrl + encodeURIComponent(term) + '&_=' + timestamp; + var url = options.baseUrl + encodeURIComponent(term); + if (!options.baseUrl.startsWith("hubApi")) { + // hubApi doesn't tolerate extra arguments + url += '&_=' + timestamp; + } // put up a loading icon so users know something is happening toggleSpinner(true, options); $.getJSON(url) .done(function(results) { if (_.isFunction(options.onServerReply)) { results = options.onServerReply(results, term); } // remove the loading icon toggleSpinner(false, options); cache[term] = results; acCallback(results); }); // ignore errors to avoid spamming people on flaky network connections // with tons of error messages (#8816). };