-
Notifications
You must be signed in to change notification settings - Fork 416
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
Fix #1398 Improve query panel behaviour #1413
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ const QUERY_CREATE = 'QUERY_CREATE'; | |
const QUERY_RESULT = 'QUERY_RESULT'; | ||
const QUERY_ERROR = 'QUERY_ERROR'; | ||
const RESET_QUERY = 'RESET_QUERY'; | ||
const QUERY_DOCK_SIZE = 'QUERY_DOCK_SIZE'; | ||
|
||
const axios = require('../libs/ajax'); | ||
const {toggleControl, setControlProperty} = require('./controls'); | ||
|
@@ -74,6 +75,13 @@ function queryError(error) { | |
}; | ||
} | ||
|
||
function queryDockSize(dockSize) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we move this to another file? actions/featuregrid? |
||
return { | ||
type: QUERY_DOCK_SIZE, | ||
dockSize: dockSize | ||
}; | ||
} | ||
|
||
function describeFeatureType(baseUrl, typeName) { | ||
return (dispatch) => { | ||
return axios.get(baseUrl + '?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=' + typeName + '&outputFormat=application/json').then((response) => { | ||
|
@@ -174,12 +182,14 @@ module.exports = { | |
QUERY_RESULT, | ||
QUERY_ERROR, | ||
RESET_QUERY, | ||
QUERY_DOCK_SIZE, | ||
featureTypeSelected, | ||
describeFeatureType, | ||
loadFeature, | ||
createQuery, | ||
query, | ||
featureClose, | ||
resetQuery, | ||
toggleQueryPanel | ||
toggleQueryPanel, | ||
queryDockSize | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ const {Modal, Button, Glyphicon} = require('react-bootstrap'); | |
|
||
const FilterUtils = require('../../../utils/FilterUtils'); | ||
|
||
const {getWindowSize} = require('../../../utils/AgentUtils'); | ||
const FeatureGrid = connect((state) => { | ||
return { | ||
select: state.featuregrid && state.featuregrid.select || [], | ||
|
@@ -54,7 +53,10 @@ const DockedFeatureGrid = React.createClass({ | |
cleanError: React.PropTypes.func, | ||
selectAllToggle: React.PropTypes.func, | ||
zoomToFeatureAction: React.PropTypes.func, | ||
onClose: React.PropTypes.func | ||
onClose: React.PropTypes.func, | ||
onToggleDrawer: React.PropTypes.func, | ||
dockSize: React.PropTypes.number, | ||
setDockSize: React.PropTypes.func | ||
}, | ||
contextTypes: { | ||
messages: React.PropTypes.object | ||
|
@@ -90,13 +92,12 @@ const DockedFeatureGrid = React.createClass({ | |
selectFeatures: () => {}, | ||
onQuery: () => {}, | ||
cleanError: () => {}, | ||
selectAllToggle: () => {} | ||
selectAllToggle: () => {}, | ||
onToggleDrawer: () => {}, | ||
dockSize: 0.35, | ||
setDockSize: () => {} | ||
}; | ||
}, | ||
componentWillMount() { | ||
let height = getWindowSize().maxHeight - 108; | ||
this.setState({width: `calc( ${this.props.initWidth} - 30px)`, height}); | ||
}, | ||
shouldComponentUpdate(nextProps) { | ||
// this is mandatory to avoid infinite looping. TODO externalize pagination | ||
return Object.keys(this.props).reduce((prev, prop) => { | ||
|
@@ -224,10 +225,11 @@ const DockedFeatureGrid = React.createClass({ | |
<Dock | ||
zIndex={1030 /*below dialogs, above left menu*/} | ||
position={"bottom" /* 'left', 'top', 'right', 'bottom' */} | ||
size={this.state.size} | ||
size={this.props.dockSize} | ||
dimMode={"none" /*'transparent', 'none', 'opaque'*/} | ||
isVisible={true} | ||
onVisibleChange={this.handleVisibleChange} | ||
onSizeChange={(this.limitDockHeight)} | ||
fluid={true} | ||
dimStyle={{ background: 'rgba(0, 0, 100, 0.2)' }} | ||
dockStyle={null} | ||
|
@@ -247,7 +249,7 @@ const DockedFeatureGrid = React.createClass({ | |
}}> | ||
<FeatureGrid | ||
useIcons={true} | ||
tools={[<Button onClick={this.props.onClose} ><Glyphicon glyph="1-close" /><I18N.Message msgId="close"/></Button>]} | ||
tools={[<Button onClick={this.backToSearch} ><Glyphicon glyph="arrow-left" /><I18N.Message msgId="featuregrid.backtosearch"/></Button>]} | ||
key={"search-results-" + (this.state && this.state.searchN)} | ||
className="featureGrid" | ||
changeMapView={this.props.changeMapView} | ||
|
@@ -295,6 +297,21 @@ const DockedFeatureGrid = React.createClass({ | |
selectFeatures(features) { | ||
this.props.selectAllToggle(); | ||
this.props.selectFeatures(features); | ||
}, | ||
backToSearch() { | ||
this.props.onToggleDrawer(); | ||
this.props.onClose(); | ||
}, | ||
limitDockHeight(size) { | ||
const minSize = 0.25; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be configurable using a prop There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be configurable as a prop There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should they be also action and reducer or only props of the class? (minSize and maxSize) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. props of the component and of the plugin (to be customizable in localConfig cfg entry). Pass them from the FeatureGrid Plugin down to this component. |
||
const maxSize = 0.85; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be configurable, 1 by default |
||
if (size >= maxSize) { | ||
this.props.setDockSize(maxSize); | ||
} else if (size <= minSize) { | ||
this.props.setDockSize(minSize); | ||
} else { | ||
this.props.setDockSize(size); | ||
} | ||
} | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ const {toggleControl, setControlProperty} = require('../actions/controls'); | |
|
||
const {changeMapStyle} = require('../actions/map'); | ||
|
||
const {featureClose} = require('../actions/wfsquery'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are putting querybuilder / featuregrid logic inside a generic container: it's not the right place. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe the right place to trigger this action is inside the toggleMenu actionCreator, using thunk to dispatch both actions. |
||
|
||
const {Button, Glyphicon, Panel} = require('react-bootstrap'); | ||
|
||
const Section = require('./drawer/Section'); | ||
|
@@ -44,7 +46,9 @@ const DrawerMenu = React.createClass({ | |
menuOptions: React.PropTypes.object, | ||
singleSection: React.PropTypes.bool, | ||
buttonClassName: React.PropTypes.string, | ||
menuButtonStyle: React.PropTypes.object | ||
menuButtonStyle: React.PropTypes.object, | ||
featureClose: React.PropTypes.func, | ||
queryIsOpen: React.PropTypes.bool | ||
}, | ||
contextTypes: { | ||
messages: React.PropTypes.object, | ||
|
@@ -59,7 +63,9 @@ const DrawerMenu = React.createClass({ | |
buttonStyle: "default", | ||
menuOptions: {}, | ||
singleSection: false, | ||
buttonClassName: "drawer-menu-button" | ||
buttonClassName: "drawer-menu-button", | ||
featureClose: () => {}, | ||
queryIsOpen: false | ||
}; | ||
}, | ||
renderItems() { | ||
|
@@ -86,20 +92,28 @@ const DrawerMenu = React.createClass({ | |
render() { | ||
return ( | ||
<div id={this.props.id}> | ||
<Button id="drawer-menu-button" style={this.props.menuButtonStyle} bsStyle={this.props.buttonStyle} key="menu-button" className={this.props.buttonClassName} onClick={this.props.toggleMenu}><Glyphicon glyph={this.props.glyph}/></Button> | ||
<Button id="drawer-menu-button" style={this.props.menuButtonStyle} bsStyle={this.props.buttonStyle} key="menu-button" className={this.props.buttonClassName} onClick={this.closeAll}><Glyphicon glyph={this.props.glyph}/></Button> | ||
<Menu single={this.props.singleSection} {...this.props.menuOptions} title={<Message msgId="menu" />} alignment="left"> | ||
{this.renderItems()} | ||
</Menu> | ||
</div> | ||
); | ||
}, | ||
closeAll() { | ||
this.props.toggleMenu(); | ||
if (this.props.queryIsOpen) { | ||
this.props.featureClose(); | ||
} | ||
} | ||
}); | ||
|
||
module.exports = { | ||
DrawerMenuPlugin: connect((state) => ({ | ||
active: state.controls && state.controls.drawer && state.controls.drawer.active | ||
active: state.controls && state.controls.drawer && state.controls.drawer.active, | ||
queryIsOpen: state.query.open | ||
}), { | ||
toggleMenu: toggleControl.bind(null, 'drawer', null) | ||
toggleMenu: toggleControl.bind(null, 'drawer', null), | ||
featureClose | ||
})(DrawerMenu), | ||
reducers: {} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,8 @@ const { | |
QUERY_RESULT, | ||
QUERY_ERROR, | ||
RESET_QUERY, | ||
FEATURE_CLOSE | ||
FEATURE_CLOSE, | ||
QUERY_DOCK_SIZE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reducers/featuregrid.js? |
||
} = require('../actions/wfsquery'); | ||
|
||
const {QUERY_FORM_RESET} = require('../actions/queryform'); | ||
|
@@ -73,7 +74,8 @@ const initialState = { | |
featureTypes: {}, | ||
data: {}, | ||
result: null, | ||
resultError: null | ||
resultError: null, | ||
dockSize: 0.35 | ||
}; | ||
|
||
function query(state = initialState, action) { | ||
|
@@ -148,6 +150,11 @@ function query(state = initialState, action) { | |
open: false | ||
}); | ||
} | ||
case QUERY_DOCK_SIZE: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reducers/featuregrid.js? |
||
return assign({}, state, { | ||
dockSize: action.dockSize | ||
}); | ||
} | ||
default: | ||
return state; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -691,6 +691,7 @@ | |
"export": "Export", | ||
"selectall": "Alle auswählen", | ||
"deselectall": "Auswahl aufheben", | ||
"backtosearch": "Back to search", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Zurück zur Suche (?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe the right place to trigger this action is inside the toggleMenu actionCreator, using thunk to dispatch both actions. |
||
"pagination": { | ||
"page": "Seite", | ||
"of": "von", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -693,6 +693,7 @@ | |
"export": "Exporter", | ||
"selectall": "Tout sélectionner", | ||
"deselectall": "Tout désélectionner", | ||
"backtosearch": "Back to search", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Retour à la recherche |
||
"pagination": { | ||
"page": "Page", | ||
"of": "de", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this to another file? actions/featuregrid?