From 1d74cf96d848852535e8b948e98c62b57c90c474 Mon Sep 17 00:00:00 2001 From: Pablo Gamito Date: Fri, 5 Jun 2020 11:58:38 +0100 Subject: [PATCH] Add support for named surfaces filters Test: N/A Change-Id: I0cc7385df06ad889845b78310360a66265a7af11 --- tools/winscope/src/TransactionsView.vue | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/winscope/src/TransactionsView.vue b/tools/winscope/src/TransactionsView.vue index e15afe03e..c5f999603 100644 --- a/tools/winscope/src/TransactionsView.vue +++ b/tools/winscope/src/TransactionsView.vue @@ -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) {