Skip to content

Commit

Permalink
Fixed #2219 Zoom to page with features without geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 committed Nov 21, 2017
1 parent 3fe12ef commit d198d25
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
13 changes: 11 additions & 2 deletions web/client/selectors/__tests__/query-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,16 @@ const initialState = {
properties: {
name: 'vvvv'
}
},
{
type: 'Feature',
id: 'poligoni.8',
geometry: null,
geometry_name: 'geometry',
properties: {
name: 'no geom'
}
}
],
crs: {
type: 'name',
Expand Down Expand Up @@ -317,7 +326,7 @@ describe('Test query selectors', () => {
it('test resultsSelector selector', () => {
const res = resultsSelector(initialState);
expect(res).toExist();
expect(res.length).toBe(4);
expect(res.length).toBe(5);
});
it('test paginationInfo.startIndex selector', () => {
const startIndex = paginationInfo.startIndex(initialState);
Expand All @@ -329,7 +338,7 @@ describe('Test query selectors', () => {
});
it('test paginationInfo.resultSize selector', () => {
const featuresLength = paginationInfo.resultSize(initialState);
expect(featuresLength).toBe(4);
expect(featuresLength).toBe(5);
});
it('test paginationInfo.totalFeatures selector', () => {
const totalFeatures = paginationInfo.totalFeatures(initialState);
Expand Down
10 changes: 8 additions & 2 deletions web/client/selectors/query.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
const {get, head} = require('lodash');
const {isNil, get, head} = require('lodash');
module.exports = {
wfsURL: state => state && state.query && state.query.searchUrl,
wfsURLSelector: state => state && state.query && state.query.url,
wfsFilter: state => state && state.query && state.query.filterObj,
attributesSelector: state => get(state, `query.featureTypes.${get(state, "query.filterObj.featureTypeName")}.attributes`),
typeNameSelector: state => get(state, "query.typeName"),
resultsSelector: (state) => get(state, "query.result.features"),
featureCollectionResultSelector: state => get(state, "query.result"),
featureCollectionResultSelector: state => {
const results = get(state, "query.result");
return {
...results,
features: results.features.filter(f => !isNil(f.geometry))
};
},
getFeatureById: (state, id) => {
let features = state && state.query && state.query.result && state.query.result.features;
return head(features.filter(f => f.id === id));
Expand Down

0 comments on commit d198d25

Please sign in to comment.