Skip to content

Commit

Permalink
add project extensibility, map swipe and locate plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
allyoucanmap committed Nov 11, 2020
1 parent a1313d8 commit 7f4ae17
Show file tree
Hide file tree
Showing 36 changed files with 228 additions and 767 deletions.
1 change: 0 additions & 1 deletion geonode_mapstore_client/client/.eslintignore

This file was deleted.

224 changes: 0 additions & 224 deletions geonode_mapstore_client/client/.eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions geonode_mapstore_client/client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ web/
dist/
module/
coverage/
package-lock.json
2 changes: 2 additions & 0 deletions geonode_mapstore_client/client/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MapStore2
module/
21 changes: 12 additions & 9 deletions geonode_mapstore_client/client/js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions geonode_mapstore_client/client/js/api/geonode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Loading

0 comments on commit 7f4ae17

Please sign in to comment.