mirror of
https://github.com/wekan/wekan.git
synced 2026-01-26 03:06:09 +01:00
Add new has operator for searching
This commit is contained in:
parent
c02b71e0e1
commit
726be664c8
4 changed files with 43 additions and 2 deletions
|
|
@ -222,6 +222,7 @@ BlazeComponent.extendComponent({
|
|||
'operator-created': 'createdAt',
|
||||
'operator-modified': 'modifiedAt',
|
||||
'operator-comment': 'comments',
|
||||
'operator-has': 'has',
|
||||
};
|
||||
|
||||
const predicates = {
|
||||
|
|
@ -244,6 +245,11 @@ BlazeComponent.extendComponent({
|
|||
'predicate-created': 'createdAt',
|
||||
'predicate-modified': 'modifiedAt',
|
||||
},
|
||||
has: {
|
||||
'predicate-description': 'description',
|
||||
'predicate-checklist': 'checklist',
|
||||
'predicate-attachment': 'attachment',
|
||||
},
|
||||
};
|
||||
const predicateTranslations = {};
|
||||
Object.entries(predicates).forEach(([category, catPreds]) => {
|
||||
|
|
@ -276,6 +282,7 @@ BlazeComponent.extendComponent({
|
|||
createdAt: null,
|
||||
modifiedAt: null,
|
||||
comments: [],
|
||||
has: [],
|
||||
};
|
||||
|
||||
let text = '';
|
||||
|
|
@ -296,6 +303,7 @@ BlazeComponent.extendComponent({
|
|||
} else {
|
||||
op = m.groups.abbrev.toLowerCase();
|
||||
}
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (operatorMap.hasOwnProperty(op)) {
|
||||
let value = m.groups.value;
|
||||
if (operatorMap[op] === 'labels') {
|
||||
|
|
@ -353,6 +361,15 @@ BlazeComponent.extendComponent({
|
|||
} else {
|
||||
value = predicateTranslations.status[value];
|
||||
}
|
||||
} else if (operatorMap[op] === 'has') {
|
||||
if (!predicateTranslations.has[value]) {
|
||||
this.parsingErrors.push({
|
||||
tag: 'operator-has-invalid',
|
||||
value,
|
||||
});
|
||||
} else {
|
||||
value = predicateTranslations.has[value];
|
||||
}
|
||||
}
|
||||
if (Array.isArray(params[operatorMap[op]])) {
|
||||
params[operatorMap[op]].push(value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue