Interactive interface for browsing global, full-resolution satellite imagery
Fix lint and tests #2216
Benjamin Kinge374059fa1b2
diff --git a/web/js/components/layer/settings/palette-threshold.js b/web/js/components/layer/settings/palette-threshold.jsindex f5b6ecdf2..10d3b89df 100644--- a/web/js/components/layer/settings/palette-threshold.js+++ b/web/js/components/layer/settings/palette-threshold.js@@ -2,7 +2,7 @@ import React from 'react';import PropTypes from 'prop-types';import lodashDebounce from 'lodash/debounce';import { Range as RangeInput } from 'rc-slider';-import { getFirstIndexFromRef } from '../../../modules/palettes/util'+import { getFirstIndexFromRef } from '../../../modules/palettes/util';import { Checkbox } from '../../util/checkbox';class ThresholdSelect extends React.Component {diff --git a/web/js/components/layer/settings/settings.js b/web/js/components/layer/settings/settings.jsindex 2549e50c6..a05c25561 100644--- a/web/js/components/layer/settings/settings.js+++ b/web/js/components/layer/settings/settings.js@@ -113,8 +113,8 @@ class LayerSettings extends React.Component {palette={palette}/>) : (- ''- )}+ ''+ )}<PalettesetCustomPalette={setCustomPalette}groupName={groupName}diff --git a/web/js/components/sidebar/paletteLegend.js b/web/js/components/sidebar/paletteLegend.jsindex a5cd8b798..26edd06eb 100644--- a/web/js/components/sidebar/paletteLegend.js+++ b/web/js/components/sidebar/paletteLegend.js@@ -253,8 +253,8 @@ class PaletteLegend extends React.Component {{isMoreThanOneColorBar ? (<div className="wv-palettes-title">{legend.title}</div>) : (- ''- )}+ ''+ )}<div className="colorbar-case"><canvasclassName="wv-palettes-colorbar"@@ -375,8 +375,8 @@ class PaletteLegend extends React.Component {)}</div>) : (- ''- )}+ ''+ )}</React.Fragment>);})}diff --git a/web/js/fixtures.js b/web/js/fixtures.jsindex cbbe57e15..7cf762d1a 100644--- a/web/js/fixtures.js+++ b/web/js/fixtures.js@@ -14,7 +14,7 @@ var fixtures = {light_blue: 'f0f0ffff',dark_blue: '000040'};-fixtures.getState = function () {+fixtures.getState = function() {return {compare: initialCompareState,config: fixtures.config(),@@ -37,6 +37,7 @@ fixtures.getState = function () {},legend: {tooltips: ['0', '1', '2'],+ colors: [fixtures.green, fixtures.yellow, fixtures.red],minLabel: '0',maxLabel: '2',refs: ['0', '1', '2']@@ -56,6 +57,7 @@ fixtures.getState = function () {},legend: {tooltips: ['0', '1', '2'],+ colors: [fixtures.green, fixtures.yellow, fixtures.red],minLabel: '0',maxLabel: '2',refs: ['0', '1', '2']@@ -184,7 +186,7 @@ fixtures.getState = function () {};};-fixtures.config = function () {+fixtures.config = function() {return {pageLoadTime: new Date(),now: new Date(),@@ -365,12 +367,15 @@ fixtures.config = function () {entries: {type: 'scale',colors: [fixtures.green, fixtures.yellow, fixtures.red],- values: [0, 1, 2]+ values: [0, 1, 2],+ refs: ['0', '1', '2']+},legend: {tooltips: ['0', '1', '2'],minLabel: '0',- maxLabel: '2'+ maxLabel: '2',+ refs: ['0', '1', '2']}}]@@ -382,12 +387,15 @@ fixtures.config = function () {entries: {type: 'scale',colors: [fixtures.green, fixtures.yellow, fixtures.red],- values: [0, 1, 2]+ values: [0, 1, 2],+ refs: ['0', '1', '2']+},legend: {tooltips: ['0', '1', '2'],minLabel: '0',- maxLabel: '2'+ maxLabel: '2',+ refs: ['0', '1', '2']}}]diff --git a/web/js/modules/palettes/selectors.js b/web/js/modules/palettes/selectors.jsindex ad2fc981f..7e11f3830 100644--- a/web/js/modules/palettes/selectors.js+++ b/web/js/modules/palettes/selectors.js@@ -109,10 +109,10 @@ export function getCustomPalette(paletteId, customsPaletteConfig) {}return palette;}-var useLookup = function (layerId, palettesObj, state) {+var useLookup = function(layerId, palettesObj, state) {var use = false;var active = palettesObj[layerId].maps;- lodashEach(active, function (palette, index) {+ lodashEach(active, function(palette, index) {if (palette.custom) {use = true;return false;@@ -138,7 +138,7 @@ export function getLookup(layerId, groupstr, state) {groupstr = groupstr || state.compare.activeString;return state.palettes[groupstr][layerId].lookup;}-var updateLookup = function (layerId, palettesObj, state) {+var updateLookup = function(layerId, palettesObj, state) {let newPalettes = palettesObj;if (!useLookup(layerId, newPalettes, state)) {delete newPalettes[layerId];@@ -146,7 +146,7 @@ var updateLookup = function (layerId, palettesObj, state) {}var lookup = {};var active = newPalettes[layerId].maps;- lodashEach(active, function (palette, index) {+ lodashEach(active, function(palette, index) {var oldLegend = palette.legend;var entries = palette.entries;const refs = oldLegend.refs;@@ -172,7 +172,7 @@ var updateLookup = function (layerId, palettesObj, state) {var sourceCount = source.length;var targetCount = target.length;var appliedLegends = [];- lodashEach(source, function (color, index) {+ lodashEach(source, function(color, index) {var targetColor;if (index < min || index > max) {targetColor = '00000000';@@ -230,7 +230,7 @@ export function findIndex(layerId, type, value, index, groupStr, state) {index = index || 0;var values = getPalette(layerId, index, groupStr, state).entries.values;var result;- lodashEach(values, function (check, index) {+ lodashEach(values, function(check, index) {var min = getMinValue(check);var max = getMaxValue(check);if (type === 'min' && value === min) {@@ -335,12 +335,12 @@ export function clearCustomSelector(layerId, index, palettes, state) {}); // remove custom keyreturn updateLookup(layerId, newPalettes, state);}-var prepare = function (layerId, palettesObj, state) {+var prepare = function(layerId, palettesObj, state) {var newPalettes = lodashCloneDeep(palettesObj);if (!newPalettes[layerId]) newPalettes[layerId] = {};var active = newPalettes[layerId];active.maps = active.maps || [];- lodashEach(getRenderedPalette(layerId, undefined, state).maps, function (+ lodashEach(getRenderedPalette(layerId, undefined, state).maps, function(palette,index) {diff --git a/web/js/modules/palettes/util.js b/web/js/modules/palettes/util.jsindex 650843621..f2c5e388c 100644--- a/web/js/modules/palettes/util.js+++ b/web/js/modules/palettes/util.js@@ -45,7 +45,7 @@ export function getCheckerboard() {export function palettesTranslate(source, target) {var translation = [];- lodashEach(source, function (color, index) {+ lodashEach(source, function(color, index) {var sourcePercent = index / source.length;var targetIndex = Math.floor(sourcePercent * target.length);translation.push(target[targetIndex]);@@ -134,7 +134,7 @@ export function drawTicksOnCanvas(ctx, legend, width) {}export function lookup(sourcePalette, targetPalette) {var lookup = {};- lodashEach(sourcePalette.colors, function (sourceColor, index) {+ lodashEach(sourcePalette.colors, function(sourceColor, index) {var source =parseInt(sourceColor.substring(0, 2), 16) +',' +@@ -296,7 +296,7 @@ export function getPaletteAttributeArray(layerId, palettes, state) {return [];}}-const createPaletteAttributeObject = function (def, value, attrObj, count) {+const createPaletteAttributeObject = function(def, value, attrObj, count) {const key = attrObj.key;const attrArray = attrObj.array;let hasAtLeastOnePair = attrObj.isActive;@@ -333,7 +333,7 @@ export function loadPalettes(permlinkState, state) {];}lodashEach(stateArray, stateObj => {- lodashEach(state.layers[stateObj.groupStr], function (layerDef) {+ lodashEach(state.layers[stateObj.groupStr], function(layerDef) {if (layerDef.palette) {var layerId = layerDef.id;var min = [];@@ -341,7 +341,7 @@ export function loadPalettes(permlinkState, state) {var squash = [];var count = 0;if (layerDef.custom) {- lodashEach(layerDef.custom, function (value, index) {+ lodashEach(layerDef.custom, function(value, index) {try {const newPalettes = setCustomSelector(layerId,@@ -359,7 +359,7 @@ export function loadPalettes(permlinkState, state) {});}if (layerDef.min) {- lodashEach(layerDef.min, function (value, index) {+ lodashEach(layerDef.min, function(value, index) {try {min.push(findPaletteExtremeIndex(@@ -377,7 +377,7 @@ export function loadPalettes(permlinkState, state) {});}if (layerDef.max) {- lodashEach(layerDef.max, function (value, index) {+ lodashEach(layerDef.max, function(value, index) {try {max.push(findPaletteExtremeIndex(