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

Fix #1775 Query panel fails when selecting a boolean attribute #1781

Merged
merged 4 commits into from
May 11, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
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/FilterField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const FilterField = React.createClass({
this.props.onUpdateExceptionField(rowId, message);
},
updateFieldElement(rowId, name, value, type) {
this.props.onUpdateField(rowId, name, value, type);
this.props.onUpdateField(rowId, name, value, type === 'boolean' ? 'string' : type);

if (name === "value") {
// For cascading: filter the attributes that depends on
Expand Down
7 changes: 7 additions & 0 deletions web/client/components/data/query/GroupField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ const GroupField = React.createClass({
case "string": {
return ["=", "like", "ilike", "isNull"];
}
case "boolean": {
return ["="];
}
default:
return ["=", ">", "<", ">=", "<=", "<>", "><"];
}
Expand Down Expand Up @@ -129,6 +132,10 @@ const GroupField = React.createClass({
<TextField
operator={filterField.operator}
attType="string"/>
<ComboField
fieldOptions={['true', 'false']}
attType="boolean"
comboFilter={"contains"}/>
</FilterField>
</Col>
<Col xs={2}>
Expand Down
55 changes: 53 additions & 2 deletions web/client/epics/wfsquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,62 @@ const {changeSpatialAttribute} = require('../actions/queryform');
const {FEATURE_TYPE_SELECTED, featureTypeLoaded, featureTypeError} = require('../actions/wfsquery');

const types = {
// string
// 'xsd:ENTITIES': 'string',
// 'xsd:ENTITY': 'string',
// 'xsd:ID': 'string',
// 'xsd:IDREF': 'string',
// 'xsd:IDREFS': 'string',
// 'xsd:language': 'string',
// 'xsd:Name': 'string',
// 'xsd:NCName': 'string',
// 'xsd:NMTOKEN': 'string',
// 'xsd:NMTOKENS': 'string',
'xsd:normalizedString': 'string',
// 'xsd:QName': 'string',
'xsd:string': 'string',
// 'xsd:token': 'string',

// date
'xsd:date': 'date',
'xsd:dateTime': 'date',
// 'xsd:duration': 'date',
// 'xsd:gDay': 'date',
// 'xsd:gMonth': 'date',
// 'xsd:gMonthDay': 'date',
// 'xsd:gYear': 'date',
// 'xsd:gYearMonth': 'date',
// 'xsd:time': 'date',

// number
// 'xsd:byte': 'number',
'xsd:decimal': 'number',
'xsd:int': 'number',
'xsd:integer': 'number',
'xsd:long': 'number',
'xsd:negativeInteger': 'number',
'xsd:nonNegativeInteger': 'number',
'xsd:nonPositiveInteger': 'number',
'xsd:positiveInteger': 'number',
'xsd:short': 'number',
'xsd:unsignedLong': 'number',
'xsd:unsignedInt': 'number',
'xsd:unsignedShort': 'number',
// 'xsd:unsignedByte': 'number',

// from old object
'xsd:number': 'number',
'xsd:int': 'number'

// misc
// 'xsd:anyURI': 'string',
// 'xsd:base64Binary': 'number',
'xsd:boolean': 'boolean',
'xsd:double': 'number',
// 'xsd:hexBinary': 'string',
// 'xsd:NOTATION': 'string',
'xsd:float': 'number'
};

const fieldConfig = {};
const extractInfo = (data) => {
return {
Expand All @@ -35,7 +86,7 @@ const extractInfo = (data) => {
return conf;
}),
attributes: data.featureTypes[0].properties
.filter((attribute) => attribute.type.indexOf('gml:') !== 0)
.filter((attribute) => attribute.type.indexOf('gml:') !== 0 && types[attribute.type])
.map((attribute) => {
let conf = {
label: attribute.name,
Expand Down