Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix data download modal rendering - redux-store

Benjamin King0e2c9334e8c1
diff --git a/web/js/containers/sidebar/footer-content.js b/web/js/containers/sidebar/footer-content.js
index dc725ceab..4022af946 100644
--- a/web/js/containers/sidebar/footer-content.js
+++ b/web/js/containers/sidebar/footer-content.js
@@ -164,7 +164,8 @@ function mapStateToProps(state, ownProps) {
dataSelectionSize,
compareFeature: config.features.compare,
isCompareActive: compare.active,
- compareMode: compare.mode
+ compareMode: compare.mode,
+ toggleListAll
};
}
export default connect(
@@ -173,7 +174,7 @@ export default connect(
)(FooterContent);
FooterContent.propTypes = {
- showListAllButton: PropTypes.bool,
+ showAll: PropTypes.bool,
isCompareActive: PropTypes.bool,
compareMode: PropTypes.string,
isMobile: PropTypes.bool,
@@ -186,5 +187,6 @@ FooterContent.propTypes = {
toggleCompare: PropTypes.func,
counts: PropTypes.object,
dataSelectionSize: PropTypes.number,
- compareFeature: PropTypes.bool
+ compareFeature: PropTypes.bool,
+ toggleListAll: PropTypes.func
};
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 1884c1f9c..27dd6d3cf 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -14,7 +14,7 @@ import AnimationWidget from '../animation-widget';
import AnimationButton from '../../components/timeline/timeline-controls/animation-button';
import AxisTimeScaleChange from '../../components/timeline/timeline-controls/axis-timescale-change';
-import {debounce as lodashDebounce, get as lodashGet} from 'lodash';
+import { debounce as lodashDebounce, get as lodashGet } from 'lodash';
import {
hasSubDaily,
diff --git a/web/js/main.js b/web/js/main.js
index 54c40a44a..452531ae9 100644
--- a/web/js/main.js
+++ b/web/js/main.js
@@ -5,7 +5,6 @@ import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, compose } from 'redux';
-import { each as lodashEach, debounce as lodashDebounce } from 'lodash';
import { responsiveStoreEnhancer } from 'redux-responsive';
import { getMiddleware } from './combine-middleware';
import {
@@ -24,7 +23,6 @@ import { combineModels } from './combine-models';
import { parse } from './parse';
import { combineUi } from './combine-ui';
import { requirements as paletteRequirements } from './modules/palettes/util';
-import { updateLegacyModule } from './modules/migration/actions';
import { validate as layerValidate } from './modules/layers/util';
import { polyfill } from './polyfill';
import { debugConfig } from './debug';
diff --git a/web/js/map/data/ui.js b/web/js/map/data/ui.js
index bbe247df3..55860a6c6 100644
--- a/web/js/map/data/ui.js
+++ b/web/js/map/data/ui.js
@@ -433,7 +433,7 @@ var dataUiDownloadListPanel = function(config, store) {
self.refresh = function() {
const dataState = store.getState().data;
- selection = reformatSelection();
+ selection = reformatSelection(dataState);
$('#wv-data-selection').html(bodyText(selection));
var bulkVisible =
isBulkDownloadable() && lodashSize(dataState.selectedGranules) !== 0;
@@ -462,11 +462,11 @@ var dataUiDownloadListPanel = function(config, store) {
return false;
};
- var reformatSelection = function() {
+ var reformatSelection = function(dataState) {
var selection = {};
urs = false;
- $.each(dataStore.selectedGranules, function(key, granule) {
+ $.each(dataState.selectedGranules, function(key, granule) {
if (granule.urs) {
urs = true;
}
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 7257b81f3..37cb2288f 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -3,7 +3,6 @@ import lodashFindIndex from 'lodash/findIndex';
import lodashEach from 'lodash/each';
import lodashForOwn from 'lodash/forOwn';
import lodashThrottle from 'lodash/throttle';
-import { get as lodashGet, debounce as lodashDebounce, cloneDeep as lodashCloneDeep, find as lodashFind} from 'lodash';
import util from '../util/util';
import OlMap from 'ol/Map';
import OlView from 'ol/View';
@@ -39,6 +38,12 @@ import {
getLayers,
isRenderable as isRenderableLayer
} from '../modules/layers/selectors';
+import {
+ get as lodashGet,
+ debounce as lodashDebounce,
+ cloneDeep as lodashCloneDeep,
+ find as lodashFind
+} from 'lodash';
export function mapui(models, config, store, ui) {
var layerBuilder, createLayer;
diff --git a/web/js/modules/data/selectors.js b/web/js/modules/data/selectors.js
index 44ddb79b7..4091df20e 100644
--- a/web/js/modules/data/selectors.js
+++ b/web/js/modules/data/selectors.js
@@ -28,9 +28,10 @@ export function getSelectionCounts(layers, selectedGranules) {
export function getDataSelectionSize(selectedGranules) {
var totalSize = 0;
var sizeValid = true;
- lodashEach(selectedGranules, function(index, granule) {
- if (sizeValid && granule.granule_size) {
- totalSize += parseFloat(granule.granule_size);
+ lodashEach(selectedGranules, function(granule, key) {
+ const size = granule.granule_size;
+ if (sizeValid && size) {
+ totalSize += parseFloat(size);
} else {
sizeValid = false;
}
@@ -38,6 +39,7 @@ export function getDataSelectionSize(selectedGranules) {
if (sizeValid) {
return totalSize;
}
+ return sizeValid ? totalSize : 0;
}
export function groupByProducts(config, dataProducts) {
let products = {};