Interactive interface for browsing global, full-resolution satellite imagery
add comments and make code more readable
Benjamin King0e822308ca3b
diff --git a/web/js/components/layer/settings/palette.js b/web/js/components/layer/settings/palette.jsindex 40bed412a..baadba11d 100644--- a/web/js/components/layer/settings/palette.js+++ b/web/js/components/layer/settings/palette.js@@ -196,6 +196,7 @@ PaletteSelect.propTypes = {getDefaultLegend: PropTypes.func,getCustomPalette: PropTypes.func,canvas: PropTypes.object,+ groupName: PropTypes.string,checkerBoard: PropTypes.object,activePalette: PropTypes.string};diff --git a/web/js/components/layer/settings/settings.js b/web/js/components/layer/settings/settings.jsindex aee2c8f3e..2e7ffa56c 100644--- a/web/js/components/layer/settings/settings.js+++ b/web/js/components/layer/settings/settings.js@@ -18,7 +18,7 @@ import {getLegend} from '../../../modules/palettes/selectors';import {- setRange,+ setRangeAndSquash,setCustom,clearCustom} from '../../../modules/palettes/actions';@@ -251,8 +251,10 @@ function mapStateToProps(state) {};}const mapDispatchToProps = dispatch => ({- setRange: (layerId, min, max, isSquashed, index, groupName) => {- dispatch(setRange(layerId, min, max, isSquashed, index, groupName));+ setRange: (layerId, min, max, squash, index, groupName) => {+ dispatch(+ setRangeAndSquash(layerId, { min, max, squash }, index, groupName)+ );},setCustom: (layerId, paletteId, index, groupName) => {dispatch(setCustom(layerId, paletteId, index, groupName));diff --git a/web/js/location.js b/web/js/location.jsindex 5505dc148..98800d22a 100644--- a/web/js/location.js+++ b/web/js/location.js@@ -19,6 +19,12 @@ import { mapLocationToPaletteState } from './modules/palettes/util';import util from './util/util';import update from 'immutability-helper';+/**+ * Override state with information from location.search+ * mapLocationToState+ * @param {Object} state | Default state object+ * @param {Object} location | Redux-location-state Location object+ */export function mapLocationToState(state, location) {const config = state.config;if (location.search) {@@ -42,16 +48,16 @@ export function mapLocationToState(state, location) {stateFromLocation = mapLocationToPaletteState(parameters,stateFromLocation,- state+ state,+ config);- // one level deep merge+ // one level deep merge of newState with defaultStatefor (var key in stateFromLocation) {const obj = lodashAssign({}, state[key], stateFromLocation[key]);stateFromLocation = update(stateFromLocation, {[key]: { $set: obj }});}-return update(state, { $merge: stateFromLocation });} else {const startTour = checkTourBuildTimestamp(state.config);diff --git a/web/js/main.js b/web/js/main.jsindex 184f6f522..77ea6e832 100644--- a/web/js/main.js+++ b/web/js/main.js@@ -28,11 +28,16 @@ import { updateLegacyModule } from './modules/migration/actions';import { validate as layerValidate } from './layers/layers';import { polyfill } from './polyfill';import { debugConfig } from './debug';-export let history = createBrowserHistory();+const isDebugMode = typeof DEBUG !== 'undefined';const configURI = Brand.url('config/wv.json');const startTime = new Date().getTime();+// Code for when version of redux dev-tools version stops crashing+// const compose = isDebugMode+// ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ latency: 0 }) ||+// defaultCompose+// : defaultCompose;let parameters = util.fromQueryString(location.search);let elapsed = util.elapsed;let errors = [];diff --git a/web/js/modules/palettes/actions.js b/web/js/modules/palettes/actions.jsindex 0e9a1d23c..4e2e42acc 100644--- a/web/js/modules/palettes/actions.js+++ b/web/js/modules/palettes/actions.js@@ -11,6 +11,12 @@ import {setCustom as setCustomSelector,clearCustom as clearCustomSelector} from './selectors';++/**+ * Request palette using core request utility+ *+ * @param {String} id | Layer Id+ */export function requestPalette(id) {return (dispatch, getState) => {const config = getState().config;@@ -27,14 +33,15 @@ export function requestPalette(id) {};}-export function setRange(layerId, min, max, squash, index, groupName) {+/**+ * @param {String} layerId+ * @param {Object} props | contains min max and squash attributes+ * @param {Number} index | Palette index value for multi-paletted layers+ * @param {String} groupName | layer group string+ */+export function setRangeAndSquash(layerId, props, index, groupName) {return (dispatch, getState) => {const state = getState();- const props = {- min: min,- max: max,- squash: squash- };const newActivePalettesObj = setRangeSelector(layerId,props,@@ -52,6 +59,14 @@ export function setRange(layerId, min, max, squash, index, groupName) {});};}+/**+ * Action to set custom palette+ *+ * @param {String} layerId+ * @param {String} paletteId+ * @param {Number} index | Palette index value for multi-paletted layers+ * @param {String} groupName | layer group string+ */export function setCustom(layerId, paletteId, index, groupName) {return (dispatch, getState) => {const state = getState();@@ -72,6 +87,13 @@ export function setCustom(layerId, paletteId, index, groupName) {});};}+/**+ * Action to remove custom palette+ *+ * @param {String} layerId+ * @param {Number} index | Palette index value for multi-paletted layers+ * @param {String} groupName | layer group string+ */export function clearCustom(layerId, index, groupName) {return (dispatch, getState) => {const { palettes } = getState();@@ -88,6 +110,11 @@ export function clearCustom(layerId, index, groupName) {});};}+/**+ * Action signifying custom palettes have been loaded+ *+ * @param {Object} customs | Custom Palettes from Config+ */export function loadedCustomPalettes(customs) {return {type: LOADED_CUSTOM_PALETTES,