From faa9a67afa61dd09f4ecd61239795377492cbec8 Mon Sep 17 00:00:00 2001 From: Priyanka Date: Tue, 24 Aug 2021 14:25:17 +0000 Subject: [PATCH] Add tabs to hide/show data views. All files with data views are shown by default. Click the chevron in the top left of the view to expand/collapse the data view. Bug: b/197626844 Test: upload or run a trace to the x20 staging version linked on the bug. Change-Id: I8fdd222e3299670285466fe97f958caa537a1f7e --- tools/winscope/src/App.vue | 21 ++++++++++--- tools/winscope/src/DataView.vue | 52 +++++++++++++++++++++++++++------ 2 files changed, 60 insertions(+), 13 deletions(-) diff --git a/tools/winscope/src/App.vue b/tools/winscope/src/App.vue index ab88a1bde..d7717613f 100644 --- a/tools/winscope/src/App.vue +++ b/tools/winscope/src/App.vue @@ -54,6 +54,7 @@ :file="file" :presentTags="Object.freeze(presentTags)" :presentErrors="Object.freeze(presentErrors)" + :dataViewFiles="dataViewFiles" @click="onDataViewFocus(file)" /> @@ -105,6 +106,7 @@ export default { displayDefaults: true, navigationStyle: NAVIGATION_STYLE.GLOBAL, flickerTraceView: false, + showFileTypes: [], }), overlayRef: 'overlay', mainContentStyle: { @@ -113,6 +115,7 @@ export default { presentTags: [], presentErrors: [], searchTypes: [SEARCH_TYPE.TIMESTAMP], + tagAndErrorTraces: false, }; }, created() { @@ -168,7 +171,14 @@ export default { this.searchTypes = [SEARCH_TYPE.TIMESTAMP]; if (this.tagAndErrorTraces) this.searchTypes.push(SEARCH_TYPE.TAG); }, + /** Filter data view files by current show settings*/ + updateShowFileTypes() { + this.store.showFileTypes = this.dataViewFiles + .filter((file) => file.show) + .map(file => file.type); + }, clear() { + this.store.showFileTypes = []; this.$store.commit('clearFiles'); }, onDataViewFocus(file) { @@ -198,6 +208,7 @@ export default { this.presentErrors = this.getUpdatedErrors(); this.updateSearchTypes(); this.updateFocusedView(); + this.updateShowFileTypes(); }, setStatus(status) { if (status) { @@ -216,7 +227,10 @@ export default { }, computed: { files() { - return this.$store.getters.sortedFiles; + return this.$store.getters.sortedFiles.map(file => { + if (this.hasDataView(file)) file.show = true; + return file; + }); }, prettyDump() { return JSON.stringify(this.dump, null, 2); @@ -232,7 +246,7 @@ export default { return this.activeDataView; }, dataViewFiles() { - return this.files.filter((f) => this.hasDataView(f)); + return this.files.filter((file) => this.hasDataView(file)); }, tagFiles() { return this.$store.getters.tagFiles; @@ -308,8 +322,7 @@ export default { margin-top: 1em } -h1, -h2 { +h1 { font-weight: normal; } diff --git a/tools/winscope/src/DataView.vue b/tools/winscope/src/DataView.vue index 8f2c05bd4..a2751f191 100644 --- a/tools/winscope/src/DataView.vue +++ b/tools/winscope/src/DataView.vue @@ -16,10 +16,15 @@
+
{{ TRACE_ICONS[file.type] }} - {{file.type}} + {{ file.type }}
-

Unrecognized DataType

+

Unrecognized DataType

@@ -156,8 +161,23 @@ export default { // to component. this.$emit('click', e); }, + /** Filter data view files by current show settings */ + updateShowFileTypes() { + this.store.showFileTypes = this.dataViewFiles + .filter((file) => file.show) + .map(file => file.type); + }, + /** Expand or collapse data view */ + toggleView() { + this.file.show = !this.file.show; + this.updateShowFileTypes(); + }, + /** Check if data view file should be shown */ + isShowFileType(type) { + return this.store.showFileTypes.find(fileType => fileType===type); + }, }, - props: ['store', 'file', 'presentTags', 'presentErrors'], + props: ['store', 'file', 'presentTags', 'presentErrors', 'dataViewFiles'], mixins: [FileType], components: { 'traceview': TraceView, @@ -176,4 +196,18 @@ export default { font-size: 4em; color: red; } + +.toggle-view-button { + background: none; + color: inherit; + border: none; + font: inherit; + cursor: pointer; + padding-right: 10px; + display: inline-block; +} + +.md-title { + display: inline-block; +}