Skip to content

Commit

Permalink
Eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Sep 24, 2024
1 parent 0e469a5 commit 94072b8
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 31 deletions.
4 changes: 3 additions & 1 deletion components/map/OlMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ class OlMap extends React.Component {
const featureObj = format.writeFeatureObject(feature);
featureObj.layerId = layer ? layer.get('id') : null;
features.push(featureObj);
} catch (e) {}
} catch (e) {
/* pass */
}
});
const data = {
ts: +new Date(),
Expand Down
1 change: 0 additions & 1 deletion components/map/layers/MVTLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default {
const glStyle = response.data;
Object.keys(glStyle.sources).forEach(styleSource => {
const layer = createLayer();
layer.setId
applyStyle(layer, glStyle, styleSource).then(() => {
group.getLayers().push(layer);
});
Expand Down
8 changes: 4 additions & 4 deletions components/widgets/ComboBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import React from 'react';

import classnames from 'classnames';
import PropTypes from 'prop-types';
import {remove as removeDiacritics} from 'diacritics';
import PropTypes from 'prop-types';

import MiscUtils from '../../utils/MiscUtils';
import Icon from '../Icon';
Expand Down Expand Up @@ -61,7 +61,7 @@ export default class ComboBox extends React.Component {
{activeOption}
</span>
{this.props.filterable && !this.props.readOnly ? (
<input className="combobox-button-filter" onChange={this.filterChanged} type="text" value={this.state.filter} />
<input className="combobox-button-filter" onChange={this.filterChanged} type="text" value={this.state.filter} />
) : null}
{this.props.readOnly ? null : (<Icon icon="chevron-down" />)}
</div>
Expand All @@ -77,7 +77,7 @@ export default class ComboBox extends React.Component {
if (child.props["data-group"] !== undefined && !this.state.expanded.includes(child.props["data-group"])) {
return null;
}
if(filter && !removeDiacritics(child.props.title).match(filter)) {
if (filter && !removeDiacritics(child.props.title).match(filter)) {
return null;
}
const expanderIcon = this.state.expanded.includes(child.props["data-group-header"]) ? "collapse" : "expand";
Expand All @@ -98,7 +98,7 @@ export default class ComboBox extends React.Component {
filterChanged = (ev) => {
this.setState({filter: ev.target.value});
this.props.onChange('');
}
};
onChildClicked = (ev, child) => {
this.setState({filter: ''});
if (child.props["data-group-header"] !== undefined) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/Bookmark.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class Bookmark extends React.Component {
<h4>{LocaleUtils.tr("bookmark.manage")}</h4>
<div className="bookmark-create">
<input onChange={ev => this.setState({description: ev.target.value})}
onKeyDown={ev => {if (ev.key === "Enter" && this.state.description !== "") { this.addBookmark(); }}}
placeholder={placeholder} type="text" value={this.state.description} />
onKeyDown={ev => {if (ev.key === "Enter" && this.state.description !== "") { this.addBookmark(); }}}
placeholder={placeholder} type="text" value={this.state.description} />
</div>
<div className="bookmark-actions">
<span className="bookmark-actions-buttonbox">
Expand Down
2 changes: 1 addition & 1 deletion plugins/BottomBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class BottomBar extends React.Component {
displayScales: PropTypes.bool,
displaycrs: PropTypes.string,
fullscreen: PropTypes.bool,
mapMargins: PropTypes.object,
map: PropTypes.object,
mapMargins: PropTypes.object,
openExternalUrl: PropTypes.func,
setBottombarHeight: PropTypes.func,
/** The URL of the terms label anchor. */
Expand Down
2 changes: 1 addition & 1 deletion plugins/LayerTree.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ class LayerTree extends React.Component {
const data = JSON.stringify({
type: "FeatureCollection",
features: layer.features.map(feature => {
const newFeature = {...feature, geometry: VectorLayerUtils.reprojectGeometry(feature.geometry, feature.crs || this.props.mapCrs, 'EPSG:4326')};
const newFeature = {...feature, geometry: VectorLayerUtils.reprojectGeometry(feature.geometry, feature.crs || this.props.map.projection, 'EPSG:4326')};
delete newFeature.crs;
return newFeature;
})
Expand Down
1 change: 0 additions & 1 deletion plugins/MapTip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {v1 as uuidv1} from 'uuid';

import {LayerRole, addLayerFeatures, removeLayer} from '../actions/layers';
import {openExternalUrl} from '../actions/task';
import ConfigUtils from '../utils/ConfigUtils';
import IdentifyUtils from '../utils/IdentifyUtils';

import './style/MapTip.css';
Expand Down
2 changes: 1 addition & 1 deletion plugins/NewsPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class NewsPopup extends React.Component {
};
constructor(props) {
super(props);
this.state.showPopup = !!props.newsRev && !document.cookie.split(';').some((item) => item.includes('newsrev=' + props.newsRev));
this.state.showPopup = !!props.newsRev && !document.cookie.split(';').some((item) => item.includes('newsrev=' + props.newsRev));
}
render() {
if (!this.state.showPopup || !this.props.newsDocument) {
Expand Down
36 changes: 19 additions & 17 deletions plugins/Reports.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import {connect} from 'react-redux';

import axios from 'axios';
import FileSaver from 'file-saver';
import isEmpty from 'lodash.isempty';
import PropTypes from 'prop-types';
import React from 'react';
import {connect} from 'react-redux';

import {LayerRole, addLayerFeatures, clearLayer, changeLayerProperty} from '../actions/layers';
import ButtonBar from '../components/widgets/ButtonBar';
import ComboBox from '../components/widgets/ComboBox';
import Icon from '../components/Icon';
import MapSelection from '../components/MapSelection';
import PickFeature from '../components/PickFeature';
import SideBar from '../components/SideBar';
import Spinner from '../components/Spinner';
import ButtonBar from '../components/widgets/ButtonBar';
import ComboBox from '../components/widgets/ComboBox';
import ConfigUtils from '../utils/ConfigUtils';
import IdentifyUtils from '../utils/IdentifyUtils';
import LayerUtils from '../utils/LayerUtils';
Expand All @@ -32,7 +33,7 @@ import './style/Reports.css';

/**
* Allow generating reports for selected features.
*
*
* This plugin displays all available reports for the current theme,
* allows selecting one or more or all features of the layer, and finally generating
* an aggregated report for all selected features.
Expand Down Expand Up @@ -85,13 +86,13 @@ class Reports extends React.Component {
<div className="reports-body">
<div>
<ComboBox
className="reports-filter-combo" filterable
className="reports-filter-combo" filterable
onChange={this.setReportLayer}
placeholder={LocaleUtils.tr("reports.selectlayer")}
value={this.state.selectedReportLayer}
>
{Object.entries(this.state.reports).map(([layername, entry]) => (
<div key={layername} value={layername} title={entry.title}>{entry.title}</div>
<div key={layername} title={entry.title} value={layername}>{entry.title}</div>
))}
</ComboBox>
</div>
Expand Down Expand Up @@ -156,10 +157,10 @@ class Reports extends React.Component {
setReportLayer = (layer) => {
this.setLayerVisibility(layer, true);
this.setState({selectedReportLayer: layer, reportFeatures: []});
}
};
setPickMode = (mode) => {
this.setState({featureSelectionMode: mode, reportFeatures: [], featureSelectionPolygon: null});
}
};
collectFeatureReportTemplates = (entry) => {
let reports = {};
if (entry.sublayers) {
Expand All @@ -170,21 +171,21 @@ class Reports extends React.Component {
reports[entry.name] = {
title: entry.title,
template: entry.featureReport
}
};
}
return reports;
};
onShow = () => {
let reports = {};
this.props.layers.filter(l => l.role === LayerRole.THEME).forEach(themeLayer => {
reports = {...reports, ...this.collectFeatureReportTemplates(themeLayer)};
})
});
this.setState({reports, featureSelectionMode: 'Pick'});
};
onHide = () => {
this.props.clearLayer("report-pick-selection");
this.setState({...Reports.defaultState});
}
};
selectReportFeature = (layer, feature) => {
if (!feature) {
return;
Expand Down Expand Up @@ -216,15 +217,15 @@ class Reports extends React.Component {

const filter = VectorLayerUtils.geoJSONGeomToWkt(geom);
const params = {feature_count: 100};
const layer = this.props.layers.find(layer => layer.role === LayerRole.THEME);
const layer = this.props.layers.find(l => l.role === LayerRole.THEME);
const request = IdentifyUtils.buildFilterRequest(layer, this.state.selectedReportLayer, filter, this.props.map, params);
IdentifyUtils.sendRequest(request, (response) => {
if (response) {
const result = IdentifyUtils.parseResponse(response, layer, request.params.info_format, center, this.props.map.projection);
this.setState({reportFeatures: result[this.state.selectedReportLayer]});
this.setState((state) => ({reportFeatures: result[state.selectedReportLayer]}));
}
});
}
};
downloadReport = () => {
const serviceUrl = ConfigUtils.getConfigProp("featureReportService").replace(/\/$/, "");
let featureIds = '';
Expand All @@ -243,11 +244,12 @@ class Reports extends React.Component {
axios.get(url, {responseType: "arraybuffer"}).then(response => {
FileSaver.saveAs(new Blob([response.data], {type: "application/pdf"}), this.state.selectedReportLayer + ".pdf");
this.setState({generatingReport: false});
}).catch(e => {
}).catch(() => {
/* eslint-disable-next-line */
alert(LocaleUtils.tr("identify.reportfail"));
this.setState({generatingReport: false});
});
}
};
}

export default connect(state => ({
Expand Down
3 changes: 1 addition & 2 deletions reducers/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ export default function windows(state = defaultState, action) {
...state,
splitScreen: newSplitScreen,
windowMargins: windowMargins,
mapMargins: computeMapMargins(windowMargins, state.menuMargins),

mapMargins: computeMapMargins(windowMargins, state.menuMargins)
};
}
case SET_MENU_MARGIN: {
Expand Down

0 comments on commit 94072b8

Please sign in to comment.