Skip to content

Commit

Permalink
Fix geosolutions-it#9050. Handle filters array on LOAD_FITLTER action (
Browse files Browse the repository at this point in the history
  • Loading branch information
offtherailz committed Mar 23, 2023
1 parent cf943ea commit 589c9ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions web/client/reducers/__tests__/queryform-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,14 @@ describe('Test the queryform reducer', () => {
}
}
},
filters: [{
format: "logic",
logic: "AND",
filters: [{
format: 'cql',
body: 'ATTRIBUTE1 = \'VALUE1\''
}]
}],
spatialField: {
method: "BBOX",
operation: "DWITHIN",
Expand All @@ -1059,6 +1067,7 @@ describe('Test the queryform reducer', () => {
expect(newState.crossLayerFilter.attribute).toBe("ATTRIBUTE1");
expect(newState.spatialField.attribute).toBe("GEOMETRY");
expect(newState.spatialField.method).toBe("BBOX");
expect(newState.filters).toEqual(newFilter.filters);
});
it('attribute property on load an undefied filter', () => {
const initialState = {
Expand Down
3 changes: 2 additions & 1 deletion web/client/reducers/queryform.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ function queryform(state = initialState, action) {
case LOAD_FILTER:
const {attribute, ...other} = initialState.spatialField;
const cleanInitialState = assign({}, initialState, {spatialField: {...other}});
const {spatialField, filterFields, groupFields, crossLayerFilter, attributePanelExpanded, spatialPanelExpanded, crossLayerExpanded} = (action.filter || cleanInitialState);
const {spatialField, filterFields, groupFields, crossLayerFilter, attributePanelExpanded, spatialPanelExpanded, crossLayerExpanded, filters} = (action.filter || cleanInitialState);
return {...state,
...{
attributePanelExpanded,
Expand All @@ -586,6 +586,7 @@ function queryform(state = initialState, action) {
attribute: spatialField && spatialField.attribute || state.spatialField && state.spatialField.attribute

},
filters: filters ?? [],
filterFields,
groupFields,
crossLayerFilter: {
Expand Down

0 comments on commit 589c9ec

Please sign in to comment.