Skip to content

Commit

Permalink
geosolutions-it#8529 maxItems is now used from Identify plugin (geoso…
Browse files Browse the repository at this point in the history
…lutions-it#8539)

* geosolutions-it#8529 maxItems is now used from Identify plugin

* removed test value for maxItems in cfg of Identify plugin
  • Loading branch information
MV88 authored and Alessandro Cristofori committed Sep 28, 2022
1 parent f687968 commit 99f587b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
8 changes: 7 additions & 1 deletion web/client/components/data/identify/enhancers/identify.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const identifyLifecycle = compose(
const {
enabled,
showInMapPopup,
maxItems,
changeMousePointer = () => {},
disableCenterToMarker,
enableInfoForSelectedLayers = true,
Expand All @@ -80,7 +81,12 @@ export const identifyLifecycle = compose(
} = this.props;

// Initialize plugin configuration
onInitPlugin({enableInfoForSelectedLayers});
onInitPlugin({
enableInfoForSelectedLayers,
configuration: {
maxItems
}
});

if (enabled || showInMapPopup) {
changeMousePointer('pointer');
Expand Down
1 change: 1 addition & 0 deletions web/client/plugins/Identify.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ const identifyDefaultProps = defaultProps({
* @prop cfg.disableCenterToMarker {bool} disable zoom to marker action
* @prop cfg.zIndex {number} component z index order
* @prop cfg.showInMapPopup {boolean} if true show the identify as popup
* @prop cfg.maxItems {number} the number of features returned by this tool
* @prop cfg.showMoreInfo {boolean} if true shows the more info icon which allow user to show/hide Geocode viewer as popup (true by default)
* @prop cfg.showEdit {boolean} if true, and when the FeatureEditor plugin is present, shows and edit button to edit the current feature(s) clicked in the grid.
* @prop cfg.enableInfoForSelectedLayers {boolean} if true, if some layer is selected in the TOC, the feature info is performed only on the selected ones. if false, the info is queried for all the layers, independently from selection. (default is true).
Expand Down
5 changes: 3 additions & 2 deletions web/client/reducers/__tests__/mapInfo-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,8 @@ describe('Test the mapInfo reducer', () => {
});
it('onInitPlugin', () => {
const initialState = { configuration: {} };
const state = mapInfo(initialState, onInitPlugin({cfg1: "test"}));
expect(state.cfg1).toBe("test");
const state = mapInfo(initialState, onInitPlugin({cfg1: "test", configuration: {maxItems: 3}}));
expect(state.cfg1).toEqual("test");
expect(state.configuration).toEqual({maxItems: 3});
});
});
9 changes: 8 additions & 1 deletion web/client/reducers/mapInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,14 @@ function mapInfo(state = initState, action) {
return state;
}
case INIT_PLUGIN: {
return { ...state, ...action.cfg };
return {
...state,
...action.cfg,
configuration: {
...state.configuration,
...(action.cfg?.configuration)
}
};
}
default:
return state;
Expand Down

0 comments on commit 99f587b

Please sign in to comment.