Allow filtering multiple properties in the transation log

Currently only one property can be searched at a time

Test: build winscope, record a transaction log and select fields to
filter
Bug: 159619726

Change-Id: I9712ca9a9ddc11e20d44e7c5c671803de386f368
This commit is contained in:
Nataniel Borges
2021-10-19 13:10:18 +00:00
parent b6dcd51bdb
commit 1bbf014566

View File

@@ -40,15 +40,17 @@
<div class="input">
<div>
<md-autocomplete
v-model="selectedProperty"
:md-options="properties"
>
<label>Changed property</label>
</md-autocomplete>
<!-- TODO(b/159582192): Add way to select value a property has
changed to, figure out how to handle properties that are
objects... -->
<md-field>
<label>Changed property</label>
<md-select v-model="selectedProperties" multiple>
<md-option
v-for="property in properties"
:value="property"
v-bind:key="property">
{{ property }}
</md-option>
</md-select>
</md-field>
</div>
</div>
@@ -197,7 +199,7 @@ export default {
searchInput: '',
selectedTree: null,
filters: [],
selectedProperty: null,
selectedProperties: [],
selectedTransaction: null,
transactionEntryComponent: TransactionEntry,
transactionsTrace,
@@ -252,12 +254,12 @@ export default {
);
}
if (this.selectedProperty) {
if (this.selectedProperties.length > 0) {
const regexFilter = new RegExp(this.selectedProperties.join("|"), "i");
filteredData = filteredData.filter(
this.filterTransactions((transaction) => {
for (const key in transaction.obj) {
if (this.isMeaningfulChange(transaction.obj, key) &&
key === this.selectedProperty) {
if (this.isMeaningfulChange(transaction.obj, key) && regexFilter.test(key)) {
return true;
}
}