Skip to content

Commit

Permalink
fix/metadata-dialog-fix: fixed issue with initalSearch variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jbyrne committed Sep 1, 2023
1 parent ea6fb2a commit 0fc9ef7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 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
1 change: 0 additions & 1 deletion src/jpl/dijit/ui/MetadataDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ define([
domAttr.set(this.metadataAlongAcrossRes, "innerHTML", "Not Available");

/* Set date range */
console.log(metadata)
var startDate = metadata["DatasetCoverage-StartTimeLong"];
var formattedStart = "Unknown";
if (startDate) {
Expand Down

0 comments on commit 0fc9ef7

Please sign in to comment.