Interactive interface for browsing global, full-resolution satellite imagery
cleanup alert trigger logic, update message and e2e
Ed Platoa0c35d917d3c
diff --git a/e2e/features/smart-handoff/smart-handoff-test.js b/e2e/features/smart-handoff/smart-handoff-test.jsindex dd5f00c9a..8a579719a 100644--- a/e2e/features/smart-handoff/smart-handoff-test.js+++ b/e2e/features/smart-handoff/smart-handoff-test.js@@ -16,7 +16,7 @@ const SSTRadioButton = '#C1664741463-PODAAC-GHRSST_L4_MUR_Sea_Surface_Temperaturconst 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 extentInWingsAlertURL = '?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';+const extentCrossedDateline = '?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 = {@@ -94,13 +94,13 @@ module.exports = {.to.have.text.equal('None of your current layers are available for download.');},- 'Map extent entirely in wings disabled download button and displays warning for user to zoom out to see available map': (c) => {- c.url(c.globals.url + extentInWingsAlertURL);+ 'Map extent entirely across dateline disables download button and displays warning for user to zoom out to see available map': (c) => {+ c.url(c.globals.url + extentCrossedDateline);c.expect.element(downloadButton).to.be.visible;c.useCss().assert.cssClassPresent(downloadButton, 'wv-disabled');c.waitForElementVisible('#data-download-unavailable-dateline-alert', TIME_LIMIT, () => {c.assert.containsText('#data-download-unavailable-dateline-alert div.wv-alert-message',- 'The map is zoomed into an area that crossed the dateline which is unavailable in data download mode. Zoom out to see available map.');+ 'The map is zoomed into an area that crossed the dateline and is outside of the available map in data mode. Download is disabled. Zoom out to see available map.');});},diff --git a/web/js/containers/sidebar/smart-handoff.js b/web/js/containers/sidebar/smart-handoff.jsindex ae705ac8e..a0feeeaee 100644--- a/web/js/containers/sidebar/smart-handoff.js+++ b/web/js/containers/sidebar/smart-handoff.js@@ -52,9 +52,9 @@ class SmartHandoff extends Component {y2: screenHeight / 2 + 100,},showBoundingBox: false,- showZoomedIntoDatelineArea: false,- showAreaOfInterestCrossedDateline: false,- showEntireAreaOfInterestCrossedDateline: false,+ showZoomedIntoDatelineAlert: false,+ showAOICrossedDateline: false,+ showEntireAOICrossedDateline: false,currentExtent: {},coordinates: {},validatedLayers: [],@@ -72,7 +72,7 @@ class SmartHandoff extends Component {const { proj } = this.props;this.validateConceptIds();if (proj.id === 'geographic') {- this.checkMapExtentWithinWings();+ this.checkMapExtentValid();}}@@ -98,7 +98,7 @@ class SmartHandoff extends Component {if (proj.id !== prevProps.proj.id) {const projChangeStateUpdate = { showBoundingBox: false };if (proj.id !== 'geographic') {- projChangeStateUpdate.showZoomedIntoDatelineArea = false;+ projChangeStateUpdate.showZoomedIntoDatelineAlert = false;}this.setState(projChangeStateUpdate);}@@ -107,7 +107,7 @@ class SmartHandoff extends Component {const tabChange = isActive && !prevProps.isActive;const extentChange = !lodashEqual(map.extent, prevProps.map.extent);if (tabChange || extentChange) {- this.checkMapExtentWithinWings();+ this.checkMapExtentValid();}}}@@ -146,16 +146,16 @@ class SmartHandoff extends Component {}/**- * Check if entire map extent is within a wing that is not available in data download+ * Check if entire map extent is over dateline (within a wing)** @returns {Boolean} is map extent within wing*/- checkMapExtentWithinWings = () => {+ checkMapExtentValid = () => {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({ showZoomedIntoDatelineArea: isWithinWings });+ this.setState({ showZoomedIntoDatelineAlert: isWithinWings });}/**@@ -176,7 +176,6 @@ class SmartHandoff extends Component {* the granule count async requests*/onBoundaryChange(boundaries, setExtent) {- const { showAreaOfInterestCrossedDateline, showEntireAreaOfInterestCrossedDateline } = this.state;const { proj, map, selectedCollection } = this.props;if (!selectedCollection) return;@@ -239,26 +238,7 @@ class SmartHandoff extends Component {geolonlat2[1] = -90;}- if (entireAreaCrossed) {- this.setState({ showEntireAreaOfInterestCrossedDateline: true });- } else if (crossedDateline) {- if (!showAreaOfInterestCrossedDateline) {- this.setState({- showAreaOfInterestCrossedDateline: true,- showEntireAreaOfInterestCrossedDateline: false,- });- }- if (showEntireAreaOfInterestCrossedDateline) {- this.setState({- showEntireAreaOfInterestCrossedDateline: false,- });- }- } else if (showAreaOfInterestCrossedDateline || showEntireAreaOfInterestCrossedDateline) {- this.setState({- showAreaOfInterestCrossedDateline: false,- showEntireAreaOfInterestCrossedDateline: false,- });- }+ this.triggerDatelineAlerts(crossedDateline, entireAreaCrossed);const extent = {southWest: `${geolonlat1[0].toFixed(5)},${geolonlat1[1].toFixed(5)}`,@@ -288,7 +268,7 @@ class SmartHandoff extends Component {} else {this.setState({showBoundingBox: false,- showAreaOfInterestCrossedDateline: false,+ showAOICrossedDateline: false,});}}@@ -329,29 +309,59 @@ class SmartHandoff extends Component {}/**+ * Determine if dateline alert updates are necessary+ *+ * @param {Boolean} crossedDateline+ * @param {Boolean} entireAreaCrossed+ */+ triggerDatelineAlerts = (crossedDateline, entireAreaCrossed) => {+ const { showAOICrossedDateline, showEntireAOICrossedDateline } = this.state;+ if (entireAreaCrossed) {+ this.setState({ showEntireAOICrossedDateline: true });+ } else if (crossedDateline) {+ if (!showAOICrossedDateline) {+ this.setState({+ showAOICrossedDateline: true,+ showEntireAOICrossedDateline: false,+ });+ }+ if (showEntireAOICrossedDateline) {+ this.setState({+ showEntireAOICrossedDateline: false,+ });+ }+ } else if (showAOICrossedDateline || showEntireAOICrossedDateline) {+ this.setState({+ showAOICrossedDateline: false,+ showEntireAOICrossedDateline: false,+ });+ }+ }++ /*** Render alerts to indicate map view/area of interest dateline crossing (geographic projection only):* 1) The map view is zoomed entirely into the map wings* 2) The area of interest crossed the dateline* 3) The entire area of interest crossed the dateline*/- renderWingsAlert = () => {+ renderDatelineWarning = () => {const {showBoundingBox,- showAreaOfInterestCrossedDateline,- showEntireAreaOfInterestCrossedDateline,- showZoomedIntoDatelineArea,+ showAOICrossedDateline,+ showEntireAOICrossedDateline,+ showZoomedIntoDatelineAlert,} = this.state;- const message = showEntireAreaOfInterestCrossedDateline- ? 'The entire area of interest crossed the dateline(s) which is unavailable in data download mode. Select an area within the available map.'- : showAreaOfInterestCrossedDateline- ? 'The area of interest crosses the dateline(s) which is unavailable in data download mode. Available data is cut off at the dateline(s).'- : showZoomedIntoDatelineArea- ? 'The map is zoomed into an area that crossed the dateline which is unavailable in data download mode. Zoom out to see available map.'+ const message = showBoundingBox && showEntireAOICrossedDateline+ ? 'The entire area of interest crossed the dateline and is outside of the available map in data mode. Download is disabled. Select an area within the available map.'+ : showBoundingBox && showAOICrossedDateline+ ? 'The area of interest crosses the dateline(s) which is unavailable in data mode. Available data is cut off at the dateline(s).'+ : showZoomedIntoDatelineAlert+ ? 'The map is zoomed into an area that crossed the dateline and is outside of the available map in data mode. Download is disabled. Zoom out to see available map.': '';- const showAreaOfInterestAlert = showBoundingBox && (showAreaOfInterestCrossedDateline || showEntireAreaOfInterestCrossedDateline);- return (showAreaOfInterestAlert || showZoomedIntoDatelineArea) && (+ const showAOIAlert = showBoundingBox && (showAOICrossedDateline || showEntireAOICrossedDateline);+ return (showAOIAlert || showZoomedIntoDatelineAlert) && (<AlertUtilid="data-download-unavailable-dateline-alert"isOpen@@ -542,21 +552,21 @@ class SmartHandoff extends Component {showGranuleHelpModal,} = this.props;const {- showBoundingBox, showEntireAreaOfInterestCrossedDateline, showZoomedIntoDatelineArea, currentExtent, validatedLayers,+ showBoundingBox, showEntireAOICrossedDateline, showZoomedIntoDatelineAlert, currentExtent, validatedLayers,} = this.state;// Determine if download 'smart-handoff' tab is activated by userif (!isActive) return null;// Determine if the download button is enabled- const isValidDownload = selectedLayer && selectedLayer.id && !showEntireAreaOfInterestCrossedDateline && !showZoomedIntoDatelineArea;+ const isValidDownload = selectedLayer && selectedLayer.id && !showEntireAOICrossedDateline && !showZoomedIntoDatelineAlert;if (!validatedLayers.length) {return this.renderNoLayersToDownload();}return (<>- {this.renderWingsAlert()}+ {this.renderDatelineWarning()}<div className="smart-handoff-side-panel"><div className="esd-notification">Downloading data will be performed using