mirror of
https://github.com/wekan/wekan.git
synced 2025-12-18 16:30:13 +01:00
Removing Debug Lines, correcting behavior, caching las valide filter, and adding description
This commit is contained in:
parent
256ca129f0
commit
dd7c9997a9
4 changed files with 10 additions and 9 deletions
|
|
@ -56,7 +56,9 @@ template(name="filterSidebar")
|
||||||
if Filter.customFields.isSelected _id
|
if Filter.customFields.isSelected _id
|
||||||
i.fa.fa-check
|
i.fa.fa-check
|
||||||
hr
|
hr
|
||||||
|
span {{_ 'advanced-filter-label}}
|
||||||
input.js-field-advanced-filter(type="text")
|
input.js-field-advanced-filter(type="text")
|
||||||
|
span {{_ 'advanced-filter-description'}}
|
||||||
if Filter.isActive
|
if Filter.isActive
|
||||||
hr
|
hr
|
||||||
a.sidebar-btn.js-clear-all
|
a.sidebar-btn.js-clear-all
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ BlazeComponent.extendComponent({
|
||||||
Filter.customFields.toggle(this.currentData()._id);
|
Filter.customFields.toggle(this.currentData()._id);
|
||||||
Filter.resetExceptions();
|
Filter.resetExceptions();
|
||||||
},
|
},
|
||||||
'input .js-field-advanced-filter'(evt) {
|
'change .js-field-advanced-filter'(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
Filter.advanced.set(this.find('.js-field-advanced-filter').value.trim());
|
Filter.advanced.set(this.find('.js-field-advanced-filter').value.trim());
|
||||||
Filter.resetExceptions();
|
Filter.resetExceptions();
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ class AdvancedFilter {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._dep = new Tracker.Dependency();
|
this._dep = new Tracker.Dependency();
|
||||||
this._filter = '';
|
this._filter = '';
|
||||||
|
this._lastValide={};
|
||||||
}
|
}
|
||||||
|
|
||||||
set(str)
|
set(str)
|
||||||
|
|
@ -96,6 +97,7 @@ class AdvancedFilter {
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
this._filter = '';
|
this._filter = '';
|
||||||
|
this._lastValide={};
|
||||||
this._dep.changed();
|
this._dep.changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -147,26 +149,23 @@ class AdvancedFilter {
|
||||||
|
|
||||||
_fieldNameToId(field)
|
_fieldNameToId(field)
|
||||||
{
|
{
|
||||||
console.log(`searching: ${field}`);
|
|
||||||
const found = CustomFields.findOne({'name':field});
|
const found = CustomFields.findOne({'name':field});
|
||||||
console.log(found);
|
|
||||||
return found._id;
|
return found._id;
|
||||||
}
|
}
|
||||||
|
|
||||||
_arrayToSelector(commands)
|
_arrayToSelector(commands)
|
||||||
{
|
{
|
||||||
console.log('Parts: ', JSON.stringify(commands));
|
|
||||||
try {
|
try {
|
||||||
//let changed = false;
|
//let changed = false;
|
||||||
this._processSubCommands(commands);
|
this._processSubCommands(commands);
|
||||||
}
|
}
|
||||||
catch (e){return { $in: [] };}
|
catch (e){return this._lastValide;}
|
||||||
|
this._lastValide = {$or: commands};
|
||||||
return {$or: commands};
|
return {$or: commands};
|
||||||
}
|
}
|
||||||
|
|
||||||
_processSubCommands(commands)
|
_processSubCommands(commands)
|
||||||
{
|
{
|
||||||
console.log('SubCommands: ', JSON.stringify(commands));
|
|
||||||
const subcommands = [];
|
const subcommands = [];
|
||||||
let level = 0;
|
let level = 0;
|
||||||
let start = -1;
|
let start = -1;
|
||||||
|
|
@ -205,16 +204,13 @@ class AdvancedFilter {
|
||||||
if (start !== -1)
|
if (start !== -1)
|
||||||
{
|
{
|
||||||
this._processSubCommands(subcommands);
|
this._processSubCommands(subcommands);
|
||||||
console.log ('subcommands: ', subcommands.length);
|
|
||||||
if (subcommands.length === 1)
|
if (subcommands.length === 1)
|
||||||
commands.splice(start, 0, subcommands[0]);
|
commands.splice(start, 0, subcommands[0]);
|
||||||
else
|
else
|
||||||
commands.splice(start, 0, subcommands);
|
commands.splice(start, 0, subcommands);
|
||||||
}
|
}
|
||||||
this._processConditions(commands);
|
this._processConditions(commands);
|
||||||
console.log('Conditions: ', JSON.stringify(commands));
|
|
||||||
this._processLogicalOperators(commands);
|
this._processLogicalOperators(commands);
|
||||||
console.log('Operator: ', JSON.stringify(commands));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_processConditions(commands)
|
_processConditions(commands)
|
||||||
|
|
@ -458,6 +454,7 @@ Filter = {
|
||||||
const filter = this[fieldName];
|
const filter = this[fieldName];
|
||||||
filter.reset();
|
filter.reset();
|
||||||
});
|
});
|
||||||
|
this.advanced.reset();
|
||||||
this.resetExceptions();
|
this.resetExceptions();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,8 @@
|
||||||
"filter-on": "Filter is on",
|
"filter-on": "Filter is on",
|
||||||
"filter-on-desc": "You are filtering cards on this board. Click here to edit filter.",
|
"filter-on-desc": "You are filtering cards on this board. Click here to edit filter.",
|
||||||
"filter-to-selection": "Filter to selection",
|
"filter-to-selection": "Filter to selection",
|
||||||
|
"advanced-filter-label": "Advanced Filter",
|
||||||
|
"advanced-filter-description": "Advanced Filter allows to write a string containing following operators: == != <= >= && || ( ) A Space is used as seperator between the operators. You can filter for all custom fields by simply typing there names and values. For example: Field1 == Value1 Note: If fields or values contains spaces, you need to encapsulate them into single quetes. For example: 'Field 1' == 'Value 1' Also you can combine multiple Conditions. For Example: F1 == V1 || F1 = V2 Normaly all Operators are interpreted from left to right. You can change the order of that by placing brakets. For Example: F1 == V1 and ( F2 == V2 || F2 == V3 )",
|
||||||
"fullname": "Full Name",
|
"fullname": "Full Name",
|
||||||
"header-logo-title": "Go back to your boards page.",
|
"header-logo-title": "Go back to your boards page.",
|
||||||
"hide-system-messages": "Hide system messages",
|
"hide-system-messages": "Hide system messages",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue