Skip to content

Commit

Permalink
Fixed examples and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
offtherailz committed Aug 4, 2017
1 parent 18adb04 commit 3b3338e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
19 changes: 19 additions & 0 deletions web/client/examples/featuregrid/localConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,31 @@
"cfg": {
"tools": ["draw", "highlight"]
}
},{
"name": "QueryPanel",
"cfg": {
"activateQueryTool": true,
"spatialOperations": [
{"id": "INTERSECTS", "name": "queryform.spatialfilter.operations.intersects"},
{"id": "BBOX", "name": "queryform.spatialfilter.operations.bbox"},
{"id": "CONTAINS", "name": "queryform.spatialfilter.operations.contains"},
{"id": "WITHIN", "name": "queryform.spatialfilter.operations.within"}
],
"spatialMethodOptions": [
{"id": "Viewport", "name": "queryform.spatialfilter.methods.viewport"},
{"id": "BBOX", "name": "queryform.spatialfilter.methods.box"},
{"id": "Circle", "name": "queryform.spatialfilter.methods.circle"},
{"id": "Polygon", "name": "queryform.spatialfilter.methods.poly"}
]
}

},
"FeatureEditor",
"WFSDownload",
"LayerSelector",
"Notifications"
],

"mobile": [
{
"cfg": {
Expand Down
1 change: 1 addition & 0 deletions web/client/examples/featuregrid/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
MapPlugin: require('../../plugins/Map'),
WFSDownload: require('../../plugins/WFSDownload'),
FeatureEditor: require('../../plugins/FeatureEditor'),
QueryPanel: require('../../plugins/QueryPanel'),
Notifications: require('../../plugins/Notifications')
},
requires: {
Expand Down
30 changes: 9 additions & 21 deletions web/client/examples/featuregrid/stores/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
const Rx = require('rxjs');
const {featureTypeSelectedEpic, wfsQueryEpic, viewportSelectedEpic} = require('../../../epics/wfsquery');
const {getLayerFromId} = require('../../../selectors/layers');
const {createQuery, featureTypeSelected, layerSelectedForSearch, LAYER_SELECTED_FOR_SEARCH, FEATURE_TYPE_LOADED, CLOSE_FEATURE_GRID} = require('../../../actions/wfsquery');
const {featureTypeSelected, layerSelectedForSearch, LAYER_SELECTED_FOR_SEARCH, CLOSE_FEATURE_GRID} = require('../../../actions/wfsquery');
const {browseData} = require('../../../actions/layers');
const {clearChanges, setPermission, toggleTool} = require('../../../actions/featuregrid');
const {hasChangesSelector, hasNewFeaturesSelector} = require('../../../selectors/featuregrid');
module.exports = (plugins) => {
Expand Down Expand Up @@ -42,26 +43,13 @@ module.exports = (plugins) => {
);
}),
createFeatureGridDemoQuery: (action$, store) =>
Rx.Observable.zip(
action$.ofType(LAYER_SELECTED_FOR_SEARCH),
action$.ofType(FEATURE_TYPE_LOADED)
).switchMap(([layer]) => Rx.Observable.of(
clearChanges(),
createQuery("http://demo.geo-solutions.it:80/geoserver/wfs", {
featureTypeName: getLayerFromId(store.getState(), layer.id).name,
groupFields: [

],
filterFields: [],
pagination: {
maxFeatures: 20,
startIndex: 0
},
filterType: 'OGC',
ogcVersion: '1.1.0',
sortOptions: null,
hits: false
})
action$.ofType(LAYER_SELECTED_FOR_SEARCH)
.switchMap((layer) => Rx.Observable.of(
clearChanges(),
browseData({
...getLayerFromId(store.getState(), layer.id),
url: 'http://demo.geo-solutions.it:80/geoserver/wfs'
})
))
}, plugins);
};
12 changes: 2 additions & 10 deletions web/client/reducers/__tests__/featuregrid-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const featuregrid = require('../featuregrid');
const {setFeatures, dockSizeFeatures, setLayer, toggleTool, customizeAttribute, selectFeatures, deselectFeatures, createNewFeatures,
featureSaving, toggleSelection, clearSelection, MODES, toggleEditMode, toggleViewMode, saveSuccess, clearChanges, saveError, startDrawingFeature,
deleteGeometryFeature, geometryChanged, setSelectionOptions, changePage, featureModified, setPermission, disableToolbar} = require('../../actions/featuregrid');
const {featureTypeLoaded, closeFeatureGrid} = require('../../actions/wfsquery');
const {featureTypeLoaded} = require('../../actions/wfsquery');
const {changeDrawingStatus} = require('../../actions/draw');

const museam = require('json-loader!../../test-resources/wfs/museam.json');
Expand Down Expand Up @@ -219,15 +219,7 @@ describe('Test the featuregrid reducer', () => {
let state = featuregrid( {}, setPermission({canEdit: true}));
expect(state.canEdit).toBe(true);
});
it('closeFeatureGrid', () => {
let state = featuregrid( {pagination: {size: 3}}, closeFeatureGrid());
expect(state.drawing).toBe(false);
expect(state.deleteConfirm).toBe(false);
expect(state.pagination.size).toBe(3);
expect(state.newFeatures.length).toBe(0);
expect(state.changes.length).toBe(0);
expect(state.select.length).toBe(0);
});

it('CHANGE_DRAWING_STATUS', () => {
let state = featuregrid( {}, changeDrawingStatus("clean"));
expect(state.drawing).toBe(false);
Expand Down
2 changes: 1 addition & 1 deletion web/client/selectors/__tests__/featuregrid-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ let initialState = {
}
},
resultError: null,
open: true,
isNew: false,
filterObj: {
featureTypeName: 'editing:polygons',
Expand Down Expand Up @@ -304,6 +303,7 @@ describe('Test featuregrid selectors', () => {
afterEach(() => {
initialState = assign({}, initialState, {
featuregrid: {
open: true,
saving: false,
saved: false,
selectedLayer: "TEST_LAYER",
Expand Down

0 comments on commit 3b3338e

Please sign in to comment.