Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix lint errors #2144

Benjamin King011cf0ea9cad
diff --git a/web/js/app.js b/web/js/app.js
index 0396f63d5..ee562e781 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -140,12 +140,12 @@ class App extends React.Component {
config = self.props.config;
config.parameters = state;
- const main = function () {
+ const main = function() {
const models = self.props.models;
// Load any additional scripts as needed
if (config.scripts) {
- lodashEach(config.scripts, function (script) {
+ lodashEach(config.scripts, function(script) {
$.getScript(script);
});
}
diff --git a/web/js/combine-ui.js b/web/js/combine-ui.js
index f24e7279f..5c204a029 100644
--- a/web/js/combine-ui.js
+++ b/web/js/combine-ui.js
@@ -13,7 +13,7 @@ import naturalEventsUI from './map/natural-events/ui';
export function combineUi(models, config, MapMouseEvents, store) {
const ui = {};
ui.events = util.events();
- const subscribeToStore = function () {
+ const subscribeToStore = function() {
const state = store.getState();
const action = state.lastAction;
return ui.events.trigger('last-action', action);
@@ -24,7 +24,7 @@ export function combineUi(models, config, MapMouseEvents, store) {
ui.supportsPassive = false;
try {
var opts = Object.defineProperty({}, 'passive', {
- get: function () {
+ get: function() {
ui.supportsPassive = true;
}
});
@@ -41,7 +41,7 @@ export function combineUi(models, config, MapMouseEvents, store) {
}
registerMapMouseHandlers(ui.map.proj, MapMouseEvents);
// Sink all focus on inputs if click unhandled
- $(document).click(function (event) {
+ $(document).click(function(event) {
if (event.target.nodeName !== 'INPUT') {
$('input').blur();
}
diff --git a/web/js/components/layer/settings/settings.js b/web/js/components/layer/settings/settings.js
index 519d2d405..8302cb226 100644
--- a/web/js/components/layer/settings/settings.js
+++ b/web/js/components/layer/settings/settings.js
@@ -256,7 +256,7 @@ class LayerSettings extends React.Component {
? this.renderCustomPalettes()
: '';
} else {
- renderCustomizations = '' // this.renderVectorStyles(); for future
+ renderCustomizations = ''; // this.renderVectorStyles(); for future
}
if (!layer.id) return '';
diff --git a/web/js/components/map/ol-coordinates.js b/web/js/components/map/ol-coordinates.js
index 846b432a4..3f89521a8 100644
--- a/web/js/components/map/ol-coordinates.js
+++ b/web/js/components/map/ol-coordinates.js
@@ -11,7 +11,6 @@ import { connect } from 'react-redux';
import { groupBy as lodashGroupBy } from 'lodash';
import { changeCursor } from '../../modules/map/actions';
-
class OlCoordinates extends React.Component {
constructor(props) {
super(props);
@@ -130,7 +129,7 @@ const mapDispatchToProps = dispatch => ({
dispatch(selectVectorFeatures(features));
},
changeCursor: (bool) => {
- dispatch(changeCursor(bool))
+ dispatch(changeCursor(bool));
},
openVectorDiaglog: (dialogId, metaArray, offsetLeft, offsetTop) => {
@@ -143,9 +142,7 @@ const mapDispatchToProps = dispatch => ({
wrapClassName: 'vector-modal-wrap',
modalClassName: 'vector-modal light',
CompletelyCustomModal: vectorDialog,
- isDraggable: true,
isResizable: true,
- offsetTop: 100,
vectorMetaObject: lodashGroupBy(metaArray, 'id'),
width: 445,
height: 300,
diff --git a/web/js/components/vector-metadata/table.js b/web/js/components/vector-metadata/table.js
index 56f3959b2..de9058cbf 100644
--- a/web/js/components/vector-metadata/table.js
+++ b/web/js/components/vector-metadata/table.js
@@ -40,7 +40,6 @@ export default class VectorMetaTable extends React.Component {
<tbody>
{metaLegend.map((properties, index) => {
const featureId = properties.Identifier;
- const hasValueMap = !!properties.ValueMap;
const value = properties.ValueMap ? properties.ValueMap[metaFeatures[featureId]] : metaFeatures[featureId];
const id = util.cleanId(String(title + '-' + (metaIndex + index)));
if (!value) return undefined;
diff --git a/web/js/components/vector-metadata/tooltip.js b/web/js/components/vector-metadata/tooltip.js
index fed057c27..c7c1f61c8 100644
--- a/web/js/components/vector-metadata/tooltip.js
+++ b/web/js/components/vector-metadata/tooltip.js
@@ -1,4 +1,4 @@
-import React, { Fragment } from 'react';
+import React from 'react';
import PropTypes from 'prop-types';
import { Tooltip } from 'reactstrap';
import util from '../../util/util';
@@ -20,16 +20,19 @@ export default class VectorMetaTooltip extends React.Component {
tooltipOpen: !this.state.tooltipOpen
});
}
+
mouseEnter() {
this.setState({
tooltipOpen: true
});
}
+
mouseLeave() {
this.setState({
tooltipOpen: false
});
}
+
render() {
const { id, index, description } = this.props;
const elId = util.cleanId(String('tooltip' + id + index));
diff --git a/web/js/containers/modal.js b/web/js/containers/modal.js
index 63f9ed0dd..94ee45d09 100644
--- a/web/js/containers/modal.js
+++ b/web/js/containers/modal.js
@@ -8,7 +8,7 @@ import { onToggle } from '../modules/modal/actions';
import ErrorBoundary from './error-boundary';
import DetectOuterClick from '../components/util/detect-outer-click';
import Draggable from 'react-draggable';
-import { ResizableBox, Resizable } from 'react-resizable';
+import { Resizable } from 'react-resizable';
const InteractionWrap = ({ condition, wrapper, children }) => condition ? wrapper(children) : children;
const toggleWithClose = (onToggle, onClose, isOpen) => {
if (onClose && isOpen) {
@@ -40,8 +40,7 @@ class ModalContainer extends Component {
width: isResizable ? state.width : props.width,
height: isResizable ? state.height : props.height,
maxHeight: isResizable ? state.height : props.height
- }
-
+ };
}
onResize(e, { size }) {
@@ -56,14 +55,13 @@ class ModalContainer extends Component {
return bodyTemplate.isLoading ? (
<span> Loading </span>
) : (
- <div
- id="template-content"
- dangerouslySetInnerHTML={{ __html: bodyTemplate.response }}
- />
- );
+ <div
+ id="template-content"
+ dangerouslySetInnerHTML={{ __html: bodyTemplate.response }}
+ />
+ );
}
-
render() {
const {
isCustom,
diff --git a/web/js/containers/vector-dialog.js b/web/js/containers/vector-dialog.js
index d6311fa6e..4d656e27a 100644
--- a/web/js/containers/vector-dialog.js
+++ b/web/js/containers/vector-dialog.js
@@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
import { ModalBody, ModalHeader, Nav, NavItem, NavLink } from 'reactstrap';
import Scrollbars from '../components/util/scrollbar';
import VectorMetaTable from '../components/vector-metadata/table';
-import { ResizableBox, Resizable } from 'react-resizable';
class VectorDialog extends React.Component {
constructor(props) {
@@ -19,7 +18,7 @@ class VectorDialog extends React.Component {
}
render() {
- const { toggleWithClose, vectorMetaObject, modalHeight, modalWidth } = this.props;
+ const { toggleWithClose, vectorMetaObject, modalHeight } = this.props;
const { activeIndex } = this.state;
const navArray = [];
const keyArray = [];
diff --git a/web/js/map/runningdata.js b/web/js/map/runningdata.js
index 07f16170b..b353794b0 100644
--- a/web/js/map/runningdata.js
+++ b/web/js/map/runningdata.js
@@ -18,7 +18,7 @@ export function MapRunningData(models, compareUi, store) {
/**
* Clear running data value
*/
- self.clearAll = function () {
+ self.clearAll = function() {
if (!lodashIsEmpty(dataObj)) {
dataObj = {};
store.dispatch(clearRunningDataAction());
@@ -31,7 +31,7 @@ export function MapRunningData(models, compareUi, store) {
* @param {Array} coords | Coordinates of hover point
* @param {Object} layerAttributes | Layer Properties
*/
- var isFromActiveCompareRegion = function (map, coords, layerAttributes) {
+ var isFromActiveCompareRegion = function(map, coords, layerAttributes) {
var compareModel = store.getState().compare;
if (compareModel && compareModel.active) {
if (compareModel.mode !== 'swipe') {
@@ -65,9 +65,8 @@ export function MapRunningData(models, compareUi, store) {
* @return {Void}
*
*/
- self.newPoint = function (coords, map) {
+ self.newPoint = function(coords, map) {
const state = store.getState();
- const vectorStyles = state.config.vectorStyles;
var activeLayerObj = {};
map.forEachFeatureAtPixel(coords, (feature, layer) => {
if (!layer.wv || !layer.wv.def) return;
@@ -78,21 +77,20 @@ export function MapRunningData(models, compareUi, store) {
const paletteLegends = getPalette(layerId, undefined, undefined, state);
const legend = paletteLegends.legend;
- if (!identifier && legend.colors.length > 1) return
+ if (!identifier && legend.colors.length > 1) return;
if (identifier) {
const properties = feature.getProperties();
const value = properties[identifier] || def.palette.unclassified;
if (!value) return;
- const tooltips = legend.tooltips.map(function (c) { return c.toLowerCase().replace(/\s/g, ''); });
+ const tooltips = legend.tooltips.map(function(c) { return c.toLowerCase().replace(/\s/g, ''); });
const colorIndex = tooltips.indexOf(value.toLowerCase().replace(/\s/g, ''));
color = legend.colors[colorIndex];
} else if (legend.colors.length === 1) {
color = legend.colors[0];
}
activeLayerObj[layerId] = { paletteLegends: paletteLegends, paletteHex: color };
- })
- map.forEachLayerAtPixel(coords, function (layer, data) {
-
+ });
+ map.forEachLayerAtPixel(coords, function(layer, data) {
if (!layer.wv) return;
var paletteHex;
var paletteLegends;
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 56fd4c63d..f052ae8e2 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -1,5 +1,8 @@
import {
- groupBy, orderBy as lodashOrderBy, throttle as lodashThrottle, forOwn as lodashForOwn, each as lodashEach, findIndex as lodashFindIndex,
+ throttle as lodashThrottle,
+ forOwn as lodashForOwn,
+ each as lodashEach,
+ findIndex as lodashFindIndex,
get as lodashGet,
debounce as lodashDebounce,
cloneDeep as lodashCloneDeep,
@@ -34,7 +37,6 @@ import { CALCULATE_RESPONSIVE_STATE } from 'redux-responsive';
import { LOCATION_POP_ACTION } from '../redux-location-state-customs';
import { CHANGE_PROJECTION } from '../modules/projection/constants';
import { SELECT_DATE } from '../modules/date/constants';
-import { openCustomContent } from '../modules/modal/actions';
import { CHANGE_UNITS, USE_GREAT_CIRCLE } from '../modules/measure/constants';
import Cache from 'cachai';
import * as layerConstants from '../modules/layers/constants';
@@ -50,9 +52,8 @@ import { datesinDateRanges } from '../modules/layers/util';
import { CLEAR_ROTATE, RENDERED, UPDATE_MAP_UI, FITTED_TO_LEADING_EXTENT } from '../modules/map/constants';
import { getLeadingExtent } from '../modules/map/util';
-import vectorDialog from '../containers/vector-dialog';
-import { setSelected } from '../modules/vector-styles/actions';
-import { onMapClickGetVectorFeatures, updateVectorSelection, onMapHoverGetVectorFeatures } from '../modules/vector-styles/util';
+
+import { updateVectorSelection } from '../modules/vector-styles/util';
export function mapui(models, config, store, ui) {
var layerBuilder, createLayer;
@@ -140,7 +141,7 @@ export function mapui(models, config, store, ui) {
case vectorStyleConstants.CLEAR_VECTORSTYLE:
case CALCULATE_RESPONSIVE_STATE:
return onResize();
- case vectorStyleConstants.SET_SELECTED_VECTORS:
+ case vectorStyleConstants.SET_SELECTED_VECTORS: {
const type = 'selection';
const newSelection = action.payload;
const state = store.getState();
@@ -149,6 +150,7 @@ export function mapui(models, config, store, ui) {
updateVectorSelection(action.payload, self.selectedVectors, layers[activeLayerStr], type, state);
self.selectedVectors = newSelection;
return;
+ }
case CHANGE_UNITS:
return toggleMeasurementUnits(action.value);
case USE_GREAT_CIRCLE:
diff --git a/web/js/modules/image-download/util.js b/web/js/modules/image-download/util.js
index 0c08cd879..18ab6b1b5 100644
--- a/web/js/modules/image-download/util.js
+++ b/web/js/modules/image-download/util.js
@@ -141,9 +141,9 @@ export function imageUtilCalculateResolution(
*/
export function imageUtilGetLayers(products, proj) {
var layers = [];
- lodashEach(products, function (layer) {
+ lodashEach(products, function(layer) {
if (layer.downloadId) {
- layers.push(layer.downloadId)
+ layers.push(layer.downloadId);
} else if (layer.projections[proj].layer) {
layers.push(layer.projections[proj].layer);
} else {
diff --git a/web/js/modules/modal/reducers.js b/web/js/modules/modal/reducers.js
index 54596182b..840da245e 100644
--- a/web/js/modules/modal/reducers.js
+++ b/web/js/modules/modal/reducers.js
@@ -4,8 +4,7 @@ import {
OPEN_BASIC,
RENDER_TEMPLATE,
ABOUT_PAGE_REQUEST,
- CLOSE,
- CHANGE_CURSOR
+ CLOSE
} from './constants';
import { requestReducer } from '../core/reducers';
import { assign as lodashAssign } from 'lodash';
diff --git a/web/js/modules/vector-styles/util.js b/web/js/modules/vector-styles/util.js
index 943dc3705..13d8ec47e 100644
--- a/web/js/modules/vector-styles/util.js
+++ b/web/js/modules/vector-styles/util.js
@@ -1,13 +1,11 @@
import {
assign as lodashAssign,
find as lodashFind,
- get as lodashGet,
+ get as lodashGet
} from 'lodash';
import { Stroke, Style, Fill, Circle } from 'ol/style';
import { setStyleFunction } from './selectors';
-
-
export function getVectorStyleAttributeArray(layer) {
var isCustomActive = false;
var isMinActive = false;
@@ -92,8 +90,8 @@ export function selectedStyleFunction(feature, styleArray) {
export function getConditionalColors(color) {
const array = Array.from(color);
array.shift();
- let colors = [];
- let labels = [];
+ const colors = [];
+ const labels = [];
let temp = [];
const chunk = 2;
// https://stackoverflow.com/a/8495740/4589331
@@ -105,23 +103,23 @@ export function getConditionalColors(color) {
typeof temp[1] === 'string'
) {
labels.push(temp[0][2]);
- colors.push(temp[1])
+ colors.push(temp[1]);
} else {
console.warn('Irregular conditional');
}
} else if (temp.length === 1 && typeof temp[0] === 'string') {
labels.push('Default');
- colors.push(temp[0])
+ colors.push(temp[0]);
} else {
console.warn('Irregular conditional');
}
}
- return { colors, labels }
+ return { colors, labels };
}
export function getPaletteForStyle(layer, layerstyleLayerObject) {
const styleLayerObject = layerstyleLayerObject.layers[0];
- const color = styleLayerObject.paint['line-color'] || styleLayerObject.paint['circle-color'] || styleLayerObject.paint['fill-color']
- const isConditionalStyling = styleLayerObject.paint ? isExpression(color) : false;
+ const color = styleLayerObject.paint['line-color'] || styleLayerObject.paint['circle-color'] || styleLayerObject.paint['fill-color'];
+ const isConditionalStyling = styleLayerObject.paint ? isConditional(color) : false;
let colors = [];
let labels = [];
if (isConditionalStyling) {
@@ -134,11 +132,11 @@ export function getPaletteForStyle(layer, layerstyleLayerObject) {
}
return [{
colors: colors,
- type: "classification",
+ type: 'classification',
tooltips: labels,
title: layer.title,
id: layer.id + '0_legend'
- }]
+ }];
}
export function onMapClickGetVectorFeatures(pixels, map, state) {
const metaArray = [];
@@ -146,9 +144,8 @@ export function onMapClickGetVectorFeatures(pixels, map, state) {
const config = state.config;
const { screenWidth, screenHeight } = state.browser;
const x = pixels[0];
- const y = pixels[1]
+ const y = pixels[1];
const isOnLeft = screenWidth - x >= screenWidth / 2;
- const isOnTop = screenHeight - y >= screenHeight / 2;
const modalWidth = 445;
const modalHeight = 300;
let offsetLeft = isOnLeft ? x + 20 : x - modalWidth - 20;
@@ -165,7 +162,7 @@ export function onMapClickGetVectorFeatures(pixels, map, state) {
offsetTop = y - modalHeight;
}
- map.forEachFeatureAtPixel(pixels, function (feature, layer) {
+ map.forEachFeatureAtPixel(pixels, function(feature, layer) {
const def = lodashGet(layer, 'wv.def');
if (!def) return;
if (def.vectorData && def.vectorData.id && def.title) {
@@ -177,7 +174,7 @@ export function onMapClickGetVectorFeatures(pixels, map, state) {
const properties = data.mvt_properties;
const uniqueIdentifierKey = lodashFind(properties, { Function: 'Identify' }).Identifier;
const titleObj = lodashFind(properties, { IsLabel: 'True' });
- const titleKey = titleObj.Identifier
+ const titleKey = titleObj.Identifier;
const uniqueIdentifier = features[uniqueIdentifierKey];
const title = titleKey ? features[titleKey] : 'Unknown title';
@@ -197,7 +194,7 @@ export function onMapClickGetVectorFeatures(pixels, map, state) {
}
export function updateVectorSelection(selectionObj, lastSelection, layers, type, state) {
const vectorStyles = state.config.vectorStyles;
- for (const [key, featureIdArray] of Object.entries(selectionObj)) {
+ for (const [key] of Object.entries(selectionObj)) {
const def = lodashFind(layers, { id: key });
if (!def) return;
setStyleFunction(def, def.vectorStyle.id, vectorStyles, null, state);