Skip to content

Commit

Permalink
#1777 Fix donut widget click to search
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Feb 4, 2021
1 parent bb8ede9 commit 14abd8f
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions frontend/app/scripts/services/ui/GlobalSearchSrv.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,37 @@
};

this.buildDefaultFilterValue = function(fieldDef, value) {
if(fieldDef.name === 'tags' || fieldDef.type === 'user' || fieldDef.values.length > 0) {

var valueId = value.id;
var valueName = value.name;

if(valueId.startsWith('"') && valueId.endsWith('"')) {
valueId = valueId.slice (1, valueId.length-1);
}
if(valueName.startsWith('"') && valueName.endsWith('"')) {
valueName = valueName.slice (1, valueName.length-1);
}

if(fieldDef.type === 'string' || fieldDef.name === 'tags' || fieldDef.type === 'user' || fieldDef.values.length > 0) {
return {
operator: 'any',
list: [{
text: (fieldDef.type === 'number' || fieldDef.type === 'integer') ? Number.parseInt(value.id) : value.id, label:value.name
text: (fieldDef.type === 'number' || fieldDef.type === 'integer') ? Number.parseInt(valueId) : valueId, label:valueName
}]
};
} else {
switch(fieldDef.type) {
case 'number':
case 'integer':
return {
value: Number.parseInt(value.id)
value: Number.parseInt(valueId)
};
case 'boolean':
return value.id === 'true';
return valueId === 'true';
default:
return value.id;
return valueId;
}
return value.id;
return valueId;
}

};
Expand Down

0 comments on commit 14abd8f

Please sign in to comment.