Skip to content

Commit

Permalink
add missing files of spa homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
allyoucanmap committed Dec 3, 2020
1 parent be6c15d commit bea1848
Show file tree
Hide file tree
Showing 156 changed files with 13,153 additions and 685 deletions.
2 changes: 1 addition & 1 deletion geonode_mapstore_client/client/MapStore2
Submodule MapStore2 updated 35 files
+39 −1 docs/developer-guide/internationalization.md
+44 −0 web/client/actions/__tests__/details-test.js
+0 −43 web/client/actions/__tests__/maps-test.js
+53 −0 web/client/actions/details.js
+0 −115 web/client/actions/maps.js
+1 −2 web/client/components/app/StandardApp.jsx
+41 −0 web/client/components/app/__tests__/withExtensions-test.jsx
+14 −5 web/client/components/app/withExtensions.js
+12 −1 web/client/components/map/cesium/Map.jsx
+4 −2 web/client/components/map/cesium/__tests__/Map-test-chrome.jsx
+2 −1 web/client/components/mapcontrols/annotations/AnnotationsEditor.jsx
+7 −3 web/client/components/mapcontrols/annotations/FeaturesList.jsx
+49 −0 web/client/components/mapcontrols/annotations/__tests__/FeatureList-test.js
+220 −0 web/client/epics/__tests__/details-test.js
+12 −12 web/client/epics/__tests__/layerinfo-test.js
+1 −178 web/client/epics/__tests__/maps-test.js
+0 −18 web/client/epics/__tests__/swipe-test.js
+92 −0 web/client/epics/details.js
+1 −1 web/client/epics/layerinfo.js
+6 −74 web/client/epics/maps.js
+1 −3 web/client/epics/swipe.js
+1 −1 web/client/localConfig.json
+25 −10 web/client/plugins/Details.jsx
+2 −4 web/client/plugins/Maps.jsx
+2 −4 web/client/plugins/maps/MapsGrid.jsx
+1 −0 web/client/product/apiPlugins.js
+2 −1 web/client/reducers/__tests__/config-test.js
+1 −7 web/client/reducers/__tests__/maps-test.js
+2 −1 web/client/reducers/config.js
+23 −0 web/client/reducers/details.js
+1 −9 web/client/reducers/maps.js
+9 −0 web/client/selectors/details.js
+19 −16 web/client/themes/default/less/modal.less
+4 −4 web/client/utils/EditorUtils.js
+67 −0 web/client/utils/__tests__/EditorUtils-test.js
93 changes: 93 additions & 0 deletions geonode_mapstore_client/client/js/actions/gnsearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* 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 FETCH_SUGGESTIONS = 'GEONODE_SEARCH:FETCH_SUGGESTIONS';
export const UPDATE_SUGGESTIONS = 'GEONODE_SEARCH:UPDATE_SUGGESTIONS';
export const LOADING_SUGGESTIONS = 'GEONODE_SEARCH:LOADING_SUGGESTIONS';
export const SEARCH_RESOURCES = 'GEONODE_SEARCH:SEARCH_RESOURCES';
export const UPDATE_RESOURCES = 'GEONODE_SEARCH:UPDATE_RESOURCES';
export const LOADING_RESOURCES = 'GEONODE_SEARCH:LOADING_RESOURCES';
export const SELECT_RESOURCE = 'GEONODE_SEARCH:SELECT_RESOURCE';
export const REQUEST_RESOURCE = 'GEONODE_SEARCH:REQUEST_RESOURCE';
export const UPDATE_RESOURCES_METADATA = 'GEONODE_SEARCH:UPDATE_RESOURCES_METADATA';

export function fetchSuggestions(text) {
return {
type: FETCH_SUGGESTIONS,
text
};
}

export function updateSuggestions(suggestions) {
return {
type: UPDATE_SUGGESTIONS,
suggestions
};
}

export function loadingSuggestions(loading) {
return {
type: LOADING_SUGGESTIONS,
loading
};
}

export function searchResources(params, pathname) {
return {
type: SEARCH_RESOURCES,
params,
pathname
};
}

export function updateResources(resources, reset) {
return {
type: UPDATE_RESOURCES,
resources,
reset
};
}

export function updateResourcesMetadata(metadata) {
return {
type: UPDATE_RESOURCES_METADATA,
metadata
};
}

export function loadingResources(loading) {
return {
type: LOADING_RESOURCES,
loading
};
}

export function requestResource(pk, ctype) {
return {
type: REQUEST_RESOURCE,
pk,
ctype
};
}

export default {
FETCH_SUGGESTIONS,
fetchSuggestions,
UPDATE_SUGGESTIONS,
updateSuggestions,
LOADING_SUGGESTIONS,
loadingSuggestions,
SEARCH_RESOURCES,
searchResources,
UPDATE_RESOURCES,
updateResources,
LOADING_RESOURCES,
loadingResources,
REQUEST_RESOURCE,
requestResource
};
111 changes: 93 additions & 18 deletions geonode_mapstore_client/client/js/api/geonode/v1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

import axios from '@mapstore/framework/libs/ajax';
import { getConfigProp } from '@mapstore/framework/utils/ConfigUtils';

import cookies from 'js-cookie';
import { setFilterById } from '@js/utils/GNSearchUtils';
/**
* Api for GeoNode v1
* @name api.geonode.v1
Expand Down Expand Up @@ -51,66 +52,140 @@ export const getUserInfo = () => {
.then(({ data }) => data);
};

export const getCategories = ({ q, ...params }) => {
export const getCategories = ({ q, idIn, ...params }, filterKey = 'categories') => {
const { endpointV1 = '/api' } = getConfigProp('geoNodeApi') || {};
return axios.get(`${endpointV1}/categories`, {
const queryIn = idIn
? idIn.reduce((query, value, idx) => query + (idx === 0 ? '?' : '&') + 'identifier__in=' + value, '')
: '';
return axios.get(`${endpointV1}/categories${queryIn}`, {
params: {
limit: 30,
...params,
identifier__icontains: q
...(q && { identifier__icontains: q })
}
})
.then(({ data }) => {
return data?.objects || [];
const results = (data?.objects || [])
.map((result) => {
const selectOption = {
value: result.identifier,
label: result.gn_description || result.gn_description_en
};
const category = {
...result,
selectOption
};
setFilterById(filterKey + result.identifier, category);
return category;
});
return results;
});
};

export const getKeywords = ({ q, ...params }) => {
export const getKeywords = ({ q, idIn, ...params }, filterKey = 'keywords') => {
const { endpointV1 = '/api' } = getConfigProp('geoNodeApi') || {};
return axios.get(`${endpointV1}/keywords`, {
const queryIn = idIn
? idIn.reduce((query, value, idx) => query + (idx === 0 ? '?' : '&') + 'slug__in=' + value, '')
: '';
return axios.get(`${endpointV1}/keywords${queryIn}`, {
params: {
limit: 30,
...params,
slug__icontains: q
...(q && { slug__icontains: q })
}
})
.then(({ data }) => {
return data?.objects || [];
const results = (data?.objects || [])
.map((result) => {
const selectOption = {
value: result.slug,
label: result.slug
};
const keyword = {
...result,
selectOption
};
setFilterById(filterKey + result.slug, keyword);
return keyword;
});
return results;
});
};

export const getRegions = ({ q, ...params }) => {
export const getRegions = ({ q, idIn, ...params }, filterKey = 'regions') => {
const { endpointV1 = '/api' } = getConfigProp('geoNodeApi') || {};
return axios.get(`${endpointV1}/regions`, {
const queryIn = idIn
? idIn.reduce((query, value, idx) => query + (idx === 0 ? '?' : '&') + 'name__in=' + value, '')
: '';
return axios.get(`${endpointV1}/regions${queryIn}`, {
params: {
limit: 30,
...params,
name__icontains: q
...(q && { name__icontains: q })
}
})
.then(({ data }) => {
return data?.objects || [];
const results = (data?.objects || [])
.map((result) => {
const selectOption = {
value: result.name,
label: result.name
};
const region = {
...result,
selectOption
};
setFilterById(filterKey + result.name, region);
return region;
});
return results;
});
};

export const getOwners = ({ q, ...params }) => {
export const getOwners = ({ q, idIn, ...params }, filterKey = 'owners') => {
const { endpointV1 = '/api' } = getConfigProp('geoNodeApi') || {};
return axios.get(`${endpointV1}/owners`, {
const queryIn = idIn
? idIn.reduce((query, value, idx) => query + (idx === 0 ? '?' : '&') + 'username__in=' + value, '')
: '';
return axios.get(`${endpointV1}/owners${queryIn}`, {
params: {
limit: 30,
...params,
username__icontains: q
...(q && { username__icontains: q })
}
})
.then(({ data }) => {
return data?.objects || [];
const results = (data?.objects || [])
.map((result) => {
const selectOption = {
value: result.username,
label: result.username
};
const owner = {
...result,
selectOption
};
setFilterById(filterKey + result.username, owner);
return owner;
});
return results;
});
};

export const setLanguage = (languageCode) => {
const csrfMiddlewareToken = cookies.get('csrftoken');
return axios.post('/i18n/setlang/', `csrfmiddlewaretoken=${csrfMiddlewareToken}&language=${languageCode}`, {
params: {
next: '/static/mapstore/configs/placeholder.json'
}
});
};

export default {
getResourceByPk,
getCategories,
getKeywords,
getRegions,
getOwners
getOwners,
setLanguage
};
Loading

0 comments on commit bea1848

Please sign in to comment.