Skip to content

Commit

Permalink
Fixes #1866: queryform example updated with epics and other related f… (
Browse files Browse the repository at this point in the history
#1877)

* Fixes #1866: queryform example updated with epics and other related fixes

* Removed unnecessary check
  • Loading branch information
mbarto authored May 26, 2017
1 parent e905160 commit e184b51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions web/client/epics/wfsquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ const viewportSelectedEpic = (action$, store) =>
action$.ofType(SELECT_VIEWPORT_SPATIAL_METHOD, CHANGE_MAP_VIEW)
.switchMap((action) => {
// calculate new geometry from map properties only for viewport
const map = action.type === CHANGE_MAP_VIEW ? action : store.getState().map.present;
const map = action.type === CHANGE_MAP_VIEW ? action : store.getState().map.present || store.getState().map;
if (action.type === SELECT_VIEWPORT_SPATIAL_METHOD ||
action.type === CHANGE_MAP_VIEW &&
store.getState().queryform &&
store.getState().queryform.spatialField &&
store.getState().queryform.spatialField.method === "viewport") {
store.getState().queryform.spatialField.method === "Viewport") {
const bounds = Object.keys(map.bbox.bounds).reduce((p, c) => {
return assign({}, p, {[c]: parseFloat(map.bbox.bounds[c])});
}, {});
Expand Down
2 changes: 2 additions & 0 deletions web/client/examples/queryform/components/SmartQueryForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const {
removeGroupField,
changeCascadingValue,
expandAttributeFilterPanel,
selectViewportSpatialMethod,
expandSpatialFilterPanel,
selectSpatialMethod,
selectSpatialOperation,
Expand Down Expand Up @@ -94,6 +95,7 @@ const SmartQueryForm = connect((state) => {
onSelectSpatialMethod: selectSpatialMethod,
onSelectSpatialOperation: selectSpatialOperation,
onChangeDrawingStatus: changeDrawingStatus,
onSelectViewportSpatialMethod: selectViewportSpatialMethod,
onRemoveSpatialSelection: removeSpatialSelection,
onShowSpatialSelectionDetails: showSpatialSelectionDetails,
onEndDrawing: endDrawing,
Expand Down
7 changes: 6 additions & 1 deletion web/client/examples/queryform/stores/queryformstore.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
var DebugUtils = require('../../../utils/DebugUtils');

const {combineReducers} = require('redux');
const {createEpicMiddleware, combineEpics} = require('redux-observable');
const {viewportSelectedEpic} = require('../../../epics/wfsquery');

// STATE_FIPS SUB_REGION STATE_ABBR LAND_KM WATER_KM PERSONS FAMILIES HOUSHOLD MALE FEMALE WORKERS DRVALONE CARPOOL PUBTRANS EMPLOYED UNEMPLOY SERVICE MANUAL P_MALE P_FEMALE SAMP_POP

Expand Down Expand Up @@ -69,5 +71,8 @@ const reducers = combineReducers({
query: require('../reducers/query')
});

const rootEpic = combineEpics(viewportSelectedEpic);
const epicMiddleware = createEpicMiddleware(rootEpic);

// export the store with the given reducers
module.exports = DebugUtils.createDebugStore(reducers, {queryform: initialState});
module.exports = DebugUtils.createDebugStore(reducers, {queryform: initialState}, [epicMiddleware]);

0 comments on commit e184b51

Please sign in to comment.