diff --git a/geonode_mapstore_client/client/.eslintignore b/geonode_mapstore_client/client/.eslintignore deleted file mode 100644 index c5ca95c269..0000000000 --- a/geonode_mapstore_client/client/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -MapStore2/ diff --git a/geonode_mapstore_client/client/.eslintrc b/geonode_mapstore_client/client/.eslintrc deleted file mode 100644 index 8667a1d5f4..0000000000 --- a/geonode_mapstore_client/client/.eslintrc +++ /dev/null @@ -1,224 +0,0 @@ -{ - "parser": "babel-eslint", // https://github.com/babel/babel-eslint - "plugins": [ - "no-only-tests", // https://github.com/levibuzolic/eslint-plugin-no-only-tests - "react" // https://github.com/yannickcr/eslint-plugin-react - ], - "env": { // http://eslint.org/docs/user-guide/configuring.html#specifying-environments - "browser": true, // browser global variables - "node": true, // Node.js global variables and Node.js-specific rules - "es6": true // enable all ECMAScript 6 features except for modules (this automatically sets the ecmaVersion parser option to 6). - }, - "globals" : { - /* MOCHA */ - "describe" : false, - "it" : false, - "before" : false, - "beforeEach" : false, - "after" : false, - "afterEach" : false, - "__DEVTOOLS__": false - }, - "rules": { -/** - * Strict mode - */ - // babel inserts "use strict"; for us - "strict": [2, "never"], // http://eslint.org/docs/rules/strict - -/** - * ES6 - */ - "no-var": 0, // http://eslint.org/docs/rules/no-var - "prefer-const": 0, // http://eslint.org/docs/rules/prefer-const - -/** - * Variables - */ - "no-shadow": 2, // http://eslint.org/docs/rules/no-shadow - "no-shadow-restricted-names": 2, // http://eslint.org/docs/rules/no-shadow-restricted-names - "no-unused-vars": [2, { // http://eslint.org/docs/rules/no-unused-vars - "vars": "local", - "args": "after-used", - "ignoreRestSiblings": true - }], - "no-use-before-define": 2, // http://eslint.org/docs/rules/no-use-before-define - -/** - * Possible errors - */ - "no-only-tests/no-only-tests": ["error", {"block": ["it", "describe"], "focus": ["only"]}], - "comma-dangle": [2, "never"], // http://eslint.org/docs/rules/comma-dangle - "no-cond-assign": [2, "always"], // http://eslint.org/docs/rules/no-cond-assign - "no-console": 1, // http://eslint.org/docs/rules/no-console - "no-debugger": 1, // http://eslint.org/docs/rules/no-debugger - "no-undef": 2, // https://eslint.org/docs/rules/no-undef - "no-const-assign": 2, // https://eslint.org/docs/rules/no-const-assign - "no-duplicate-imports": 2, // https://eslint.org/docs/rules/no-duplicate-imports - "no-alert": 1, // http://eslint.org/docs/rules/no-alert - "no-constant-condition": 1, // http://eslint.org/docs/rules/no-constant-condition - "no-dupe-keys": 2, // http://eslint.org/docs/rules/no-dupe-keys - "no-duplicate-case": 2, // http://eslint.org/docs/rules/no-duplicate-case - "no-empty": 2, // http://eslint.org/docs/rules/no-empty - "no-ex-assign": 2, // http://eslint.org/docs/rules/no-ex-assign - "no-extra-boolean-cast": 0, // http://eslint.org/docs/rules/no-extra-boolean-cast - "no-extra-semi": 2, // http://eslint.org/docs/rules/no-extra-semi - "no-func-assign": 2, // http://eslint.org/docs/rules/no-func-assign - "no-inner-declarations": 2, // http://eslint.org/docs/rules/no-inner-declarations - "no-invalid-regexp": 2, // http://eslint.org/docs/rules/no-invalid-regexp - "no-irregular-whitespace": 2, // http://eslint.org/docs/rules/no-irregular-whitespace - "no-obj-calls": 2, // http://eslint.org/docs/rules/no-obj-calls - "quote-props": [2, "as-needed", {"keywords": true, "unnecessary": false}], // http://eslint.org/docs/rules/no-reserved-keys - "no-sparse-arrays": 2, // http://eslint.org/docs/rules/no-sparse-arrays - "no-unreachable": 2, // http://eslint.org/docs/rules/no-unreachable - "use-isnan": 2, // http://eslint.org/docs/rules/use-isnan - "block-scoped-var": 2, // http://eslint.org/docs/rules/block-scoped-var - -/** - * Best practices - */ - "consistent-return": [2, {"treatUndefinedAsUnspecified": true}], // http://eslint.org/docs/rules/consistent-return - "curly": [2, "multi-line"], // http://eslint.org/docs/rules/curly - "default-case": 2, // http://eslint.org/docs/rules/default-case - "dot-notation": [2, { // http://eslint.org/docs/rules/dot-notation - "allowKeywords": true - }], - "eqeqeq": 2, // http://eslint.org/docs/rules/eqeqeq - "guard-for-in": 2, // http://eslint.org/docs/rules/guard-for-in - "no-caller": 2, // http://eslint.org/docs/rules/no-caller - "no-else-return": 2, // http://eslint.org/docs/rules/no-else-return - "no-eq-null": 2, // http://eslint.org/docs/rules/no-eq-null - "no-eval": 2, // http://eslint.org/docs/rules/no-eval - "no-extend-native": 2, // http://eslint.org/docs/rules/no-extend-native - "no-extra-bind": 2, // http://eslint.org/docs/rules/no-extra-bind - "no-fallthrough": 2, // http://eslint.org/docs/rules/no-fallthrough - "no-floating-decimal": 2, // http://eslint.org/docs/rules/no-floating-decimal - "no-implied-eval": 2, // http://eslint.org/docs/rules/no-implied-eval - "no-lone-blocks": 2, // http://eslint.org/docs/rules/no-lone-blocks - "no-loop-func": 2, // http://eslint.org/docs/rules/no-loop-func - "no-multi-str": 2, // http://eslint.org/docs/rules/no-multi-str - "no-native-reassign": 2, // http://eslint.org/docs/rules/no-native-reassign - "no-new": 2, // http://eslint.org/docs/rules/no-new - "no-new-func": 2, // http://eslint.org/docs/rules/no-new-func - "no-new-wrappers": 2, // http://eslint.org/docs/rules/no-new-wrappers - "no-octal": 2, // http://eslint.org/docs/rules/no-octal - "no-octal-escape": 2, // http://eslint.org/docs/rules/no-octal-escape - "no-param-reassign": 2, // http://eslint.org/docs/rules/no-param-reassign - "no-proto": 2, // http://eslint.org/docs/rules/no-proto - "no-redeclare": 2, // http://eslint.org/docs/rules/no-redeclare - "no-return-assign": 2, // http://eslint.org/docs/rules/no-return-assign - "no-script-url": 2, // http://eslint.org/docs/rules/no-script-url - "no-self-compare": 2, // http://eslint.org/docs/rules/no-self-compare - "no-sequences": 2, // http://eslint.org/docs/rules/no-sequences - "no-throw-literal": 2, // http://eslint.org/docs/rules/no-throw-literal - "no-with": 2, // http://eslint.org/docs/rules/no-with - "radix": 2, // http://eslint.org/docs/rules/radix - "vars-on-top": 2, // http://eslint.org/docs/rules/vars-on-top - "wrap-iife": [2, "any"], // http://eslint.org/docs/rules/wrap-iife - "yoda": 2, // http://eslint.org/docs/rules/yoda - -/** - * Style - */ - "indent": [2, 4], // http://eslint.org/docs/rules/indent - "brace-style": [2, // http://eslint.org/docs/rules/brace-style - "1tbs", { - "allowSingleLine": true - }], - "quotes": [ - 0, "single", "avoid-escape" // http://eslint.org/docs/rules/quotes - ], - "camelcase": [1, { // http://eslint.org/docs/rules/camelcase - "properties": "never", - "allow": ["^UNSAFE_"]} - ], - "comma-spacing": [2, { // http://eslint.org/docs/rules/comma-spacing - "before": false, - "after": true - }], - "comma-style": [2, "last"], // http://eslint.org/docs/rules/comma-style - "eol-last": 2, // http://eslint.org/docs/rules/eol-last - "func-names": 0, // http://eslint.org/docs/rules/func-names - "key-spacing": [2, { // http://eslint.org/docs/rules/key-spacing - "beforeColon": false, - "afterColon": true - }], - "new-cap": [2, { // http://eslint.org/docs/rules/new-cap - "newIsCap": true - }], - "no-multiple-empty-lines": [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines - "max": 2 - }], - "no-nested-ternary": 0, // http://eslint.org/docs/rules/no-nested-ternary - "no-new-object": 2, // http://eslint.org/docs/rules/no-new-object - "no-spaced-func": 2, // http://eslint.org/docs/rules/no-spaced-func - "no-trailing-spaces": 2, // http://eslint.org/docs/rules/no-trailing-spaces - "no-extra-parens": [2, "functions"], // http://eslint.org/docs/rules/no-wrap-func - "no-underscore-dangle": 0, // http://eslint.org/docs/rules/no-underscore-dangle - "one-var": [2, "never"], // http://eslint.org/docs/rules/one-var - "padded-blocks": [0, "never"], // http://eslint.org/docs/rules/padded-blocks - "semi": [2, "always"], // http://eslint.org/docs/rules/semi - "semi-spacing": [2, { // http://eslint.org/docs/rules/semi-spacing - "before": false, - "after": true - }], - "keyword-spacing": [2, {"after": true}], // http://eslint.org/docs/rules/space-after-keywords - "space-before-blocks": 2, // http://eslint.org/docs/rules/space-before-blocks - "space-before-function-paren": [2, "never"], // http://eslint.org/docs/rules/space-before-function-paren - "space-infix-ops": 2, // http://eslint.org/docs/rules/space-infix-ops - // "space-return-throw-case": 2, // http://eslint.org/docs/rules/space-return-throw-case - "spaced-comment": 2, // http://eslint.org/docs/rules/spaced-line-comment - -/** - * JSX style - */ - "react/jsx-no-duplicate-props": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md - "react/display-name": 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md - "react/jsx-boolean-value": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md - "react/jsx-quotes": [2, "double"], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-quotes.md - "react/jsx-no-undef": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md - "react/jsx-sort-props": 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md - "react/jsx-sort-prop-types": 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-prop-types.md - "react/jsx-uses-react": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md - "react/jsx-uses-vars": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md - "react/no-did-mount-set-state": [2], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md - "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/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 - "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" - ] - }] - } -} diff --git a/geonode_mapstore_client/client/.gitignore b/geonode_mapstore_client/client/.gitignore index af804c8994..af8b16befd 100644 --- a/geonode_mapstore_client/client/.gitignore +++ b/geonode_mapstore_client/client/.gitignore @@ -4,3 +4,4 @@ web/ dist/ module/ coverage/ +package-lock.json diff --git a/geonode_mapstore_client/client/.npmignore b/geonode_mapstore_client/client/.npmignore new file mode 100644 index 0000000000..e0c4db9201 --- /dev/null +++ b/geonode_mapstore_client/client/.npmignore @@ -0,0 +1,2 @@ +MapStore2 +module/ diff --git a/geonode_mapstore_client/client/js/api.js b/geonode_mapstore_client/client/js/api.js index 0bad739c68..230b2c2cc6 100644 --- a/geonode_mapstore_client/client/js/api.js +++ b/geonode_mapstore_client/client/js/api.js @@ -7,19 +7,20 @@ */ require('react-widgets/dist/css/react-widgets.css'); const assign = require("object-assign"); -const ConfigUtils = require('../MapStore2/web/client/utils/ConfigUtils'); -const LocaleUtils = require('../MapStore2/web/client/utils/LocaleUtils'); -const LayersUtils = require('../MapStore2/web/client/utils/LayersUtils'); +const ConfigUtils = require('@mapstore/framework/utils/ConfigUtils'); +const LocaleUtils = require('@mapstore/framework/utils/LocaleUtils'); +const LayersUtils = require('@mapstore/framework/utils/LayersUtils'); LayersUtils.setRegGeoserverRule(/\/[\w- ]*geoserver[\w- ]*\/|\/[\w- ]*gs[\w- ]*\//); const {keyBy, values} = require('lodash'); + +require('react-select/dist/react-select.css'); /** * Add custom (overriding) translations with: * * ConfigUtils.setConfigProp('translationsPath', ['./MapStore2/web/client/translations', './translations']); */ -ConfigUtils.setConfigProp('translationsPath', ['../MapStore2/web/client', './'] ); ConfigUtils.setConfigProp('themePrefix', 'msgapi'); -const Persistence = require("../MapStore2/web/client/api/persistence"); +const Persistence = require("@mapstore/framework/api/persistence"); Persistence.addApi("geonode", require("./api/geonode")); Persistence.setApi("geonode"); @@ -50,21 +51,23 @@ Persistence.setApi("geonode"); const getScriptPath = function() { const scriptEl = document.getElementById('ms2-api'); - return scriptEl && scriptEl.src && scriptEl.src.substring(0, scriptEl.src.lastIndexOf('/')) || 'https://dev.mapstore2.geo-solutions.it/mapstore/dist'; + return scriptEl && scriptEl.src && scriptEl.src.substring(0, scriptEl.src.lastIndexOf('/')) || ''; }; +const translationsPath = __GEONODE_PROJECT_CONFIG__.translationsPath || getScriptPath() + '/../ms-translations'; + // Set X-CSRFToken in axios; -const axios = require('../MapStore2/web/client/libs/ajax'); +const axios = require('@mapstore/framework/libs/ajax'); axios.defaults.xsrfHeaderName = "X-CSRFToken"; axios.defaults.xsrfCookieName = "csrftoken"; const createMapStore2Api = function(plugins) { - const MapStore2 = require('../MapStore2/web/client/jsapi/MapStore2').withPlugins(plugins, { + const MapStore2 = require('@mapstore/framework/jsapi/MapStore2').withPlugins(plugins, { theme: { path: getScriptPath() + '/themes' }, noLocalConfig: true, - translations: getScriptPath() + '/../MapStore2/web/client' + translations: translationsPath }); // window.MapStore2 = MapStore2; return assign({}, MapStore2, { create: function(container, opts) { diff --git a/geonode_mapstore_client/client/js/api/geonode.js b/geonode_mapstore_client/client/js/api/geonode.js index e64a14e3be..01bfa9ccd1 100644 --- a/geonode_mapstore_client/client/js/api/geonode.js +++ b/geonode_mapstore_client/client/js/api/geonode.js @@ -7,8 +7,8 @@ */ const Rx = require('rxjs'); -const axios = require('../../MapStore2/web/client/libs/ajax'); -const ConfigUtils = require("../../MapStore2/web/client/utils/ConfigUtils"); +const axios = require('@mapstore/framework/libs/ajax'); +const ConfigUtils = require("@mapstore/framework/utils/ConfigUtils"); const createAttributesFromMetadata = ({ name, description }) => { diff --git a/geonode_mapstore_client/client/js/components/leaflet/ArcGisMapServer.js b/geonode_mapstore_client/client/js/components/leaflet/ArcGisMapServer.js index 8c31380039..a296c351c4 100644 --- a/geonode_mapstore_client/client/js/components/leaflet/ArcGisMapServer.js +++ b/geonode_mapstore_client/client/js/components/leaflet/ArcGisMapServer.js @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ -const Layers = require('../../../MapStore2/web/client/utils/leaflet/Layers'); +const Layers = require('@mapstore/framework/utils/leaflet/Layers'); var L = require('leaflet'); Layers.registerType('arcgis', (options) => { diff --git a/geonode_mapstore_client/client/js/components/openlayers/ArcGisMapServer.js b/geonode_mapstore_client/client/js/components/openlayers/ArcGisMapServer.js index 62b2774a77..c1b006b00e 100644 --- a/geonode_mapstore_client/client/js/components/openlayers/ArcGisMapServer.js +++ b/geonode_mapstore_client/client/js/components/openlayers/ArcGisMapServer.js @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ -import Layers from '../../../MapStore2/web/client/utils/openlayers/Layers'; +import Layers from '@mapstore/framework/utils/openlayers/Layers'; import TileLayer from 'ol/layer/Tile'; import TileArcGISRest from 'ol/source/TileArcGISRest'; diff --git a/geonode_mapstore_client/client/js/epics/index.js b/geonode_mapstore_client/client/js/epics/index.js index 06aae4d6c3..22cd6fc81a 100644 --- a/geonode_mapstore_client/client/js/epics/index.js +++ b/geonode_mapstore_client/client/js/epics/index.js @@ -11,33 +11,33 @@ */ const Rx = require("rxjs"); -const { SELECT_NODE } = require("../../MapStore2/web/client/actions/layers"); -const { setPermission } = require("../../MapStore2/web/client/actions/featuregrid"); -const { setEditPermissionStyleEditor, INIT_STYLE_SERVICE } = require("../../MapStore2/web/client/actions/styleeditor"); +const { SELECT_NODE } = require("@mapstore/framework/actions/layers"); +const { setPermission } = require("@mapstore/framework/actions/featuregrid"); +const { setEditPermissionStyleEditor, INIT_STYLE_SERVICE } = require("@mapstore/framework/actions/styleeditor"); const { layerEditPermissions, styleEditPermissions, updateThumb } = require("../api/geonode"); -const { getSelectedLayer, layersSelector } = require("../../MapStore2/web/client/selectors/layers"); -const { mapSelector } = require("../../MapStore2/web/client/selectors/map"); -const ConfigUtils = require("../../MapStore2/web/client/utils/ConfigUtils"); - -const { updateMapLayout } = require('../../MapStore2/web/client/actions/maplayout'); -const { TOGGLE_CONTROL, SET_CONTROL_PROPERTY, SET_CONTROL_PROPERTIES } = require('../../MapStore2/web/client/actions/controls'); -const { MAP_CONFIG_LOADED } = require('../../MapStore2/web/client/actions/config'); -const { SIZE_CHANGE, CLOSE_FEATURE_GRID, OPEN_FEATURE_GRID } = require('../../MapStore2/web/client/actions/featuregrid'); -const { CLOSE_IDENTIFY, ERROR_FEATURE_INFO, TOGGLE_MAPINFO_STATE, LOAD_FEATURE_INFO, EXCEPTIONS_FEATURE_INFO, NO_QUERYABLE_LAYER } = require('../../MapStore2/web/client/actions/mapInfo'); -const { SHOW_SETTINGS, HIDE_SETTINGS } = require('../../MapStore2/web/client/actions/layers'); -const { PURGE_MAPINFO_RESULTS } = require('../../MapStore2/web/client/actions/mapInfo'); -const { isMapInfoOpen } = require('../../MapStore2/web/client/selectors/mapInfo'); - -const { isFeatureGridOpen, getDockSize } = require('../../MapStore2/web/client/selectors/featuregrid'); +const { getSelectedLayer, layersSelector } = require("@mapstore/framework/selectors/layers"); +const { mapSelector } = require("@mapstore/framework/selectors/map"); +const ConfigUtils = require("@mapstore/framework/utils/ConfigUtils"); + +const { updateMapLayout } = require('@mapstore/framework/actions/maplayout'); +const { TOGGLE_CONTROL, SET_CONTROL_PROPERTY, SET_CONTROL_PROPERTIES } = require('@mapstore/framework/actions/controls'); +const { MAP_CONFIG_LOADED } = require('@mapstore/framework/actions/config'); +const { SIZE_CHANGE, CLOSE_FEATURE_GRID, OPEN_FEATURE_GRID } = require('@mapstore/framework/actions/featuregrid'); +const { CLOSE_IDENTIFY, ERROR_FEATURE_INFO, TOGGLE_MAPINFO_STATE, LOAD_FEATURE_INFO, EXCEPTIONS_FEATURE_INFO, NO_QUERYABLE_LAYER } = require('@mapstore/framework/actions/mapInfo'); +const { SHOW_SETTINGS, HIDE_SETTINGS } = require('@mapstore/framework/actions/layers'); +const { PURGE_MAPINFO_RESULTS } = require('@mapstore/framework/actions/mapInfo'); +const { isMapInfoOpen } = require('@mapstore/framework/selectors/mapInfo'); + +const { isFeatureGridOpen, getDockSize } = require('@mapstore/framework/selectors/featuregrid'); const { head, get } = require('lodash'); -// const {updateMapLayoutEpic} = require('../../MapStore2/web/client/epics/maplayout'); +// const {updateMapLayoutEpic} = require('@mapstore/framework/epics/maplayout'); -// const {basicError} = require('../../MapStore2/web/client/utils/NotificationUtils'); +// const {basicError} = require('@mapstore/framework/utils/NotificationUtils'); /** * We need to include missing epics. The plugins that normally include this epic is not used. */ -const { mapSaveMapResourceEpic } = require("../../MapStore2/web/client/epics/maps"); -const { showCoordinateEditorSelector } = require('../../MapStore2/web/client/selectors/controls'); +const { mapSaveMapResourceEpic } = require("@mapstore/framework/epics/maps"); +const { showCoordinateEditorSelector } = require('@mapstore/framework/selectors/controls'); /** diff --git a/geonode_mapstore_client/client/js/extend.js b/geonode_mapstore_client/client/js/extend.js new file mode 100644 index 0000000000..8298679274 --- /dev/null +++ b/geonode_mapstore_client/client/js/extend.js @@ -0,0 +1,10 @@ +/** + * Copyright 2020, 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. + */ + +export const extendPluginsDefinition = false; +export default { extendPluginsDefinition }; diff --git a/geonode_mapstore_client/client/js/plugins.js b/geonode_mapstore_client/client/js/plugins.js index 9f90e0dec1..95422adb6a 100644 --- a/geonode_mapstore_client/client/js/plugins.js +++ b/geonode_mapstore_client/client/js/plugins.js @@ -6,60 +6,69 @@ * LICENSE file in the root directory of this source tree. */ // geonode specific epics -const epics = require("./epics"); +const epics = require("@js/epics"); +const { extendPluginsDefinition } = require("@extend/jsapi/plugins"); -module.exports = { +const pluginsDefinition = { plugins: { - AddGroupPlugin: require('../MapStore2/web/client/plugins/AddGroup').default, - IdentifyPlugin: require('../MapStore2/web/client/plugins/Identify'), - TOCPlugin: require('../MapStore2/web/client/plugins/TOC'), - MapPlugin: require('../MapStore2/web/client/plugins/Map').default, - ToolbarPlugin: require('../MapStore2/web/client/plugins/Toolbar'), - DrawerMenuPlugin: require('../MapStore2/web/client/plugins/DrawerMenu'), - ZoomAllPlugin: require('../MapStore2/web/client/plugins/ZoomAll'), - MapLoadingPlugin: require('../MapStore2/web/client/plugins/MapLoading'), - OmniBarPlugin: require('../MapStore2/web/client/plugins/OmniBar'), - BackgroundSelectorPlugin: require('../MapStore2/web/client/plugins/BackgroundSelector').default, - FullScreenPlugin: require('../MapStore2/web/client/plugins/FullScreen'), - ZoomInPlugin: require('../MapStore2/web/client/plugins/ZoomIn'), - ZoomOutPlugin: require('../MapStore2/web/client/plugins/ZoomOut'), - ExpanderPlugin: require('../MapStore2/web/client/plugins/Expander'), - BurgerMenuPlugin: require('../MapStore2/web/client/plugins/BurgerMenu'), - UndoPlugin: require('../MapStore2/web/client/plugins/History'), - RedoPlugin: require('../MapStore2/web/client/plugins/History'), - ScaleBoxPlugin: require('../MapStore2/web/client/plugins/ScaleBox'), - MapFooterPlugin: require('../MapStore2/web/client/plugins/MapFooter'), - PrintPlugin: require('../MapStore2/web/client/plugins/Print'), - MeasurePlugin: require('../MapStore2/web/client/plugins/Measure'), - FilterLayerPlugin: require('../MapStore2/web/client/plugins/FilterLayer').default, - TOCItemsSettingsPlugin: require('../MapStore2/web/client/plugins/TOCItemsSettings').default, - WidgetsPlugin: require('../MapStore2/web/client/plugins/Widgets').default, - WidgetsBuilderPlugin: require('../MapStore2/web/client/plugins/WidgetsBuilder').default, - WidgetsTrayPlugin: require('../MapStore2/web/client/plugins/WidgetsTray').default, - NotificationsPlugin: require('../MapStore2/web/client/plugins/Notifications'), - FeatureEditorPlugin: require('../MapStore2/web/client/plugins/FeatureEditor').default, - QueryPanelPlugin: require('../MapStore2/web/client/plugins/QueryPanel'), + AddGroupPlugin: require('@mapstore/framework/plugins/AddGroup').default, + IdentifyPlugin: require('@mapstore/framework/plugins/Identify'), + TOCPlugin: require('@mapstore/framework/plugins/TOC'), + MapPlugin: require('@mapstore/framework/plugins/Map').default, + ToolbarPlugin: require('@mapstore/framework/plugins/Toolbar'), + DrawerMenuPlugin: require('@mapstore/framework/plugins/DrawerMenu'), + ZoomAllPlugin: require('@mapstore/framework/plugins/ZoomAll'), + MapLoadingPlugin: require('@mapstore/framework/plugins/MapLoading'), + OmniBarPlugin: require('@mapstore/framework/plugins/OmniBar'), + BackgroundSelectorPlugin: require('@mapstore/framework/plugins/BackgroundSelector').default, + FullScreenPlugin: require('@mapstore/framework/plugins/FullScreen'), + ZoomInPlugin: require('@mapstore/framework/plugins/ZoomIn'), + ZoomOutPlugin: require('@mapstore/framework/plugins/ZoomOut'), + ExpanderPlugin: require('@mapstore/framework/plugins/Expander'), + BurgerMenuPlugin: require('@mapstore/framework/plugins/BurgerMenu'), + UndoPlugin: require('@mapstore/framework/plugins/History'), + RedoPlugin: require('@mapstore/framework/plugins/History'), + ScaleBoxPlugin: require('@mapstore/framework/plugins/ScaleBox'), + MapFooterPlugin: require('@mapstore/framework/plugins/MapFooter'), + PrintPlugin: require('@mapstore/framework/plugins/Print'), + MeasurePlugin: require('@mapstore/framework/plugins/Measure'), + FilterLayerPlugin: require('@mapstore/framework/plugins/FilterLayer').default, + TOCItemsSettingsPlugin: require('@mapstore/framework/plugins/TOCItemsSettings').default, + WidgetsPlugin: require('@mapstore/framework/plugins/Widgets').default, + WidgetsBuilderPlugin: require('@mapstore/framework/plugins/WidgetsBuilder').default, + WidgetsTrayPlugin: require('@mapstore/framework/plugins/WidgetsTray').default, + NotificationsPlugin: require('@mapstore/framework/plugins/Notifications'), + FeatureEditorPlugin: require('@mapstore/framework/plugins/FeatureEditor').default, + QueryPanelPlugin: require('@mapstore/framework/plugins/QueryPanel'), SavePlugin: require('@js/plugins/Save').default, SaveAsPlugin: require('@js/plugins/SaveAs').default, - MetadataExplorerPlugin: require('../MapStore2/web/client/plugins/MetadataExplorer'), - GridContainerPlugin: require('../MapStore2/web/client/plugins/GridContainer'), - StyleEditorPlugin: require('../MapStore2/web/client/plugins/StyleEditor'), - TimelinePlugin: require('../MapStore2/web/client/plugins/Timeline'), - PlaybackPlugin: require('../MapStore2/web/client/plugins/Playback'), - MousePositionPlugin: require('../MapStore2/web/client/plugins/MousePosition'), - SearchPlugin: require('../MapStore2/web/client/plugins/Search'), - SearchServicesConfigPlugin: require('../MapStore2/web/client/plugins/SearchServicesConfig'), + MetadataExplorerPlugin: require('@mapstore/framework/plugins/MetadataExplorer'), + GridContainerPlugin: require('@mapstore/framework/plugins/GridContainer'), + StyleEditorPlugin: require('@mapstore/framework/plugins/StyleEditor'), + TimelinePlugin: require('@mapstore/framework/plugins/Timeline'), + PlaybackPlugin: require('@mapstore/framework/plugins/Playback'), + MousePositionPlugin: require('@mapstore/framework/plugins/MousePosition'), + SearchPlugin: require('@mapstore/framework/plugins/Search'), + SearchServicesConfigPlugin: require('@mapstore/framework/plugins/SearchServicesConfig'), + SwipePlugin: require('@mapstore/framework/plugins/Swipe').default, + LocatePlugin: require('@mapstore/framework/plugins/Locate').default, AddReducersAndEpics: { reducers: { - security: require('../MapStore2/web/client/reducers/security').default, - maps: require('../MapStore2/web/client/reducers/maps').default, - maplayout: require('../MapStore2/web/client/reducers/maplayout').default + security: require('@mapstore/framework/reducers/security').default, + maps: require('@mapstore/framework/reducers/maps').default, + maplayout: require('@mapstore/framework/reducers/maplayout').default }, epics } }, requires: { ReactSwipe: require('react-swipeable-views').default, - SwipeHeader: require('../MapStore2/web/client/components/data/identify/SwipeHeader') + SwipeHeader: require('@mapstore/framework/components/data/identify/SwipeHeader') } }; + +const extendedPluginsDefinition = extendPluginsDefinition + ? extendPluginsDefinition(pluginsDefinition) + : pluginsDefinition; + +module.exports = extendedPluginsDefinition; diff --git a/geonode_mapstore_client/client/js/previewPlugins.js b/geonode_mapstore_client/client/js/previewPlugins.js index ffa2751238..13e433880e 100644 --- a/geonode_mapstore_client/client/js/previewPlugins.js +++ b/geonode_mapstore_client/client/js/previewPlugins.js @@ -6,31 +6,34 @@ * LICENSE file in the root directory of this source tree. */ const Rx = require("rxjs"); -const {_setThumbnail, updateMapLayoutEpic} = require("./epics"); -module.exports = { +const {_setThumbnail, updateMapLayoutEpic} = require("@js/epics"); + +const { extendPluginsDefinition } = require("@extend/jsapi/previewPlugins"); + +const pluginsDefinition = { plugins: { - MapPlugin: require('../MapStore2/web/client/plugins/Map').default, - IdentifyPlugin: require('../MapStore2/web/client/plugins/Identify'), - ToolbarPlugin: require('../MapStore2/web/client/plugins/Toolbar'), - ZoomAllPlugin: require('../MapStore2/web/client/plugins/ZoomAll'), - MapLoadingPlugin: require('../MapStore2/web/client/plugins/MapLoading'), - OmniBarPlugin: require('../MapStore2/web/client/plugins/OmniBar'), - BackgroundSelectorPlugin: require('../MapStore2/web/client/plugins/BackgroundSelector').default, - FullScreenPlugin: require('../MapStore2/web/client/plugins/FullScreen'), - ZoomInPlugin: require('../MapStore2/web/client/plugins/ZoomIn'), - ZoomOutPlugin: require('../MapStore2/web/client/plugins/ZoomOut'), - ExpanderPlugin: require('../MapStore2/web/client/plugins/Expander'), - BurgerMenuPlugin: require('../MapStore2/web/client/plugins/BurgerMenu'), - ScaleBoxPlugin: require('../MapStore2/web/client/plugins/ScaleBox'), - MapFooterPlugin: require('../MapStore2/web/client/plugins/MapFooter'), - PrintPlugin: require('../MapStore2/web/client/plugins/Print'), - TimelinePlugin: require('../MapStore2/web/client/plugins/Timeline'), - PlaybackPlugin: require('../MapStore2/web/client/plugins/Playback'), + MapPlugin: require('@mapstore/framework/plugins/Map').default, + IdentifyPlugin: require('@mapstore/framework/plugins/Identify'), + ToolbarPlugin: require('@mapstore/framework/plugins/Toolbar'), + ZoomAllPlugin: require('@mapstore/framework/plugins/ZoomAll'), + MapLoadingPlugin: require('@mapstore/framework/plugins/MapLoading'), + OmniBarPlugin: require('@mapstore/framework/plugins/OmniBar'), + BackgroundSelectorPlugin: require('@mapstore/framework/plugins/BackgroundSelector').default, + FullScreenPlugin: require('@mapstore/framework/plugins/FullScreen'), + ZoomInPlugin: require('@mapstore/framework/plugins/ZoomIn'), + ZoomOutPlugin: require('@mapstore/framework/plugins/ZoomOut'), + ExpanderPlugin: require('@mapstore/framework/plugins/Expander'), + BurgerMenuPlugin: require('@mapstore/framework/plugins/BurgerMenu'), + ScaleBoxPlugin: require('@mapstore/framework/plugins/ScaleBox'), + MapFooterPlugin: require('@mapstore/framework/plugins/MapFooter'), + PrintPlugin: require('@mapstore/framework/plugins/Print'), + TimelinePlugin: require('@mapstore/framework/plugins/Timeline'), + PlaybackPlugin: require('@mapstore/framework/plugins/Playback'), AddReducersAndEpics: { reducers: { - security: require('../MapStore2/web/client/reducers/security').default, - maps: require('../MapStore2/web/client/reducers/maps').default, - maplayout: require('../MapStore2/web/client/reducers/maplayout').default + security: require('@mapstore/framework/reducers/security').default, + maps: require('@mapstore/framework/reducers/maps').default, + maplayout: require('@mapstore/framework/reducers/maplayout').default }, epics: { _setThumbnail, @@ -41,6 +44,12 @@ module.exports = { }, requires: { ReactSwipe: require('react-swipeable-views').default, - SwipeHeader: require('../MapStore2/web/client/components/data/identify/SwipeHeader') + SwipeHeader: require('@mapstore/framework/components/data/identify/SwipeHeader') } }; + +const extendedPluginsDefinition = extendPluginsDefinition + ? extendPluginsDefinition(pluginsDefinition) + : pluginsDefinition; + +module.exports = extendedPluginsDefinition; diff --git a/geonode_mapstore_client/client/karma.conf.continuous-test.js b/geonode_mapstore_client/client/karma.conf.continuous-test.js deleted file mode 100644 index 6f36839520..0000000000 --- a/geonode_mapstore_client/client/karma.conf.continuous-test.js +++ /dev/null @@ -1,22 +0,0 @@ -const path = require('path'); - -module.exports = function karmaConfig(config) { - config.set(require('./MapStore2/build/testConfig')({ - files: [ - 'tests.webpack.js', - { pattern: './MapStore2/**/*', included: false } - ], - browsers: ['Chrome'], - basePath: '.', - path: [ - path.join(__dirname, 'js'), - path.join(__dirname, 'MapStore2', 'web', 'client') - ], - testFile: 'tests.webpack.js', - singleRun: false, - alias: { - '@js': path.join(__dirname, 'js'), - '@mapstore/framework': path.join(__dirname, 'MapStore2', 'web', 'client') - } - })); -}; diff --git a/geonode_mapstore_client/client/karma.conf.single-run.js b/geonode_mapstore_client/client/karma.conf.single-run.js deleted file mode 100644 index d90904f117..0000000000 --- a/geonode_mapstore_client/client/karma.conf.single-run.js +++ /dev/null @@ -1,33 +0,0 @@ -const path = require("path"); - -module.exports = function karmaConfig(config) { - const testConfig = require('./MapStore2/build/testConfig')({ - files: [ - 'tests.webpack.js', - { pattern: './MapStore2/**/*', included: false } - ], - path: [ - path.join(__dirname, 'js'), - path.join(__dirname, 'MapStore2', 'web', 'client') - ], - basePath: '.', - testFile: 'tests.webpack.js', - singleRun: true, - alias: { - '@js': path.join(__dirname, 'js'), - '@mapstore/framework': path.join(__dirname, 'MapStore2', 'web', 'client') - } - }); - testConfig.webpack.module.rules = [{ - test: /\.jsx?$/, - exclude: /(__tests__|node_modules|legacy|libs\\Cesium|libs\\html2canvas)\\|(__tests__|node_modules|legacy|libs\/Cesium|libs\/html2canvas)\/|webpack\.js|utils\/(openlayers|leaflet)/, - enforce: "post", - use: [ - { - loader: 'istanbul-instrumenter-loader', - options: { esModules: true } - } - ] - }, ...testConfig.webpack.module.rules]; - config.set(testConfig); -}; diff --git a/geonode_mapstore_client/client/mergeDependencies.js b/geonode_mapstore_client/client/mergeDependencies.js deleted file mode 100644 index f2d9f9d6b5..0000000000 --- a/geonode_mapstore_client/client/mergeDependencies.js +++ /dev/null @@ -1,6 +0,0 @@ -var fs = require('fs'); -var msP = JSON.parse(fs.readFileSync("./MapStore2/package.json", "utf8")); -var projP = JSON.parse(fs.readFileSync("./package.json", "utf8")); -var devDependencies = {...(projP.devDependencies || {}), ...msP.devDependencies}; -var dependencies = {...(projP.dependencies || {}), ...msP.dependencies}; -fs.writeFileSync("./package.json", JSON.stringify({...projP, devDependencies, dependencies}, null, 2), "utf8"); diff --git a/geonode_mapstore_client/client/package.json b/geonode_mapstore_client/client/package.json index b49afecb2c..b5f6503520 100644 --- a/geonode_mapstore_client/client/package.json +++ b/geonode_mapstore_client/client/package.json @@ -1,263 +1,34 @@ { - "name": "ms2-geonode-api", - "version": "2.0.4", + "name": "geonode-mapstore-client", + "version": "0.0.6", "description": "MapStore 2 Api bundle specific to geonode framework", "main": "api.js", + "eslintConfig": { + "extends": [ + "@mapstore/eslint-config-mapstore" + ], + "parserOptions": { + "babelOptions": { + "configFile": "./node_modules/mapstore/build/babel.config.js" + } + }, + "globals": { + "__GEONODE_PROJECT_CONFIG__": false + } + }, "scripts": { - "clean": "rimraf ../static/mapstore", - "compile": "npm run clean && mkdirp ../static/mapstore/dist && webpack --progress --config prod-webpack.config.js", - "start": "webpack-dev-server --progress --colors --port 8081 --hot --inline", - "startprod": "webpack-dev-server --progress --colors --port 8081 --hot --inline --content-base . --config prod-webpack.config.js", - "lint": "eslint js --ext .jsx,.js", - "analyze": "webpack --json | webpack-bundle-size-analyzer", - "postinstall": "rimraf node_modules/leaflet-simple-graticule/node_modules && rimraf node_modules/react-sortable-items/node_modules/react-dom && rimraf node_modules/mocha && ncp node_modules/@geosolutions/mocha node_modules/mocha", - "postcompile": "mkdirp ../static/mapstore/MapStore2/web/client/ && ncp ./MapStore2/web/client/translations ../static/mapstore/MapStore2/web/client/.", - "test": "karma start karma.conf.single-run.js --colors", - "test:watch": "karma start karma.conf.continuous-test.js --colors" + "compile": "mapstore-project compile geonode && node postCompile", + "start": "mapstore-project start geonode", + "test": "mapstore-project test geonode", + "test:watch": "mapstore-project test:watch geonode", + "update-project": "mapstore-project update geonode" }, "author": "GeoSolutions", "license": "BSD-2-Clause", "devDependencies": { - "@babel/core": "7.8.7", - "@babel/plugin-proposal-class-properties": "7.8.3", - "@babel/plugin-syntax-dynamic-import": "7.8.3", - "@babel/preset-env": "7.8.7", - "@babel/preset-react": "7.8.3", - "@geosolutions/acorn-jsx": "4.0.2", - "@geosolutions/jsdoc": "3.4.4", - "@geosolutions/mocha": "6.2.1-3", - "@mapstore/eslint-config-mapstore": "1.0.1", - "axios-mock-adapter": "1.16.0", - "babel-eslint": "10.0.3", - "babel-istanbul-loader": "0.1.0", - "babel-loader": "8.0.5", - "babel-plugin-add-module-exports": "0.1.4", - "babel-plugin-object-assign": "1.2.1", - "babel-plugin-react-transform": "2.0.2", - "cesium": "1.17.0", - "copy-webpack-plugin": "5.0.2", - "css-loader": "0.19.0", - "denodeify": "1.2.1", - "docma": "1.5.1", - "download-cli": "1.0.1", - "dynamic-public-path-webpack-plugin": "1.0.4", - "escope": "3.2.0", - "eslint": "7.8.1", - "eslint-plugin-import": "2.20.2", - "eslint-plugin-no-only-tests": "2.3.1", - "eslint-plugin-react": "3.3.2", - "expect": "1.20.1", - "file-loader": "2.0.0", - "glob": "7.1.1", - "html-loader": "0.5.1", - "html-webpack-plugin": "3.2.0", - "jsdoc-jsx": "0.1.0", - "karma": "4.3.0", - "karma-chrome-launcher": "3.1.0", - "karma-cli": "2.0.0", - "karma-coverage": "2.0.1", - "karma-coveralls": "2.1.0", - "karma-firefox-launcher": "1.2.0", - "karma-ie-launcher": "1.0.0", - "karma-junit-reporter": "1.2.0", - "karma-mocha": "1.3.0", - "karma-mocha-reporter": "2.2.5", - "karma-sourcemap-loader": "0.3.7", - "karma-webpack": "4.0.2", - "less": "2.7.1", - "less-loader": "4.1.0", - "mini-css-extract-plugin": "0.5.0", - "mkdirp": "0.5.1", - "ncp": "2.0.0", - "parallelshell": "1.2.0", - "postcss": "7.0.14", - "postcss-loader": "3.0.0", - "postcss-prefix-selector": "1.7.1", - "progress-bar-webpack-plugin": "1.12.1", - "raw-loader": "0.5.1", - "react-motion": "0.5.0", - "react-transition-group": "1.1.3", - "readline-promise": "1.0.4", - "redux-devtools": "3.4.0", - "redux-devtools-dock-monitor": "1.1.2", - "redux-devtools-log-monitor": "1.3.0", - "redux-immutable-state-invariant": "2.1.0", - "redux-mock-store": "1.2.2", - "rimraf": "2.5.2", - "simple-git": "2.20.1", - "style-loader": "0.12.4", - "url-loader": "0.5.7", - "vusion-webfonts-generator": "0.4.1", - "webpack": "4.41.5", - "webpack-bundle-size-analyzer": "2.0.2", - "webpack-cli": "3.3.6", - "webpack-dev-server": "3.10.3" + "@mapstore/project": "git+https://github.com/geosolutions-it/mapstore-project.git#b752ff71f58f73addb164aeb472a9d353ca17c50" }, "dependencies": { - "@boundlessgeo/jsonix": "2.4.3", - "@carnesen/redux-add-action-listener-enhancer": "0.0.1", - "@geosolutions/proj4": "2.4.7", - "@geosolutions/react-joyride": "1.10.2", - "@geosolutions/wkt-parser": "1.2.2", - "@mapbox/geojsonhint": "2.0.1", - "@mapbox/togeojson": "0.16.0", - "@terrestris/base-util": "0.1.4", - "@terrestris/ol-util": "3.0.0", - "@turf/bbox": "4.1.0", - "@turf/bbox-polygon": "5.1.5", - "@turf/boolean-contains": "5.1.5", - "@turf/boolean-overlap": "5.1.5", - "@turf/center": "5.1.5", - "@turf/circle": "6.0.1", - "@turf/great-circle": "5.1.5", - "@turf/inside": "4.1.0", - "@turf/line-intersect": "4.1.0", - "@turf/point-on-surface": "4.1.0", - "@turf/polygon-to-linestring": "4.1.0", - "ag-grid-community": "20.2.0", - "ag-grid-react": "20.2.0", - "axios": "0.18.1", - "b64-to-blob": "1.2.19", - "babel-polyfill": "6.8.0", - "babel-standalone": "6.7.7", - "bootstrap": "3.3.5", - "canvas-to-blob": "0.0.0", - "canvg-browser": "1.0.0", - "chroma-js": "1.3.7", - "classnames": "2.2.5", - "codemirror": "5.18.2", - "colorbrewer": "1.0.0", - "connected-react-router": "6.3.2", - "create-react-class": "15.6.3", - "css-tree": "1.0.0-alpha24", - "draft-js": "0.11.0", - "draft-js-inline-toolbar-plugin": "3.0.0", - "draft-js-plugins-editor": "2.1.1", - "draft-js-side-toolbar-plugin": "3.0.1", - "draftjs-to-html": "0.8.4", - "element-closest": "2.0.2", - "es6-object-assign": "1.1.0", - "es6-promise": "2.3.0", - "eventlistener": "0.0.1", - "file-saver": "1.3.3", - "fs-extra": "3.0.1", - "geostyler-geocss-parser": "https://github.com/allyoucanmap/geostyler-geocss-parser/tarball/build", - "geostyler-openlayers-parser": "1.1.4", - "geostyler-sld-parser": "2.0.1", - "history": "4.6.1", - "html-to-draftjs": "npm:@geosolutions/html-to-draftjs@1.5.1", - "html2canvas": "0.5.0-beta4", - "immutable": "4.0.0-rc.12", - "intersection-observer": "0.7.0", - "intl": "1.2.2", - "is-equal": "1.5.5", - "ismobilejs": "0.5.0", - "istanbul-instrumenter-loader": "3.0.1", - "json-2-csv": "2.1.2", - "json-loader": "0.5.7", - "jsonlint-mod": "1.7.5", - "jszip": "3.1.5", - "keymirror": "0.1.1", - "leaflet": "1.3.1", - "leaflet-draw": "1.0.2", - "leaflet-extra-markers": "1.0.6", - "leaflet-minimap": "3.6.0", - "leaflet-plugins": "3.0.2", - "leaflet-simple-graticule": "1.0.2", - "leaflet.gridlayer.googlemutant": "0.6.4", - "leaflet.locatecontrol": "0.62.0", - "leaflet.nontiledlayer": "1.0.7", - "lodash": "4.17.19", - "lrucache": "1.0.3", - "moment": "2.21.0", - "node-geo-distance": "1.2.0", - "object-assign": "4.1.1", - "object-fit-images": "3.2.4", - "ogc-schemas": "2.6.1", - "ol": "5.3.0", - "pdfviewer": "0.3.2", - "prop-types": "15.7.2", - "qrcode.react": "0.9.3", - "query-string": "6.9.0", - "react": "16.10.1", - "react-addons-css-transition-group": "15.6.2", - "react-addons-shallow-compare": "15.6.2", - "react-bootstrap": "0.31.0", - "react-checkbox-tree": "1.5.1", - "react-codemirror2": "4.0.0", - "react-color": "2.17.0", - "react-confirm-button": "0.0.2", - "react-container-dimensions": "1.3.2", - "react-contenteditable": "3.3.2", - "react-copy-to-clipboard": "5.0.0", - "react-data-grid": "5.0.4", - "react-data-grid-addons": "5.0.4", - "react-dnd": "2.6.0", - "react-dnd-html5-backend": "2.6.0", - "react-dnd-test-backend": "2.6.0", - "react-dock": "0.2.4", - "react-dom": "16.10.1", - "react-draft-wysiwyg": "npm:@geosolutions/react-draft-wysiwyg@1.14.8", - "react-draggable": "2.2.6", - "react-dropzone": "3.13.1", - "react-error-boundary": "1.2.5", - "react-grid-layout": "0.16.6", - "react-image-lightbox": "4.2.2", - "react-input-autosize": "1.1.4", - "react-intersection-observer": "8.24.1", - "react-intl": "2.3.0", - "react-notification-system": "0.2.14", - "react-nouislider": "2.0.1", - "react-numeric-input": "2.2.3", - "react-overlays": "1.2.0", - "react-pdf": "4.0.5", - "react-player": "1.15.3", - "react-quill": "1.1.0", - "react-redux": "6.0.0", - "react-resize-detector": "4.2.1", - "react-responsive": "1.3.0", - "react-router": "4.1.1", - "react-router-dom": "4.2.2", - "react-scroll-up": "1.3.0", - "react-select": "1.3.0", - "react-selectize": "3.0.1", - "react-share": "1.15.1", - "react-side-effect": "1.1.0", - "react-sidebar": "2.3.2", - "react-spinkit": "2.1.2", - "react-swipeable": "5.5.1", - "react-swipeable-views": "0.12.2", - "react-textfit": "1.1.0", - "react-twitter-widgets": "1.3.0", - "react-widgets": "3.5.0", - "recharts": "0.22.4", - "recompose": "0.24.0", - "redux": "3.6.0", - "redux-logger": "3.0.6", - "redux-observable": "0.19.0", - "redux-thunk": "0.1.0", - "redux-undo": "0.5.0", - "reselect": "4.0.0", - "resize-observer-polyfill": "1.5.0", - "rxjs": "5.1.1", - "screenfull": "4.0.0", - "shpjs": "3.4.2", - "stickybits": "3.6.6", - "tinycolor2": "1.4.1", - "turf-bbox": "3.0.10", - "turf-buffer": "3.0.10", - "turf-intersect": "3.0.10", - "turf-point": "2.0.1", - "turf-point-on-surface": "3.0.10", - "turf-union": "3.0.10", - "url": "0.11.0", - "uuid": "3.0.1", - "vis": "4.21.0", - "w3c-schemas": "1.3.1", - "webfontloader": "1.6.28", - "wellknown": "0.5.0", - "xml2js": "0.4.17", - "xmldom": "0.3.0", - "xpath": "0.0.27" + "mapstore": "file:MapStore2" } } diff --git a/geonode_mapstore_client/client/postCompile.js b/geonode_mapstore_client/client/postCompile.js new file mode 100644 index 0000000000..b6f54608a9 --- /dev/null +++ b/geonode_mapstore_client/client/postCompile.js @@ -0,0 +1,22 @@ + +const fs = require('fs'); +const childProcess = require('child_process'); + +const packageJSONPath = './package.json'; +const rootPackageJSONPath = '../../package.json'; + +// copy dependencies to root package + +const packageJSON = require(packageJSONPath); +const rootPackageJSON = require(rootPackageJSONPath); + +const mapStoreCommit = childProcess + .execSync('git rev-parse @:./MapStore2') + .toString().trim(); + +const mapStorePackage = `git+https://github.com/geosolutions-it/MapStore2.git#${mapStoreCommit}`; + +rootPackageJSON.dependencies = JSON.parse(JSON.stringify(packageJSON.dependencies)); +rootPackageJSON.dependencies.mapstore = mapStorePackage; + +fs.writeFileSync(rootPackageJSONPath, JSON.stringify(rootPackageJSON, null, 2), 'utf8'); diff --git a/geonode_mapstore_client/client/prod-webpack.config.js b/geonode_mapstore_client/client/prod-webpack.config.js deleted file mode 100644 index 21cc08be03..0000000000 --- a/geonode_mapstore_client/client/prod-webpack.config.js +++ /dev/null @@ -1,29 +0,0 @@ -const path = require("path"); - -const themeEntries = { - "themes/default": path.join(__dirname, "themes", "default", "theme.less"), - "themes/preview": path.join(__dirname, "themes", "preview", "theme.less") -}; -const extractThemesPlugin = require('./MapStore2/build/themes.js').extractThemesPlugin; - -module.exports = require('./MapStore2/build/buildConfig')( - { - 'ms2-geonode-api': path.join(__dirname, "js", "api") - }, - themeEntries, - { - base: __dirname, - dist: path.join(__dirname, "../static/mapstore/dist"), - framework: path.join(__dirname, "MapStore2", "web", "client"), - code: [path.join(__dirname, "js"), path.join(__dirname, "MapStore2", "web", "client")] - }, - extractThemesPlugin, - true, - "/static/mapstore/dist/", - '.msgapi', - [], - { - '@js': path.join(__dirname, 'js'), - '@mapstore/framework': path.join(__dirname, 'MapStore2', 'web', 'client') - } -); diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.de-DE.json b/geonode_mapstore_client/client/static/mapstore/translations/data.de-DE.json new file mode 100644 index 0000000000..52097bcf5b --- /dev/null +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.de-DE.json @@ -0,0 +1,4 @@ +{ + "locale": "de-DE", + "messages": {} +} diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.en-US.json b/geonode_mapstore_client/client/static/mapstore/translations/data.en-US.json new file mode 100644 index 0000000000..509fd4e2eb --- /dev/null +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.en-US.json @@ -0,0 +1,4 @@ +{ + "locale": "en-US", + "messages": {} +} diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.es-ES.json b/geonode_mapstore_client/client/static/mapstore/translations/data.es-ES.json new file mode 100644 index 0000000000..9590e6afb4 --- /dev/null +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.es-ES.json @@ -0,0 +1,4 @@ +{ + "locale": "es-ES", + "messages": {} +} diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.fr-FR.json b/geonode_mapstore_client/client/static/mapstore/translations/data.fr-FR.json new file mode 100644 index 0000000000..733e3effd4 --- /dev/null +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.fr-FR.json @@ -0,0 +1,4 @@ +{ + "locale": "fr-FR", + "messages": {} +} diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.it-IT.json b/geonode_mapstore_client/client/static/mapstore/translations/data.it-IT.json new file mode 100644 index 0000000000..12800e25e2 --- /dev/null +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.it-IT.json @@ -0,0 +1,4 @@ +{ + "locale": "it-IT", + "messages": {} +} diff --git a/geonode_mapstore_client/client/tests.webpack.js b/geonode_mapstore_client/client/tests.webpack.js deleted file mode 100644 index 189971c09e..0000000000 --- a/geonode_mapstore_client/client/tests.webpack.js +++ /dev/null @@ -1,3 +0,0 @@ -var context = require.context('./js', true, /-test\.jsx?$/); -context.keys().forEach(context); -module.exports = context; diff --git a/geonode_mapstore_client/client/themes/default/theme.less b/geonode_mapstore_client/client/themes/default/theme.less index d137c41b97..a669bae23a 100644 --- a/geonode_mapstore_client/client/themes/default/theme.less +++ b/geonode_mapstore_client/client/themes/default/theme.less @@ -1,4 +1,4 @@ -@ms2-path: "../../MapStore2/web/client/themes/default"; +@ms2-path: "~mapstore/web/client/themes/default"; @import "@{ms2-path}/base.less"; @import "@{ms2-path}/icons.less"; diff --git a/geonode_mapstore_client/client/themes/preview/less/geonode.less b/geonode_mapstore_client/client/themes/preview/less/geonode.less index 6c891dabd1..6dc19c275a 100644 --- a/geonode_mapstore_client/client/themes/preview/less/geonode.less +++ b/geonode_mapstore_client/client/themes/preview/less/geonode.less @@ -21,7 +21,7 @@ @icon-size: 18px; @padding-left-square: floor(@icon-size/@icon-margin-ratio); @square-btn-size: @padding-left-square * 2 + @icon-size; - @import (multiple) "../../../MapStore2/web/client/themes/default/ms2-theme.less"; + @import (multiple) "~mapstore/web/client/themes/default/ms2-theme.less"; #mapstore-navbar-container{ height: @square-btn-size; width: @square-btn-size; diff --git a/geonode_mapstore_client/client/themes/preview/theme.less b/geonode_mapstore_client/client/themes/preview/theme.less index 4abec8a775..722ef439c7 100644 --- a/geonode_mapstore_client/client/themes/preview/theme.less +++ b/geonode_mapstore_client/client/themes/preview/theme.less @@ -1,4 +1,4 @@ -@ms2-path: "../../MapStore2/web/client/themes/default"; +@ms2-path: "~mapstore/web/client/themes/default"; @import "@{ms2-path}/base.less"; @import "@{ms2-path}/icons.less"; diff --git a/geonode_mapstore_client/client/version.txt b/geonode_mapstore_client/client/version.txt index e21008e78f..5a079bbf0c 100644 --- a/geonode_mapstore_client/client/version.txt +++ b/geonode_mapstore_client/client/version.txt @@ -1 +1 @@ -ms2-geonode-api-2.0.2 \ No newline at end of file +geonode-mapstore-client-v0.0.6-c965a7da47a438212ea26625812f16d452c2653a \ No newline at end of file diff --git a/geonode_mapstore_client/client/webpack.config.js b/geonode_mapstore_client/client/webpack.config.js deleted file mode 100644 index 566be20f14..0000000000 --- a/geonode_mapstore_client/client/webpack.config.js +++ /dev/null @@ -1,89 +0,0 @@ -const path = require('path'); -const assign = require('object-assign'); - -const themeEntries = { - 'themes/default': path.join(__dirname, 'themes', 'default', 'theme.less'), - 'themes/preview': path.join(__dirname, 'themes', 'preview', 'theme.less') -}; -const extractThemesPlugin = require('./MapStore2/build/themes.js').extractThemesPlugin; - -const envJson = require('./env.json'); - -const DEV_SERVER_HOST = envJson.DEV_SERVER_HOST || 'ERROR:INSERT_DEV_SERVER_HOST_IN_ENV_JSON_CONFIG! eg: my-geonode-host.org'; -const protocol = envJson.DEV_SERVER_HOST_PROTOCOL || 'http'; - -module.exports = assign({}, require('./MapStore2/build/buildConfig')( - { - 'ms2-geonode-api': path.join(__dirname, 'js', 'api') - }, - themeEntries, - { - base: __dirname, - dist: path.join(__dirname, 'dist'), - framework: path.join(__dirname, 'MapStore2', 'web', 'client'), - code: [path.join(__dirname, 'js'), path.join(__dirname, 'MapStore2', 'web', 'client')] - }, - extractThemesPlugin, - false, - `/static/mapstore/dist/`, - '.msgapi', - [], - { - '@js': path.join(__dirname, 'js'), - '@mapstore/framework': path.join(__dirname, 'MapStore2', 'web', 'client') - } -), { - devServer: { - https: protocol === 'https' ? true : false, - headers: { - 'Access-Control-Allow-Origin': '*' - }, - contentBase: [ - path.join(__dirname), - path.join(__dirname, '..', 'static') - ], - before: function(app) { - const hashRegex = /\.[a-zA-Z0-9]{1,}\.js/; - app.use(function(req, res, next) { - // remove hash from requests to use the local js - if (req.url.indexOf('/static/geonode/js/ms2/utils/') !== -1 - || req.url.indexOf('/ms2-geonode-api') !== -1) { - req.url = req.url.replace(hashRegex, '.js'); - req.path = req.path.replace(hashRegex, '.js'); - req.originalUrl = req.originalUrl.replace(hashRegex, '.js'); - } - next(); - }); - }, - proxy: [ - { - context: [ - '**', - '!**/static/mapstore/**', - '!**/static/geonode/js/ms2/utils/**', - '!**/geonode/js/ms2/utils/**', - '!**/MapStore2/**', - '!**/node_modules/**' - ], - target: `${protocol}://${DEV_SERVER_HOST}`, - headers: { - Host: DEV_SERVER_HOST, - Referer: `${protocol}://${DEV_SERVER_HOST}/` - } - }, - { - context: [ - '/static/mapstore/MapStore2/web/client/**', - '/static/geonode/js/ms2/utils/**' - ], - target: `${protocol}://localhost:8081`, - secure: false, - changeOrigin: true, - pathRewrite: { - '/static/mapstore/MapStore2/web/client/': '/MapStore2/web/client/translations/', - '/static/geonode/js/ms2/utils/': '/geonode/js/ms2/utils/' - } - } - ] - } -}); diff --git a/geonode_mapstore_client/static/geonode/js/ms2/utils/ms2_base_plugins.js b/geonode_mapstore_client/static/geonode/js/ms2/utils/ms2_base_plugins.js index 999707fac1..74f1b350b2 100644 --- a/geonode_mapstore_client/static/geonode/js/ms2/utils/ms2_base_plugins.js +++ b/geonode_mapstore_client/static/geonode/js/ms2/utils/ms2_base_plugins.js @@ -14,6 +14,11 @@ var MS2_BASE_PLUGINS = { "altShiftDragRotate": false } } + }, + "toolsOptions": { + "locate": { + // "maxZoom": 5 use a custom max zoom + } } } }, diff --git a/geonode_mapstore_client/static/geonode/js/ms2/utils/ms2_map_embed_plugins.js b/geonode_mapstore_client/static/geonode/js/ms2/utils/ms2_map_embed_plugins.js index 0ac229c415..50d762f0ee 100644 --- a/geonode_mapstore_client/static/geonode/js/ms2/utils/ms2_map_embed_plugins.js +++ b/geonode_mapstore_client/static/geonode/js/ms2/utils/ms2_map_embed_plugins.js @@ -54,6 +54,8 @@ var MS2_EMBED_PLUGINS = { "Widgets", "WidgetsTray", "Notifications", - "SearchServicesConfig" + "SearchServicesConfig", + { "name": "Swipe" }, + { "name": "Locate" } ] } \ No newline at end of file diff --git a/geonode_mapstore_client/static/geonode/js/ms2/utils/ms2_map_viewer_plugins.js b/geonode_mapstore_client/static/geonode/js/ms2/utils/ms2_map_viewer_plugins.js index 3fd91a0d34..dca42a754c 100644 --- a/geonode_mapstore_client/static/geonode/js/ms2/utils/ms2_map_viewer_plugins.js +++ b/geonode_mapstore_client/static/geonode/js/ms2/utils/ms2_map_viewer_plugins.js @@ -169,6 +169,8 @@ var MS2_MAP_PLUGINS = { "Notifications", "Timeline", "Playback", - "SearchServicesConfig" + "SearchServicesConfig", + { "name": "Swipe" }, + { "name": "Locate" } ] } diff --git a/geonode_mapstore_client/templates/geonode-mapstore-client/layer_edit.html b/geonode_mapstore_client/templates/geonode-mapstore-client/layer_edit.html index 6d1afa0c74..28f7d03bf7 100644 --- a/geonode_mapstore_client/templates/geonode-mapstore-client/layer_edit.html +++ b/geonode_mapstore_client/templates/geonode-mapstore-client/layer_edit.html @@ -32,7 +32,7 @@ "access_token": accessToken } MS2_PLUGINS = window.squashMS2PlugCfg(MS2_BASE_PLUGINS, MS2_MAP_PLUGINS, MS2_EDIT_PLUGINS); - MS2_PLUGINS = window.excludeMS2Plugins(MS2_PLUGINS, ["Save", "SaveAs","WidgetsBuilder","Widgets"]); + MS2_PLUGINS = window.excludeMS2Plugins(MS2_PLUGINS, ["Save", "SaveAs","WidgetsBuilder","Widgets", "Swipe", "Locate"]); MS2_PLUGINS["mobile"] = MS2_PLUGINS.desktop; let localConfig = defaultConfig.localConfig; initMapstore2Api('edit', function(MapStore2, options) { diff --git a/geonode_mapstore_client/templates/geonode-mapstore-client/layer_style_edit.html b/geonode_mapstore_client/templates/geonode-mapstore-client/layer_style_edit.html index 91163f38fb..ab25929c6f 100644 --- a/geonode_mapstore_client/templates/geonode-mapstore-client/layer_style_edit.html +++ b/geonode_mapstore_client/templates/geonode-mapstore-client/layer_style_edit.html @@ -46,7 +46,7 @@ } } MS2_PLUGINS.desktop.push(stylerCfg); - MS2_PLUGINS = window.excludeMS2Plugins(MS2_PLUGINS, ["Save", "SaveAs", "Widgets", "WidgetsBuilder"]); + MS2_PLUGINS = window.excludeMS2Plugins(MS2_PLUGINS, ["Save", "SaveAs", "Widgets", "WidgetsBuilder", "Swipe", "Locate"]); MS2_PLUGINS["mobile"] = MS2_PLUGINS.desktop; let localConfig = defaultConfig.localConfig; initMapstore2Api('edit', function(MapStore2, options) { diff --git a/geonode_mapstore_client/templates/geonode-mapstore-client/layer_view.html b/geonode_mapstore_client/templates/geonode-mapstore-client/layer_view.html index 182d5e1546..1f7d12a034 100644 --- a/geonode_mapstore_client/templates/geonode-mapstore-client/layer_view.html +++ b/geonode_mapstore_client/templates/geonode-mapstore-client/layer_view.html @@ -46,7 +46,7 @@ } } MS2_PLUGINS.desktop.push(stylerCfg); - MS2_PLUGINS = window.excludeMS2Plugins(MS2_PLUGINS, ["Save", "SaveAs", "Widgets", "WidgetsBuilder"]); + MS2_PLUGINS = window.excludeMS2Plugins(MS2_PLUGINS, ["Save", "SaveAs", "Widgets", "WidgetsBuilder", "Swipe", "Locate"]); MS2_PLUGINS["mobile"] = MS2_PLUGINS.desktop; let localConfig = defaultConfig.localConfig; initMapstore2Api('edit', function(MapStore2, options) { diff --git a/package.json b/package.json new file mode 100644 index 0000000000..4c2c74eefe --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "geonode-mapstore-client", + "version": "1.0.0", + "description": "", + "scripts": {}, + "author": "GeoSolutions", + "license": "BSD-2-Clause", + "devDependencies": {}, + "dependencies": { + "mapstore": "git+https://github.com/geosolutions-it/MapStore2.git#3cac29f044649a1ab3da576bacdb20951ae6635e" + } +} \ No newline at end of file