Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

only include date range for temporal layers

Jason Kent747caabdee9c
diff --git a/web/js/components/smart-handoffs/smart-handoff-modal.js b/web/js/components/smart-handoffs/smart-handoff-modal.js
index 3d497d3b9..f73946942 100644
--- a/web/js/components/smart-handoffs/smart-handoff-modal.js
+++ b/web/js/components/smart-handoffs/smart-handoff-modal.js
@@ -24,6 +24,7 @@ function SmartHandoffModal({
const {
value, title, type, version,
} = selectedCollection;
+ const { dateRanges } = selectedLayer;
const cmrSearchDetailURL = `https://cmr.earthdata.nasa.gov/search/concepts/${value}.html`;
return (
@@ -96,7 +97,6 @@ function SmartHandoffModal({
</div>
<h1> Layer: </h1>
-
<div className="handoff-modal-layer-title">
{selectedLayer.title}
</div>
@@ -104,8 +104,13 @@ function SmartHandoffModal({
{selectedLayer.subtitle}
</div>
- <h1> Date:</h1>
- <div className="handoff-modal-date">{displayDate}</div>
+ {dateRanges && (
+ <>
+ <h1> Date:</h1>
+ <div className="handoff-modal-date">{displayDate}</div>
+ </>
+ )}
+
</div>
<div className="smart-handoff-button-group">
diff --git a/web/js/components/smart-handoffs/util.js b/web/js/components/smart-handoffs/util.js
index caaf2d79f..015c32f9c 100644
--- a/web/js/components/smart-handoffs/util.js
+++ b/web/js/components/smart-handoffs/util.js
@@ -10,7 +10,7 @@ import util from '../../util/util';
* @param {*} extentCoords
* @param {*} showBoundingBox
*/
-export default function openEarthDataSearch(proj, selectedDate, selectedCollection, extentCoords, showBoundingBox) {
+export default function openEarthDataSearch(proj, includeDates, selectedDate, selectedCollection, extentCoords, showBoundingBox) {
googleTagManager.pushEvent({
event: 'smart_handoffs_open_eds',
});
@@ -20,15 +20,19 @@ export default function openEarthDataSearch(proj, selectedDate, selectedCollecti
antarctic: '-90!180!0!2!0!0',
};
const { southWest, northEast } = extentCoords;
- const startDate = `${selectedDate}T00:00:00.000Z`;
- const endDate = `${selectedDate}T23:59:59.999Z`;
const params = {
q: selectedCollection.value,
p: selectedCollection.value,
- '[qt]': `${startDate},${endDate}`,
m: PROJ_CODES[proj],
'sb[0]': showBoundingBox ? `${southWest},${northEast}` : undefined,
};
+
+ if (includeDates) {
+ const startDate = `${selectedDate}T00:00:00.000Z`;
+ const endDate = `${selectedDate}T23:59:59.999Z`;
+ params['[qt]'] = `${startDate},${endDate}`;
+ }
+
const earthDataSearchURL = `https://search.earthdata.nasa.gov/search/granules${util.toQueryString(params)}`;
window.open(earthDataSearchURL, '_blank');
}
diff --git a/web/js/containers/sidebar/smart-handoff.js b/web/js/containers/sidebar/smart-handoff.js
index 12d1e7207..ce1c60fd5 100644
--- a/web/js/containers/sidebar/smart-handoff.js
+++ b/web/js/containers/sidebar/smart-handoff.js
@@ -225,10 +225,13 @@ class SmartHandoff extends Component {
// Used to determine if the added smart-handoff modal should be shown
const { HIDE_EDS_WARNING } = safeLocalStorage.keys;
const hideModal = safeLocalStorage.getItem(HIDE_EDS_WARNING);
+ const { dateRanges } = selectedLayer;
+ const includeDates = dateRanges && dateRanges.length;
const continueToEDS = () => openEarthDataSearch(
- proj.id, selectedDate, selectedCollection, currentExtent, showBoundingBox,
+ proj.id, includeDates, selectedDate, selectedCollection, currentExtent, showBoundingBox,
);
+
if (!hideModal) {
showWarningModal(displayDate, selectedLayer, selectedCollection, continueToEDS);
} else {
@@ -270,14 +273,17 @@ class SmartHandoff extends Component {
// Places the compoent state in a loading state; triggers {...} animation.
this.setState({ isSearchingForGranules: true });
- const startDate = `${selectedDate}T00:00:00.000Z`;
- const endDate = `${selectedDate}T23:59:59.999Z`;
- const dateRange = `${startDate},${endDate}`;
+ const { dateRanges } = selectedLayer;
const params = {
include_granule_counts: true,
- temporal: dateRange,
concept_id: selectedCollection.value,
};
+
+ if (dateRanges) {
+ const startDate = `${selectedDate}T00:00:00.000Z`;
+ const endDate = `${selectedDate}T23:59:59.999Z`;
+ params.temporal = `${startDate},${endDate}`;
+ }
const newState = { isSearchingForGranules: false };
let granuleRequestUrl = `https://cmr.earthdata.nasa.gov/search/collections.json${util.toQueryString(params)}`;