Skip to content

Commit

Permalink
fixed issue query builder filter with space, fixed issue on search la…
Browse files Browse the repository at this point in the history
…bel cut under logical operator
  • Loading branch information
volterra79 committed Jun 8, 2021
1 parent 27515b6 commit b5519cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion assets/style/less/g3w-search.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
width:100%;
position: relative;
display: flex; justify-content: center;
margin-bottom: 5px;
margin-bottom: 15px;
margin-top: 30px;
border-bottom: 1px solid;
h4 {
font-weight: bold;
Expand Down
14 changes: 12 additions & 2 deletions src/app/core/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ const utils = {
return `${field}|${operator.toLowerCase()}|${value}${logicop || ''}`;
},
createFilterFromString({layer, search_endpoint='ows', filter=''}){
const stringFilter = filter;
let stringFilter = filter;
switch (search_endpoint) {
case 'ows':
const layerName = layer.getWMSLayerName();
Expand All @@ -445,7 +445,17 @@ const utils = {
filter.setExpression(expression.get());
break;
case 'api':
filter = stringFilter.replace(/\s|'|"/g, '');
//remove all blank space between operatos
Object.values(EXPRESSION_OPERATORS).forEach(operator =>{
const splitStringOperator = stringFilter.split(operator);
if (splitStringOperator.length > 1) {
splitStringOperator.forEach((token,index) =>{
splitStringOperator[index] = token.trim();
});
stringFilter = splitStringOperator.join(operator);
}
});
filter = stringFilter.replace(/'|"/g, '');
Object.entries(EXPRESSION_OPERATORS).forEach(([key,value]) =>{
const re = new RegExp(value, "g");
const replaceValue = value === 'AND' || value === 'OR' ? `|${key},` : `|${key}|`;
Expand Down

0 comments on commit b5519cc

Please sign in to comment.