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

MS submodule upgrade + upgrade of axios #1737

Merged
merged 8 commits into from
Apr 24, 2024
2 changes: 1 addition & 1 deletion geonode_mapstore_client/client/MapStore2
Submodule MapStore2 updated 114 files
28 changes: 14 additions & 14 deletions geonode_mapstore_client/client/js/api/geonode/v2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const getResources = ({
};
return axios.get(parseDevHostname(endpoints[RESOURCES]), {
params: _params,
paramsSerializer
...paramsSerializer()
})
.then(({ data }) => {
return {
Expand Down Expand Up @@ -182,7 +182,7 @@ export const getMaps = ({
page_size: pageSize,
api_preset: API_PRESET.MAPS
},
paramsSerializer
...paramsSerializer()
})
.then(({ data }) => {
return {
Expand Down Expand Up @@ -218,7 +218,7 @@ export const getDatasets = ({
page_size: pageSize,
api_preset: API_PRESET.DATASETS
},
paramsSerializer
...paramsSerializer()
})
.then(({ data }) => {
return {
Expand Down Expand Up @@ -255,7 +255,7 @@ export const getDocumentsByDocType = (docType = 'image', {
page_size: pageSize,
api_preset: API_PRESET.DOCUMENTS
},
paramsSerializer
...paramsSerializer()
})
.then(({ data }) => {
return {
Expand Down Expand Up @@ -337,7 +337,7 @@ export const getDatasetByPk = (pk) => {
params: {
api_preset: [API_PRESET.VIEWER_COMMON, API_PRESET.DATASET]
},
paramsSerializer
...paramsSerializer()
})
.then(({ data }) => data.dataset);
};
Expand All @@ -347,7 +347,7 @@ export const getDocumentByPk = (pk) => {
params: {
api_preset: [API_PRESET.VIEWER_COMMON, API_PRESET.DOCUMENT]
},
paramsSerializer
...paramsSerializer()
})
.then(({ data }) => data.document);
};
Expand All @@ -360,7 +360,7 @@ export const getDocumentsByPk = (pk) => {
page_size: pks.length,
api_preset: [API_PRESET.VIEWER_COMMON, API_PRESET.DOCUMENT]
},
paramsSerializer
...paramsSerializer()
})
.then(({ data }) => data.documents);
};
Expand Down Expand Up @@ -406,7 +406,7 @@ export const getGeoApps = ({
page,
page_size: pageSize
},
paramsSerializer
...paramsSerializer()
})
.then(({ data }) => {
return {
Expand Down Expand Up @@ -458,7 +458,7 @@ export const getUsers = ({
page,
page_size: pageSize
},
paramsSerializer
...paramsSerializer()
})
.then(({ data }) => {
return {
Expand Down Expand Up @@ -487,7 +487,7 @@ export const getGroups = ({
page,
page_size: pageSize
},
paramsSerializer
...paramsSerializer()
})
.then(({ data }) => {
return {
Expand Down Expand Up @@ -661,7 +661,7 @@ export const getMapByPk = (pk) => {
params: {
api_preset: [API_PRESET.VIEWER_COMMON, API_PRESET.MAP]
},
paramsSerializer
...paramsSerializer()
})
.then(({ data }) => data?.map);
};
Expand All @@ -675,7 +675,7 @@ export const getMapsByPk = (pk) => {
page_size: pks.length,
api_preset: API_PRESET.MAPS
},
paramsSerializer
...paramsSerializer()
})
.then(({ data }) => data?.maps);
};
Expand Down Expand Up @@ -839,7 +839,7 @@ export const getFacetItemsByFacetName = ({ name: facetName, style, filterKey, fi
return axios.get(`${parseDevHostname(endpoints[FACETS])}/${facetName}`,
{ ...config,
params: updatedParams,
paramsSerializer
...paramsSerializer()
}
).then(({data}) => {
const {page: _page = 0, items: _items = [], total, page_size: size} = data?.topics ?? {};
Expand Down Expand Up @@ -890,7 +890,7 @@ export const getFacetItemsByFacetName = ({ name: facetName, style, filterKey, fi

export const getFacetsByKey = (facet, filterParams) => {
return axios
.get(parseDevHostname(endpoints[FACETS] + `/${facet}`), {params: {...filterParams}, paramsSerializer})
.get(parseDevHostname(endpoints[FACETS] + `/${facet}`), {params: {...filterParams}, ...paramsSerializer()})
.then(({ data } = {}) => ({
...data?.topics,
items: data?.topics?.items?.map(item => ({...item, facetName: facet}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import InfoPopover from '@mapstore/framework/components/widgets/widget/InfoPopov
import { getSupportedFormat } from '@mapstore/framework/api/WMS';
import { getConfigProp } from '@mapstore/framework/utils/ConfigUtils';
import LegendImage from '@mapstore/framework/plugins/TOC/components/Legend';
import { DEFAULT_SUPPORTED_GET_MAP_FORMAT } from '@mapstore/framework/utils/WMSUtils';
import Select from 'react-select';
import GeneralSettings from '@js/plugins/layersettings/GeneralSettings';
import VisibilitySettings from '@js/plugins/layersettings/VisibilitySettings';
Expand Down Expand Up @@ -215,8 +216,8 @@ function WMSLayerSettings({
isLoading={!!formatLoading}
options={formatLoading
? []
: (formats?.map((value) => ({ value, label: value }))
|| imageFormats)}
: (formats ?? imageFormats ?? DEFAULT_SUPPORTED_GET_MAP_FORMAT).map((_format) => _format?.value ? _format : ({ value: _format, label: _format }))
}
value={format}
onChange={({ value }) => onChange({ format: value })}/>
<Button
Expand Down
26 changes: 16 additions & 10 deletions geonode_mapstore_client/client/js/utils/APIUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,22 @@ export const getApiToken = () => {
* @param {Object} params
* @returns {Object} updated params
*/
export const paramsSerializer = (params) => {
const {include, exclude, sort, ...rest} = params ?? {}; // Update bracket params (if any)
let queryParams = '';
if (!isEmpty(include) || !isEmpty(exclude) || !isEmpty(sort)) {
queryParams = queryString.stringify({include, exclude, sort}, { arrayFormat: 'bracket'});
}
if (!isEmpty(rest)) {
queryParams = (isEmpty(queryParams) ? '' : `${queryParams}&`) + queryString.stringify(rest);
}
return queryParams;
export const paramsSerializer = () => {
return {
paramsSerializer: {
serialize: params => {
const {include, exclude, sort, ...rest} = params ?? {}; // Update bracket params (if any)
let queryParams = '';
if (!isEmpty(include) || !isEmpty(exclude) || !isEmpty(sort)) {
queryParams = queryString.stringify({include, exclude, sort}, { arrayFormat: 'bracket'});
}
if (!isEmpty(rest)) {
queryParams = (isEmpty(queryParams) ? '' : `${queryParams}&`) + queryString.stringify(rest);
}
return queryParams;
}
}
};
};

export const API_PRESET = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ div#mapstore-globalspinner {
}
}
}
.map-widget-view {
.map-widget-view, .chart-widget-view {
.widget-icons, .widget-title {
.em(margin-bottom, 6);
}
Expand Down