diff --git a/geonode_mapstore_client/client/js/api/geonode/config/index.js b/geonode_mapstore_client/client/js/api/geonode/config/index.js
index 4fd293ba16..b2957e93c7 100644
--- a/geonode_mapstore_client/client/js/api/geonode/config/index.js
+++ b/geonode_mapstore_client/client/js/api/geonode/config/index.js
@@ -8,17 +8,17 @@
import axios from '@mapstore/framework/libs/ajax';
-export const getBaseMapConfiguration = (baseMapUrl = '/static/mapstore/configs/map.json') => {
- return axios.get(baseMapUrl)
- .then(({ data }) => data);
+export const getNewMapConfiguration = (newMapUrl = '/static/mapstore/configs/map.json') => {
+ return axios.get(newMapUrl)
+ .then(({ data }) => window.overrideNewMapConfig ? window.overrideNewMapConfig(data) : data);
};
-export const getNewGeoStoryConfig = () => {
- return axios.get('/static/mapstore/configs/geostory.json').then(({ data }) => data);
+export const getNewGeoStoryConfig = (newGeoStoryUrl = '/static/mapstore/configs/geostory.json') => {
+ return axios.get(newGeoStoryUrl)
+ .then(({ data }) => window.overrideNewGeoStoryConfig ? window.overrideNewGeoStoryConfig(data) : data);
};
export default {
- getBaseMapConfiguration,
+ getNewMapConfiguration,
getNewGeoStoryConfig
};
-
diff --git a/geonode_mapstore_client/client/js/components/FiltersForm/__tests__/FiltersForm-test.jsx b/geonode_mapstore_client/client/js/components/FiltersForm/__tests__/FiltersForm-test.jsx
index 4b1fde1614..8a8c807e58 100644
--- a/geonode_mapstore_client/client/js/components/FiltersForm/__tests__/FiltersForm-test.jsx
+++ b/geonode_mapstore_client/client/js/components/FiltersForm/__tests__/FiltersForm-test.jsx
@@ -44,8 +44,8 @@ describe('FiltersForm component', () => {
const applyButton = footerButtons[0];
Simulate.click(applyButton);
});
- it('should trigger on change after clicking on clear', (done) => {
- const onChange = (values) => {
+ it('should trigger on clear', (done) => {
+ const onClear = (values) => {
try {
expect(values).toBeTruthy();
done();
@@ -53,7 +53,7 @@ describe('FiltersForm component', () => {
done(e);
}
};
- ReactDOM.render( , document.getElementById("container"));
+ ReactDOM.render( , document.getElementById("container"));
const filterFormNode = document.querySelector('.gn-filter-form');
expect(filterFormNode).toBeTruthy();
const footerButtons = filterFormNode.querySelectorAll('.gn-filter-form-footer > button');
diff --git a/geonode_mapstore_client/client/js/epics/__tests__/gnviewer-test.js b/geonode_mapstore_client/client/js/epics/__tests__/gnviewer-test.js
index c58dd70951..26dacca6c9 100644
--- a/geonode_mapstore_client/client/js/epics/__tests__/gnviewer-test.js
+++ b/geonode_mapstore_client/client/js/epics/__tests__/gnviewer-test.js
@@ -103,14 +103,18 @@ describe("gnviewer epics", () => {
it("should call mapConfig", (done) => {
mockAxios.onGet().reply(() => [200, {}]);
- const NUM_ACTIONS = 1;
+ const NUM_ACTIONS = 3;
testEpic(
gnViewerRequestNewMapConfig,
NUM_ACTIONS,
requestNewMapConfig(),
(actions) => {
try {
- expect(actions.map(({ type }) => type)).toEqual(["MAP_CONFIG_LOADED"]);
+ expect(actions.map(({ type }) => type)).toEqual([
+ "GEONODE:SET_NEW_RESOURCE",
+ "MAP_CONFIG_LOADED",
+ "GEONODE:SET_RESOURCE_TYPE"
+ ]);
done();
} catch (error) {
done(error);
diff --git a/geonode_mapstore_client/client/js/epics/gnviewer.js b/geonode_mapstore_client/client/js/epics/gnviewer.js
index 42b7364bac..c8d9713437 100644
--- a/geonode_mapstore_client/client/js/epics/gnviewer.js
+++ b/geonode_mapstore_client/client/js/epics/gnviewer.js
@@ -17,7 +17,7 @@ import {
REQUEST_NEW_GEOSTORY_CONFIG,
REQUEST_NEW_MAP_CONFIG
} from '@js/actions/gnviewer';
-import { getBaseMapConfiguration, getNewGeoStoryConfig } from '@js/api/geonode/config';
+import { getNewMapConfiguration, getNewGeoStoryConfig } from '@js/api/geonode/config';
import {
getLayerByPk,
getGeoStoryByPk,
@@ -54,7 +54,7 @@ export const gnViewerRequestLayerConfig = (action$) =>
action$.ofType(REQUEST_LAYER_CONFIG)
.switchMap(({ pk, page }) => {
return Observable.defer(() => axios.all([
- getBaseMapConfiguration(),
+ getNewMapConfiguration(),
getLayerByPk(pk)
])).switchMap((response) => {
const [mapConfig, gnLayer] = response;
@@ -121,7 +121,7 @@ export const gnViewerRequestMapConfig = (action$) =>
export const gnViewerRequestNewMapConfig = (action$) =>
action$.ofType(REQUEST_NEW_MAP_CONFIG)
.switchMap(() => {
- return Observable.defer(getBaseMapConfiguration
+ return Observable.defer(getNewMapConfiguration
).switchMap((response) => {
return Observable.of(
configureMap(response),
diff --git a/geonode_mapstore_client/client/js/reducers/__tests__/gnresource-test.js b/geonode_mapstore_client/client/js/reducers/__tests__/gnresource-test.js
index 077cd1eaeb..8fd33abbd6 100644
--- a/geonode_mapstore_client/client/js/reducers/__tests__/gnresource-test.js
+++ b/geonode_mapstore_client/client/js/reducers/__tests__/gnresource-test.js
@@ -36,6 +36,7 @@ describe('gnresource reducer', () => {
const state = gnresource({}, setResource(resource));
expect(state).toEqual({
error: null,
+ isNew: false,
data: resource,
loading: false
});
@@ -78,7 +79,8 @@ describe('gnresource reducer', () => {
it('should test setNewResource', () => {
const state = gnresource({}, setNewResource());
expect(state).toEqual({
- isNew: true
+ isNew: true,
+ data: {}
});
});
it('should test setResourceId', () => {
diff --git a/geonode_mapstore_client/client/static/mapstore/configs/map.json b/geonode_mapstore_client/client/static/mapstore/configs/map.json
index fbe717c659..80a1ed07cd 100644
--- a/geonode_mapstore_client/client/static/mapstore/configs/map.json
+++ b/geonode_mapstore_client/client/static/mapstore/configs/map.json
@@ -29,70 +29,6 @@
20037508.34,
20037508.34
],
- "layers": [
- {
- "type": "osm",
- "title": "Open Street Map",
- "name": "mapnik",
- "source": "osm",
- "group": "background",
- "visibility": true
- },
- {
- "type": "tileprovider",
- "title": "NASAGIBS Night 2012",
- "provider": "NASAGIBS.ViirsEarthAtNight2012",
- "name": "Night2012",
- "source": "nasagibs",
- "group": "background",
- "visibility": false
- },
- {
- "type": "tileprovider",
- "title": "OpenTopoMap",
- "provider": "OpenTopoMap",
- "name": "OpenTopoMap",
- "source": "OpenTopoMap",
- "group": "background",
- "visibility": false
- },
- {
- "format": "image/jpeg",
- "group": "background",
- "name": "s2cloudless:s2cloudless",
- "opacity": 1,
- "title": "Sentinel 2 Cloudless",
- "type": "wms",
- "url": [
- "https://maps1.geosolutionsgroup.com/geoserver/wms",
- "https://maps2.geosolutionsgroup.com/geoserver/wms",
- "https://maps3.geosolutionsgroup.com/geoserver/wms",
- "https://maps4.geosolutionsgroup.com/geoserver/wms",
- "https://maps5.geosolutionsgroup.com/geoserver/wms",
- "https://maps6.geosolutionsgroup.com/geoserver/wms"
- ],
- "source": "s2cloudless",
- "visibility": false,
- "singleTile": false,
- "credits": {
- "title": "Sentinel-2 cloudless 2016 by EOX IT Services GmbH"
- }
- },
- {
- "source": "ol",
- "group": "background",
- "title": "Empty Background",
- "fixed": true,
- "type": "empty",
- "name": "empty",
- "visibility": false,
- "args": [
- "Empty Background",
- {
- "visibility": false
- }
- ]
- }
- ]
+ "layers": []
}
-}
\ No newline at end of file
+}
diff --git a/geonode_mapstore_client/templates/geonode-mapstore-client/_geonode_config.html b/geonode_mapstore_client/templates/geonode-mapstore-client/_geonode_config.html
index 2b1655e0f5..edf61c1649 100644
--- a/geonode_mapstore_client/templates/geonode-mapstore-client/_geonode_config.html
+++ b/geonode_mapstore_client/templates/geonode-mapstore-client/_geonode_config.html
@@ -2,6 +2,9 @@
{% comment %}
app and map configuration need to be normalized
{% endcomment %}
+{{ MAP_BASELAYERS|json_script:"settings-MAP_BASELAYERS" }}
+{{ CATALOGUE_SERVICES|json_script:"settings-CATALOGUE_SERVICES" }}
+{{ CATALOGUE_SELECTED_SERVICE|json_script:"settings-CATALOGUE_SELECTED_SERVICE" }}