From bfefca1c6def58d2bd2f0450050dd4938071b079 Mon Sep 17 00:00:00 2001 From: Nataniel Borges Date: Tue, 19 Oct 2021 12:26:49 +0000 Subject: [PATCH] Case insensitive filter on winscope Property and element search should be case insensitive Test: build winscope, open a trace, filter layer or property by name Bug: 203240981 Change-Id: I91575d550b3812b6a893136e965b0f1672389ab7 --- tools/winscope/src/TraceView.vue | 8 ++++---- tools/winscope/src/TransactionsView.vue | 11 +++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/winscope/src/TraceView.vue b/tools/winscope/src/TraceView.vue index 594272e9c..a263ea248 100644 --- a/tools/winscope/src/TraceView.vue +++ b/tools/winscope/src/TraceView.vue @@ -437,11 +437,11 @@ function getFilter(filterString) { const negative = []; filterStrings.forEach((f) => { if (f.startsWith('!')) { - const str = f.substring(1); - negative.push((s) => s.indexOf(str) === -1); + const regex = new RegExp(f.substring(1), "i"); + negative.push((s) => !regex.test(s)); } else { - const str = f; - positive.push((s) => s.indexOf(str) !== -1); + const regex = new RegExp(f, "i"); + positive.push((s) => regex.test(s)); } }); const filter = (item) => { diff --git a/tools/winscope/src/TransactionsView.vue b/tools/winscope/src/TransactionsView.vue index d2ac62cb0..9fda549a4 100644 --- a/tools/winscope/src/TransactionsView.vue +++ b/tools/winscope/src/TransactionsView.vue @@ -234,10 +234,13 @@ export default { filteredData = filteredData.filter( this.filterTransactions((transaction) => { for (const filter of this.filters) { - if (isNaN(filter) && transaction.layerName?.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 (isNaN(filter)) { + // If filter isn't a number then check if the transaction's + // target surface's name matches the filter — if so keep it. + const regexFilter = new RegExp(filter, "i"); + if (regexFilter.test(transaction.layerName)) { + return true; + } } if (filter == transaction.obj.id) { // If filteter is a number then check if the filter matches