Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

prevent map wings and image download in data download mode, add alert messsage

Ed Plato0a73c26d501f
diff --git a/e2e/features/smart-handoff/smart-handoff-test.js b/e2e/features/smart-handoff/smart-handoff-test.js
index 2d90753f2..d7e039a2d 100644
--- a/e2e/features/smart-handoff/smart-handoff-test.js
+++ b/e2e/features/smart-handoff/smart-handoff-test.js
@@ -15,6 +15,7 @@ const SSTRadioButton = '#C1664741463-PODAAC-GHRSST_L4_MUR_Sea_Surface_Temperatur
const urlParams = '?l=Reference_Labels_15m(hidden),Reference_Features_15m(hidden),Coastlines_15m&t=2019-12-01';
const permalinkParams = '?l=GHRSST_L4_MUR_Sea_Surface_Temperature,MODIS_Aqua_Aerosol_Optical_Depth_3km&lg=true&sh=MODIS_Aqua_Aerosol_Optical_Depth_3km,C1443528505-LAADS&t=2020-02-06-T06%3A00%3A00Z';
const permalinkParams1980 = '?l=GHRSST_L4_MUR_Sea_Surface_Temperature,MODIS_Aqua_Aerosol_Optical_Depth_3km&lg=true&sh=MODIS_Aqua_Aerosol_Optical_Depth_3km,C1443528505-LAADS&t=1980-02-06-T06%3A00%3A00Z';
+const inWingsAlertURL = '?v=226.32336353630282,-35.84415340249873,233.47009302183025,-31.309041515170094&l=VIIRS_NOAA20_Thermal_Anomalies_375m_All,Coastlines_15m,MODIS_Terra_CorrectedReflectance_TrueColor&lg=false&sh=VIIRS_NOAA20_Thermal_Anomalies_375m_All,C1355615368-LANCEMODIS&t=2021-08-29-T17%3A56%3A03Z';
module.exports = {
@@ -105,6 +106,16 @@ module.exports = {
.to.have.text.equal('None of your current layers are available for download.');
},
+ 'Map extent entirely in wings displays warning for user to zoom out to see available map': (c) => {
+ c.url(c.globals.url + inWingsAlertURL);
+ c.pause(5000);
+ c.expect.element('#map-zoomed-into-wings-alert').to.be.present;
+ c.waitForElementVisible('#map-zoomed-into-wings-alert', TIME_LIMIT, () => {
+ c.assert.containsText('#map-zoomed-into-wings-alert div.wv-alert-message',
+ 'The view is zoomed into the map wings which are unavailable in data download mode. Zoom out to see available map.');
+ });
+ },
+
after(c) {
c.end();
},
diff --git a/web/js/containers/sidebar/smart-handoff.js b/web/js/containers/sidebar/smart-handoff.js
index 620e12899..0e00d1462 100644
--- a/web/js/containers/sidebar/smart-handoff.js
+++ b/web/js/containers/sidebar/smart-handoff.js
@@ -11,6 +11,7 @@ import { UncontrolledTooltip } from 'reactstrap';
import Button from '../../components/util/button';
import Checkbox from '../../components/util/checkbox';
import Crop from '../../components/util/image-crop';
+import AlertUtil from '../../components/util/alert';
import util from '../../util/util';
import SmartHandoffModal from '../../components/smart-handoffs/smart-handoff-modal';
import SmartHandoffNotAvailableModal from '../../components/smart-handoffs/smart-handoff-not-available-modal';
@@ -51,6 +52,7 @@ class SmartHandoff extends Component {
y2: screenHeight / 2 + 100,
},
showBoundingBox: false,
+ showZoomedIntoWingsAlert: false,
currentExtent: {},
coordinates: {},
validatedLayers: [],
@@ -65,13 +67,19 @@ class SmartHandoff extends Component {
}
componentDidMount() {
+ const { proj } = this.props;
this.validateConceptIds();
+ if (proj.id === 'geographic') {
+ this.checkMapExtentWithinWings();
+ }
}
componentDidUpdate(prevProps) {
const {
+ isActive,
availableLayers,
proj,
+ map,
selectedLayer,
selectedCollection,
} = this.props;
@@ -86,7 +94,19 @@ class SmartHandoff extends Component {
this.setState(this.baseState);
}
if (proj.id !== prevProps.proj.id) {
- this.setState({ showBoundingBox: false });
+ const projChangeStateUpdate = { showBoundingBox: false };
+ if (proj.id !== 'geographic') {
+ projChangeStateUpdate.showZoomedIntoWingsAlert = false;
+ }
+ this.setState(projChangeStateUpdate);
+ }
+
+ if (proj.id === 'geographic') {
+ const tabChange = isActive && !prevProps.isActive;
+ const extentChange = !lodashEqual(map.extent, prevProps.map.extent);
+ if (tabChange || extentChange) {
+ this.checkMapExtentWithinWings();
+ }
}
}
@@ -123,6 +143,19 @@ class SmartHandoff extends Component {
this.setState({ validatedLayers, validatedConceptIds });
}
+ /**
+ * Check if entire map extent is within a wing that is not available in data download
+ *
+ * @returns {Boolean} is map extent within wing
+ */
+ checkMapExtentWithinWings = () => {
+ const { map: { extent }, proj: { maxExtent } } = this.props;
+ const inLeftWing = extent[0] < maxExtent[0] && extent[2] < maxExtent[0];
+ const inRightWing = extent[0] > maxExtent[2] && extent[2] > maxExtent[2];
+ const isWithinWings = inLeftWing || inRightWing;
+ this.setState({ showZoomedIntoWingsAlert: isWithinWings });
+ }
+
/**
* Fires when the bounding box / crop toggle is activated and changed
*/
@@ -246,6 +279,23 @@ class SmartHandoff extends Component {
}
}
+ /**
+ * Render alert to indicate the map view is zoomed entirely into the map wings (geographic projection only)
+ * Typically from activeTab change to data download when zoomed into wing, but triggers on changing the extent as well
+ */
+ renderZoomedIntoWingsAlert = () => {
+ const { showZoomedIntoWingsAlert } = this.state;
+ const message = 'The view is zoomed into the map wings which are unavailable in data download mode. Zoom out to see available map.';
+ return showZoomedIntoWingsAlert && (
+ <AlertUtil
+ id="map-zoomed-into-wings-alert"
+ isOpen
+ title="Map Zoomed Into Unavailable Wings"
+ message={message}
+ />
+ );
+ }
+
renderCollectionTooltip = ({ value, title }, tooltipTarget) => {
const cmrSearchDetailURL = `https://cmr.earthdata.nasa.gov/search/concepts/${value}.html`;
return (
@@ -438,37 +488,39 @@ class SmartHandoff extends Component {
return this.renderNoLayersToDownload();
}
return (
- <div className="smart-handoff-side-panel">
-
- <div className="esd-notification">
- Downloading data will be performed using
- <a href="https://search.earthdata.nasa.gov" target="_blank" rel="noopener noreferrer"> NASA&apos;s Earthdata Search </a>
- application.
+ <>
+ {this.renderZoomedIntoWingsAlert()}
+ <div className="smart-handoff-side-panel">
+ <div className="esd-notification">
+ Downloading data will be performed using
+ <a href="https://search.earthdata.nasa.gov" target="_blank" rel="noopener noreferrer"> NASA&apos;s Earthdata Search </a>
+ application.
+ </div>
+ <h2>
+ <a className="help-link" onClick={showNotAvailableModal}>
+ Why are some layers not available?
+ </a>
+ </h2>
+ <hr />
+ {this.renderLayerChoices()}
+ <hr />
+ {this.renderCropBox()}
+ <GranuleCount
+ displayDate={displayDate}
+ currentExtent={showBoundingBox ? currentExtent : undefined}
+ selectedDate={selectedDate}
+ selectedLayer={selectedLayer}
+ selectedCollection={selectedCollection}
+ showGranuleHelpModal={showGranuleHelpModal}
+ />
+ <Button
+ onClick={this.onClickDownload}
+ text="DOWNLOAD VIA EARTHDATA SEARCH"
+ className="download-btn red"
+ valid={!!isValidDownload}
+ />
</div>
- <h2>
- <a className="help-link" onClick={showNotAvailableModal}>
- Why are some layers not available?
- </a>
- </h2>
- <hr />
- {this.renderLayerChoices()}
- <hr />
- {this.renderCropBox()}
- <GranuleCount
- displayDate={displayDate}
- currentExtent={showBoundingBox ? currentExtent : undefined}
- selectedDate={selectedDate}
- selectedLayer={selectedLayer}
- selectedCollection={selectedCollection}
- showGranuleHelpModal={showGranuleHelpModal}
- />
- <Button
- onClick={this.onClickDownload}
- text="DOWNLOAD VIA EARTHDATA SEARCH"
- className="download-btn red"
- valid={!!isValidDownload}
- />
- </div>
+ </>
);
}
}
diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js
index a8f055649..515983053 100644
--- a/web/js/containers/toolbar.js
+++ b/web/js/containers/toolbar.js
@@ -365,7 +365,7 @@ class toolbarContainer extends Component {
const mapStateToProps = (state) => {
const {
- animation, browser, notifications, palettes, compare, map, measure, modal, ui, locationSearch, events, proj,
+ animation, sidebar, browser, notifications, palettes, compare, map, measure, modal, ui, locationSearch, events, proj,
} = state;
const { isDistractionFreeModeActive } = ui;
const { number, type } = notifications;
@@ -377,6 +377,8 @@ const mapStateToProps = (state) => {
const isLocationSearchExpanded = locationSearch.isExpanded;
const activePalettes = palettes[activeString];
const { isAnimatingToEvent } = events;
+ const { activeTab } = sidebar;
+ const isDataDownloadTabActive = activeTab === 'download';
// Collapse when Image download / GIF / is open or measure tool active
const snapshotModalOpen = modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT';
@@ -392,7 +394,7 @@ const mapStateToProps = (state) => {
activePalettes,
isImageDownloadActive: Boolean(
lodashGet(state, 'map.ui.selected')
- && !isCompareActive,
+ && !isCompareActive && !isDataDownloadTabActive,
),
isAnimatingToEvent,
hasNonDownloadableLayer: hasNonDownloadableVisibleLayer(visibleLayersForProj),
diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js
index 17d3ac7a3..d243061be 100644
--- a/web/js/map/layerbuilder.js
+++ b/web/js/map/layerbuilder.js
@@ -91,6 +91,7 @@ export default function mapLayerBuilder(config, cache, store) {
*/
self.createLayer = function(def, options) {
const state = store.getState();
+ const { sidebar: { activeTab } } = state;
options = options || {};
const group = options.group || null;
const { closestDate, nextDate, previousDate } = self.getRequestDates(def, options);
@@ -120,7 +121,8 @@ export default function mapLayerBuilder(config, cache, store) {
lodashMerge(def, def.projections[proj.id]);
if (def.breakPointLayer) def = mergeBreakpointLayerAttributes(def, proj.id);
- const wrapLayer = proj.id === 'geographic' && (def.wrapadjacentdays === true || def.wrapX);
+ const isDataDownloadTabActive = activeTab === 'download';
+ const wrapLayer = proj.id === 'geographic' && !isDataDownloadTabActive && (def.wrapadjacentdays === true || def.wrapX);
switch (def.type) {
case 'wmts':
layer = getLayer(createLayerWMTS, def, options, attributes, wrapLayer);
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index aadfe95f1..9c0434818 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -33,6 +33,7 @@ import { getActiveLayerGroup, fly, saveRotation } from './util';
import mapCompare from './compare/compare';
import { LOCATION_POP_ACTION } from '../redux-location-state-customs';
import { CHANGE_PROJECTION } from '../modules/projection/constants';
+import { CHANGE_TAB } from '../modules/sidebar/constants';
import {
CLEAR_MARKER,
SET_MARKER,
@@ -124,6 +125,15 @@ export default function mapui(models, config, store, ui) {
});
return;
}
+ case CHANGE_TAB: {
+ const { sidebar, proj } = state;
+ const { activeTab, previousTab } = sidebar;
+ const dataDownloadTabSwitched = activeTab === 'download' || previousTab === 'download';
+ if (proj.id === 'geographic' && dataDownloadTabSwitched) {
+ return reloadLayers();
+ }
+ return;
+ }
case LOCATION_POP_ACTION: {
const newState = util.fromQueryString(action.payload.search);
const extent = lodashGet(state, 'map.extent');
diff --git a/web/js/modules/sidebar/reducers.js b/web/js/modules/sidebar/reducers.js
index 1753f7790..774d894e0 100644
--- a/web/js/modules/sidebar/reducers.js
+++ b/web/js/modules/sidebar/reducers.js
@@ -11,11 +11,11 @@ import {
import safeLocalStorage from '../../util/local-storage';
const { SIDEBAR_COLLAPSED } = safeLocalStorage.keys;
-const wasCallapseRequested = safeLocalStorage.getItem(SIDEBAR_COLLAPSED) === 'collapsed';
+const wasCollapseRequested = safeLocalStorage.getItem(SIDEBAR_COLLAPSED) === 'collapsed';
export const sidebarState = {
- isCollapsed: wasCallapseRequested || false,
- wasCallapseRequested,
+ isCollapsed: wasCollapseRequested || false,
activeTab: 'layers',
+ previousTab: null,
mobileCollapsed: true,
};
@@ -23,6 +23,7 @@ export default function sidebarReducer(state = sidebarState, action) {
switch (action.type) {
case CHANGE_TAB:
return lodashAssign({}, state, {
+ previousTab: state.activeTab,
activeTab: action.activeTab,
});
case TOGGLE_COLLAPSE: