Interactive interface for browsing global, full-resolution satellite imagery
change checkbox name, hide unavailable collections
Jason Kentf0027c624d33
diff --git a/e2e/features/smart-handoff/smart-handoff-test.js b/e2e/features/smart-handoff/smart-handoff-test.jsindex 5d55d0ec4..853808455 100644--- a/e2e/features/smart-handoff/smart-handoff-test.js+++ b/e2e/features/smart-handoff/smart-handoff-test.js@@ -59,7 +59,7 @@ module.exports = {.to.have.text.equal('Available granules for 2019 Dec 01: 289');},- 'Enable target area selection': (c) => {+ 'Enable area of interest': (c) => {c.click('#chk-crop-toggle');c.assert.containsText('.granule-count > h1', 'of 289');},diff --git a/web/js/components/smart-handoffs/smart-handoff-granule-alert.js b/web/js/components/smart-handoffs/smart-handoff-granule-alert.jsindex 78c35600b..4601c5943 100644--- a/web/js/components/smart-handoffs/smart-handoff-granule-alert.js+++ b/web/js/components/smart-handoffs/smart-handoff-granule-alert.js@@ -25,11 +25,11 @@ const GranuleAlertModalBody = () => (<p>You may also see NONE or “0 out of n” granules when:</p><ol><li>- The target area selection does not encompass any of the imagery displayed on the map.+ The area of interest does not encompass any of the imagery displayed on the map.</li><li>- The target area selection is encompassing imagery but the collection's metadata record does not contain the appropriate spatial- information for this feature to work. Unchecking the "Target Area Selection" box should address this.+ The area of interest is encompassing imagery but the collection's metadata record does not contain the appropriate spatial+ information for this feature to work. Unchecking the "Set Area of Interest" box should address this.</li></ol>diff --git a/web/js/containers/sidebar/smart-handoff.js b/web/js/containers/sidebar/smart-handoff.jsindex ce1c60fd5..65157c3c3 100644--- a/web/js/containers/sidebar/smart-handoff.js+++ b/web/js/containers/sidebar/smart-handoff.js@@ -78,7 +78,7 @@ class SmartHandoff extends Component {*/componentDidUpdate(prevProps) {const {- activeLayers,+ availableLayers,displayDate,proj,} = this.props;@@ -89,7 +89,7 @@ class SmartHandoff extends Component {} = this.state;// Determine if existing selected layer is active still and visibility toggle is 'ON'- const isLayerStillActive = activeLayers.find(({ id }) => selectedLayer && selectedLayer.id);+ const isLayerStillActive = availableLayers.find(({ id }) => selectedLayer && selectedLayer.id);if (selectedCollection && !isLayerStillActive) {// eslint-disable-next-line react/no-did-update-set-state@@ -330,15 +330,13 @@ class SmartHandoff extends Component {* Render radio buttons for layer selection*/renderLayerChoices() {- const { activeLayers } = this.props;+ const { availableLayers } = this.props;const { selectedCollection, selectedLayer } = this.state;return (<div className="smart-handoff-layer-list">- {activeLayers.map((layer) => {- if (!layer.conceptIds) return;-+ {availableLayers.map((layer) => {const layerIsSelected = (selectedLayer || {}).id === layer.id;const itemClass = layerIsSelected ? 'layer-item selected' : 'layer-item';@@ -407,7 +405,7 @@ class SmartHandoff extends Component {<div className="smart-handoff-crop-toggle"><Checkboxid="chk-crop-toggle"- label="Target Area Selection"+ label="Set Area of Interest"text="Toggle boundary selection."color="gray"checked={showBoundingBox}@@ -517,7 +515,7 @@ class SmartHandoff extends Component {*/render() {const {- activeLayers,+ availableLayers,isActive,showNotAvailableModal,} = this.props;@@ -530,9 +528,8 @@ class SmartHandoff extends Component {// Determine if the download button is enabledconst isValidDownload = selectedLayer && selectedLayer.id;- const availableLayers = activeLayers.filter(({ conceptIds }) => conceptIds).length;- if (!availableLayers > 0) {+ if (!availableLayers.length) {return this.renderNoLayersToDownload();}return (@@ -569,7 +566,7 @@ class SmartHandoff extends Component {*/SmartHandoff.propTypes = {isActive: PropTypes.bool,- activeLayers: PropTypes.array,+ availableLayers: PropTypes.array,displayDate: PropTypes.string,map: PropTypes.object.isRequired,proj: PropTypes.object,@@ -602,10 +599,14 @@ const mapStateToProps = (state) => {const selectedDate = getSelectedDate(state);const selectedDateFormatted = moment.utc(selectedDate).format('YYYY-MM-DD'); // 2020-01-01const displayDate = moment.utc(selectedDate).format('YYYY MMM DD'); // 2020 JAN 01- const filterForSmartHandoff = ({ projections, disableSmartHandoff }) => projections[proj.id] && !disableSmartHandoff;+ const filterForSmartHandoff = (layer) => {+ const { projections, disableSmartHandoff, conceptIds } = layer;+ const filteredConceptIds = (conceptIds || []).filter(({ type, value, version }) => type && value && version);+ return projections[proj.id] && !disableSmartHandoff && !!filteredConceptIds.length;+ };return {- activeLayers: getActiveLayers(state).filter(filterForSmartHandoff),+ availableLayers: getActiveLayers(state).filter(filterForSmartHandoff),displayDate,map,proj: proj.selected,