Add support for named surfaces filters

Test: N/A
Change-Id: I0cc7385df06ad889845b78310360a66265a7af11
This commit is contained in:
Pablo Gamito
2020-06-05 11:58:38 +01:00
parent 996f8dfd8f
commit 1d74cf96d8

View File

@@ -110,8 +110,24 @@ export default {
if (this.filters.length > 0) {
filteredData = filteredData.filter(
this.filterTransactions(transaction =>
this.filters.includes("" + transaction.obj.id)));
this.filterTransactions(transaction => {
for (const filter of this.filters) {
if (isNaN(filter) && transaction.obj?.name?.includes(filter)) {
// If filter isn't a number then check if the transaction's
// target surface's name matches the filter — if so keep it.
return true;
}
if (filter == transaction.obj.id) {
// If filteter is a number then check if the filter matches
// the transaction's target surface id — if so keep it.
return true;
}
}
// Exclude transaction if it fails to match filter.
return false;
})
);
}
if (this.selectedProperty) {