1<!-- Copyright (C) 2019 The Android Open Source Project
2
3     Licensed under the Apache License, Version 2.0 (the "License");
4     you may not use this file except in compliance with the License.
5     You may obtain a copy of the License at
6
7          http://www.apache.org/licenses/LICENSE-2.0
8
9     Unless required by applicable law or agreed to in writing, software
10     distributed under the License is distributed on an "AS IS" BASIS,
11     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12     See the License for the specific language governing permissions and
13     limitations under the License.
14-->
15<template>
16 <div class="bounds" v-if="visible">
17   <md-select v-model="visibleTransactions" name="visibleTransactions" id="visibleTransactions"
18           placeholder="Everything Turned Off" md-dense multiple @input="updateFilter()" >
19       <md-option value="displayCreation, displayDeletion">Display</md-option>
20       <md-option value="powerModeUpdate">Power Mode</md-option>
21       <md-option value="surfaceCreation, surfaceDeletion">Surface</md-option>
22       <md-option value="transaction">Transaction</md-option>
23       <md-option value="vsyncEvent">vsync</md-option>
24       <md-option value="bufferUpdate">Buffer</md-option>
25   </md-select>
26 </div>
27</template>
28<script>
29import { DATA_TYPES } from './decode.js'
30
31export default {
32  name: 'datafilter',
33  props: ['file'],
34  data() {
35    return {
36      rawData: this.file.data,
37      rawTimeline: this.file.timeline,
38      visibleTransactions: ["powerModeUpdate", "surfaceCreation, surfaceDeletion",
39                    "displayCreation, displayDeletion", "transaction"]
40    };
41  },
42  methods: {
43    updateFilter() {
44      this.file.data =
45              this.rawData.filter(x => this.visibleTransactions.includes(x.obj.increment));
46      this.file.timeline =
47              this.rawTimeline.filter(x => this.file.data.map(y => y.timestamp).includes(x));
48    },
49  },
50  computed: {
51    visible() {
52      return this.file.type == DATA_TYPES.TRANSACTION
53    },
54  }
55}
56</script>
57
58<style scoped>
59    .bounds {
60        margin: 1em;
61    }
62</style>
63