Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#9241 profile en long #9242

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/devServer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

const port = process.env.MAPSTORE_BACKEND_PORT || 8080;
const protocol = process.env.MAPSTORE_BACKEND_PROTOCOL || "http";
const host = process.env.MAPSTORE_BACKEND_HOST || "localhost";
Expand Down
1 change: 1 addition & 0 deletions build/docma-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@
"web/client/plugins/LayerInfo.jsx",
"web/client/plugins/Locate.jsx",
"web/client/plugins/Login.jsx",
"web/client/plugins/LongitudinalProfileTool.jsx",
"web/client/plugins/Map.jsx",
"web/client/plugins/MapCatalog.jsx",
"web/client/plugins/MapEditor.jsx",
Expand Down
1 change: 1 addition & 0 deletions docs/developer-guide/maps-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,7 @@ The `symbolizer` could be of following `kinds`:
| `size` | size of the icon | x | x |
| `opacity` | opacity of the icon | x | x |
| `rotate` | rotation of the icon | x | x |
| `anchor` | array of values defined in fractions [0 to 1] | x | x |
| `msBringToFront` | this boolean will allow setting the **disableDepthTestDistance** value for the feature. This would | | x |
| `msHeightReference` | reference to compute the distance of the point geometry, one of **none**, **ground** or **clamp** | | x |
| `msHeight` | height of the point, the original geometry is applied if undefined | | x |
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"@turf/convex": "6.5.0",
"@turf/difference": "6.5.0",
"@turf/great-circle": "5.1.5",
"@turf/helpers": "6.5.0",
"@turf/inside": "4.1.0",
"@turf/line-intersect": "4.1.0",
"@turf/point-on-surface": "4.1.0",
Expand Down Expand Up @@ -173,6 +174,7 @@
"draft-js-plugins-editor": "2.1.1",
"draft-js-side-toolbar-plugin": "3.0.1",
"draftjs-to-html": "0.8.4",
"dxf-parser": "1.1.2",
"element-closest": "2.0.2",
"embed-video": "2.0.4",
"es6-object-assign": "1.1.0",
Expand All @@ -184,6 +186,7 @@
"git-revision-webpack-plugin": "5.0.0",
"history": "4.6.1",
"html-to-draftjs": "npm:@geosolutions/[email protected]",
"html-to-image": "1.11.11",
"html2canvas": "0.5.0-beta4",
"immutable": "4.0.0-rc.12",
"intersection-observer": "0.7.0",
Expand Down Expand Up @@ -217,6 +220,7 @@
"object-fit-images": "3.2.4",
"ogc-schemas": "2.6.1",
"ol": "5.3.0",
"pdfmake": "0.2.7",
"pdfviewer": "0.3.2",
"plotly.js-cartesian-dist": "2.5.1",
"prop-types": "15.7.2",
Expand Down
100 changes: 56 additions & 44 deletions utility/eslint/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems related to a different PR #9188.
I think if we are not publishing the new package this should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i have to recreate my master branch to fix this

will force push without it

module.exports = {
"parser": "@babel/eslint-parser", // https://github.com/babel/babel-eslint
"parserOptions": {
Expand All @@ -7,6 +8,11 @@ module.exports = {
"jsx": true
}
},
"settings": {
"react": {
"version": "detect"
}
},
"plugins": [
"@babel",
"no-only-tests", // https://github.com/levibuzolic/eslint-plugin-no-only-tests
Expand Down Expand Up @@ -199,54 +205,60 @@ module.exports = {
"react/no-did-update-set-state": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
"react/no-multi-comp": 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
"react/no-unknown-property": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
"react/prop-types": [2, { "ignore": ["children"] }], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
"react/no-unused-prop-types": 2, // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
"react/prop-types": [0, { "ignore": ["children"] }], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
"react/react-in-jsx-scope": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
"react/self-closing-comp": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
"react/wrap-multilines": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md
"react/sort-comp": [2, { // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
"react/sort-comp": [2, {
"order": [
"displayName",
"propTypes",
"inheritedPropTypes",
"contextTypes",
"childContextTypes",
"mixins",
"statics",
"defaultProps",
"constructor",
"getDefaultProps",
"/^state$/",
"getInitialState",
"getChildContext",
"UNSAFE_componentWillMount",
"componentWillMount",
"componentDidMount",
"UNSAFE_componentWillReceiveProps",
"componentWillReceiveProps",
"shouldComponentUpdate",
"UNSAFE_componentWillUpdate",
"componentWillUpdate",
"componentDidUpdate",
"componentWillUnmount",
"/^on.+$/",
"/^get.+$/",
"/^render.+$/",
"render"
],
// CUSTOM
// prevent to `import _ from 'lodash';`. Allows `import {get} from 'lodash';` or `import get from 'lodash/get';`
// for bundle size
"no-restricted-imports": [2,
{
"name": "lodash",
"importNames": ["default"],
"message": "Please use the default import from 'lodash/functionName' instead."
}
'static-methods',
'lifecycle',
'everything-else',
'render'
],
// prevent to `const _ = require('lodash')`. Allows `const get = require('lodash/get');`
// for bundle size
"no-restricted-modules": [2, { "paths": ["lodash", "!lodash/*"] }]
}]
"groups": {
"lifecycle": [
'displayName',
'propTypes',
'contextTypes',
'childContextTypes',
'mixins',
'statics',
'defaultProps',
'constructor',
'getDefaultProps',
'state',
'getInitialState',
'getChildContext',
'getDerivedStateFromProps',
'componentWillMount',
'UNSAFE_componentWillMount',
'componentDidMount',
'componentWillReceiveProps',
'UNSAFE_componentWillReceiveProps',
'shouldComponentUpdate',
'componentWillUpdate',
'UNSAFE_componentWillUpdate',
'getSnapshotBeforeUpdate',
'componentDidUpdate',
'componentDidCatch',
'componentWillUnmount'
]
}
}],
// CUSTOM
// prevent to `import _ from 'lodash';`. Allows `import {get} from 'lodash';` or `import get from 'lodash/get';`
// for bundle size
"no-restricted-imports": [2,
{
"name": "lodash",
"importNames": ["default"],
"message": "Please use the default import from 'lodash/functionName' instead."
}
],
// prevent to `const _ = require('lodash')`. Allows `const get = require('lodash/get');`
// for bundle size
"no-restricted-modules": [2, { "paths": ["lodash"], "patterns": ["!lodash/*"]}]
}
};

4 changes: 2 additions & 2 deletions utility/eslint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mapstore/eslint-config-mapstore",
"version": "1.0.5",
"version": "1.0.6",
"private": false,
"description": "ESLint Configuration for MapStore project",
"author": "GeoSolutions S.a.s.",
Expand Down Expand Up @@ -29,6 +29,6 @@
"eslint": ">= 7.5.0",
"eslint-plugin-import": ">= 2.20.2",
"eslint-plugin-no-only-tests": ">= 2.3.1",
"eslint-plugin-react": ">= 3.3.2"
"eslint-plugin-react": ">= 7.31.11"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sime for this file:

This change seems related to a different PR #9188.
I think if we are not publishing the new package this should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct, going to remove

}
}
139 changes: 139 additions & 0 deletions web/client/actions/__tests__/longitudinalPfofile-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
* Copyright 2022, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
import expect from "expect";

import {CONTROL_DOCK_NAME} from '../../plugins/longitudinalProfile/constants';
import {SET_CONTROL_PROPERTY} from "../controls";
import {
ADD_PROFILE_DATA,
addProfileData,
CHANGE_DISTANCE,
CHANGE_GEOMETRY,
CHANGE_REFERENTIAL,
changeDistance,
changeGeometry,
changeReferential,
closeDock,
initialized,
INITIALIZED,
loading,
LOADING,
openDock,
setup,
SETUP,
TEAR_DOWN,
tearDown,
TOGGLE_MAXIMIZE,
TOGGLE_MODE,
toggleMaximize,
toggleMode
} from "../longitudinalProfile";

describe('Test correctness of the actions', () => {
it('setup', () => {
const config = {configProp1: 'example', configProp2: 'test'};
const action = setup(config);
expect(action).toExist();
expect(action.type).toBe(SETUP);
expect(action.config).toEqual(config);
});

it('initialized', () => {
const action = initialized();
expect(action).toExist();
expect(action.type).toBe(INITIALIZED);
});

it('tearDown', () => {
const action = tearDown();
expect(action).toExist();
expect(action.type).toBe(TEAR_DOWN);
});

it('openDock', () => {
const action = openDock();
expect(action).toExist();
expect(action.type).toBe(SET_CONTROL_PROPERTY);
expect(action.control).toBe(CONTROL_DOCK_NAME);
expect(action.property).toBe('enabled');
expect(action.value).toBe(true);
});

it('closeDock', () => {
const action = closeDock();
expect(action).toExist();
expect(action.type).toBe(SET_CONTROL_PROPERTY);
expect(action.control).toBe(CONTROL_DOCK_NAME);
expect(action.property).toBe('enabled');
expect(action.value).toBe(false);
});

it('toggleMode - no mode passed', () => {
const action = toggleMode();
expect(action).toExist();
expect(action.type).toBe(TOGGLE_MODE);
expect(action.mode).toBe(undefined);
});

it('toggleMode - mode passed', () => {
const action = toggleMode('draw');
expect(action).toExist();
expect(action.type).toBe(TOGGLE_MODE);
expect(action.mode).toBe('draw');
});

it('addProfileData', () => {
const infos = { prop1: true, prop2: 10, prop3: 'test'};
const points = [[[1, 2, 5], [2, 3, 5]]];
const projection = 'EPSG:3857';
const action = addProfileData(infos, points, projection);
expect(action).toExist();
expect(action.type).toBe(ADD_PROFILE_DATA);
expect(action.infos).toEqual(infos);
expect(action.points[0]).toEqual(points[0]);
expect(action.points[1]).toEqual(points[1]);
expect(action.projection).toEqual(projection);
});

it('loading', () => {
const action = loading(true);
expect(action).toExist();
expect(action.type).toBe(LOADING);
expect(action.state).toBe(true);
});

it('changeReferential', () => {
const action = changeReferential('ref2');
expect(action).toExist();
expect(action.type).toBe(CHANGE_REFERENTIAL);
expect(action.referential).toBe('ref2');
});

it('changeDistance', () => {
const action = changeDistance(200);
expect(action).toExist();
expect(action.type).toBe(CHANGE_DISTANCE);
expect(action.distance).toBe(200);
});

it('changeGeometry', () => {
const geometry = { point: [2, 5], center: [1, 1]};
const action = changeGeometry(geometry);
expect(action).toExist();
expect(action.type).toBe(CHANGE_GEOMETRY);
expect(action.geometry).toExist();
expect(action.geometry.point).toEqual([2, 5]);
expect(action.geometry.center).toEqual([1, 1]);
});

it('toggleMaximize', () => {
const action = toggleMaximize();
expect(action).toExist();
expect(action.type).toBe(TOGGLE_MAXIMIZE);
});
});
Loading