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
This commit is contained in:
Nataniel Borges
2021-10-19 12:26:49 +00:00
parent b6dcd51bdb
commit bfefca1c6d
2 changed files with 11 additions and 8 deletions

View File

@@ -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) => {

View File

@@ -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