Skip to content

Commit

Permalink
Fix/metadata dialog fix: initialSearch variable fix (#29)
Browse files Browse the repository at this point in the history
* /deploy sit

* /deploy sit

* feature/remove-on-prem: remove cut scanline reference

* /deploy sit

* fix/metedata-dialog-fix

* fix/metadata-dialog-fix: fixed issue with initalSearch variable

---------

Co-authored-by: jbyrne <[email protected]>
  • Loading branch information
jbyrne6 and jbyrne authored Sep 1, 2023
1 parent 8809607 commit 4586d2b
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions src/jpl/dijit/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,7 @@ define([
var facets = results.facets;
_context.facetSelector.addFacetItems(facets);
_context.searchFacetTagContainer.addFacetItems(facets);

// Populate search results with initial results from date range and region
var datasets = results.datasets;
var obj = {};
datasets.forEach(function(val) {
obj[val["Dataset-PersistentId"]] = val;
});
_context.initialSearch = obj;
topic.publish(SearchEvent.prototype.SEARCH_LOADED, {
success: true
});
_context.setInitialSearch(results.datasets)
}, function(error) {
new AlertDialog({
alertTitle: "Server Error",
Expand Down Expand Up @@ -297,6 +287,17 @@ define([
}));
},

setInitialSearch: function(data) {
var obj = {};
data.forEach(function(val) {
obj[val["Dataset-PersistentId"]] = val;
});
this.initialSearch = obj;
topic.publish(SearchEvent.prototype.SEARCH_LOADED, {
success: true
});
},

windowResized: function(message) {
// Resize table
domStyle.set(this.datasetGrid.domNode, "height", (document.body.clientHeight - 700) + 210 + "px");
Expand Down Expand Up @@ -383,6 +384,19 @@ define([
this.fetchDatasets().then(lang.hitch(this, function(response) {
// Format results
var data = _context.formatDatasetResponse(response.response.docs);
if (resetDatasets) {
// set _context.initialSearch again
this.setInitialSearch(data)
var datasets = data;
var obj = {};
datasets.forEach(function(val) {
obj[val["Dataset-PersistentId"]] = val;
});
_context.initialSearch = obj;
topic.publish(SearchEvent.prototype.SEARCH_LOADED, {
success: true
});
}
this.updateDatasetGrid(response, data);
this.updateFacetSelector(response);
if (resetDatasets) {
Expand Down

0 comments on commit 4586d2b

Please sign in to comment.