2dbbdd8d731791ab5ba3354b1b5bb41e82d99c84 chmalee Wed Oct 19 10:05:23 2022 -0700 Fix search client to indicate when there are no results, refs #29693 diff --git src/hg/js/hgSearch.js src/hg/js/hgSearch.js index 577dd36..0d4162d 100644 --- src/hg/js/hgSearch.js +++ src/hg/js/hgSearch.js @@ -683,43 +683,47 @@ return true; } return false; } function updateStateAndPage(jsonData, doSaveHistory) { // Update uiState with new values and update the page. _.assign(uiState, jsonData); db = uiState.db; if (jsonData.positionMatches !== undefined) { // clear the old resultHash uiState.resultHash = {}; _.each(uiState.positionMatches, function(match) { uiState.resultHash[match.name] = match; }); + } else { + // no results for this search + uiState.resultHash = {}; + uiState.positionMatches = []; + } updateFilters(uiState); updateSearchResults(uiState); buildSpeciesDropdown(); fillOutAssemblies(); urlVars = {"db": db, "search": uiState.search, "showSearchResults": ""}; // changing the url allows the history to be associated to a specific url var urlParts = changeUrl(urlVars); $("#searchCategories").jstree(true).refresh(false,true); if (doSaveHistory) saveHistory(uiState, urlParts); changeSearchResultsLabel(); } - } function handleRefreshState(jsonData) { if (checkJsonData(jsonData, 'handleRefreshState')) { updateStateAndPage(jsonData, true); } $("#spinner").remove(); } function handleErrorState(jqXHR, textStatus) { cart.defaultErrorCallback(jqXHR, textStatus); $("#spinner").remove(); } function sendUserSearch() { // User has clicked the search button, if they also entered a search