Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add validation check to see if avaiable layers is an empty array

Edward Plato3ce506a3e82e
diff --git a/web/js/components/image-download/grid.js b/web/js/components/image-download/grid.js
index f15c34d87..7c27eb926 100644
--- a/web/js/components/image-download/grid.js
+++ b/web/js/components/image-download/grid.js
@@ -12,7 +12,7 @@ import Button from '../util/button';
export default class ResolutionTable extends React.Component {
renderImageSize() {
var size = this.props.fileSize;
- if (!this.props.valid) {
+ if (!this.props.validSize) {
return (
<div
id="wv-image-size"
@@ -33,7 +33,7 @@ export default class ResolutionTable extends React.Component {
render() {
const imageSize = this.renderImageSize();
- const { width, height, onClick, valid } = this.props;
+ const { width, height, maxImageSize, onClick, validLayers, validSize } = this.props;
return (
<div className="wv-image-download-grid">
<div className="grid-child grid-head">
@@ -45,12 +45,12 @@ export default class ResolutionTable extends React.Component {
{imageSize}
<div
className={
- this.props.valid
+ validSize
? 'grid-child wv-image-max-size'
: 'grid-child wv-image-max-size wv-image-size-invalid'
}
>
- <span>{this.props.maxImageSize}</span>
+ <span>{maxImageSize}</span>
</div>
<div
className="grid-child wv-image-dimensions"
@@ -65,7 +65,7 @@ export default class ResolutionTable extends React.Component {
onClick={() => {
onClick(width, height);
}}
- valid={valid}
+ valid={validSize && validLayers}
/>
</div>
</div>
@@ -77,6 +77,7 @@ ResolutionTable.propTypes = {
height: PropTypes.number,
maxImageSize: PropTypes.string,
onClick: PropTypes.func,
- valid: PropTypes.bool,
+ validLayers: PropTypes.bool,
+ validSize: PropTypes.bool,
width: PropTypes.number
};
diff --git a/web/js/components/image-download/panel.js b/web/js/components/image-download/panel.js
index d03f3f1f0..51ba537dd 100644
--- a/web/js/components/image-download/panel.js
+++ b/web/js/components/image-download/panel.js
@@ -156,13 +156,14 @@ export default class ImageResSelection extends React.Component {
}
render() {
- const { projection, lonlats, resolutions, maxImageSize } = this.props;
+ const { getLayers, projection, lonlats, resolutions, maxImageSize } = this.props;
const { resolution, debugUrl } = this.state;
const dimensions = getDimensions(projection.id, lonlats, resolution);
const height = dimensions.height;
const width = dimensions.width;
const filetypeSelect = this._renderFileTypeSelect();
const worldfileSelect = this._renderWorldfileSelect();
+ const layerList = getLayers();
return (
<div className="wv-re-pick-wrapper wv-image">
<div
@@ -187,7 +188,8 @@ export default class ImageResSelection extends React.Component {
height={height}
fileSize={((width * height * 24) / 8388608).toFixed(2)}
maxImageSize={maxImageSize}
- valid={imageSizeValid(height, width, MAX_DIMENSION_SIZE)}
+ validSize={imageSizeValid(height, width, MAX_DIMENSION_SIZE)}
+ validLayers={layerList.length > 0}
onClick={this.onDownload.bind(this)}
/>
</div>