Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1866: queryform example updated with epics and other related f… #1877

Merged
merged 2 commits into from
May 26, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/client/components/data/query/QueryToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const QueryToolbar = React.createClass({
// fieldsWithoutValues ||
fieldsExceptions ||
!this.props.toolbarEnabled ||
(!fieldsWithValues && !this.props.spatialField.geometry);
(!fieldsWithValues && !this.props.spatialField.geometry && this.props.spatialField.method !== 'Viewport');
const tooltip = <Tooltip id="query-warning-tooltip"><I18N.Message msgId="queryform.emptyfilter"/></Tooltip>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this is not needed with the fix made to the epic.

const btn = (<Button disabled={queryDisabled} bsSize="xs" id="query-toolbar-query" onClick={this.search}>
<Glyphicon glyph="glyphicon glyphicon-search"/>
Expand Down
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]);