/* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import {CdkVirtualScrollViewport} from '@angular/cdk/scrolling'; import {Component, ElementRef, Inject, Input, ViewChild} from '@angular/core'; import {MatSelectChange} from '@angular/material/select'; import {Events} from './events'; import {UiData} from './ui_data'; @Component({ selector: 'viewer-transactions', template: `
TX ID
VSYNC ID {{ vsyncId }}
PID {{ pid }}
UID {{ uid }}
Type {{ type }}
LAYER/DISP ID {{ id }}
Search text
{{ entry.time }}
{{ entry.transactionId }}
{{ entry.vsyncId }}
{{ entry.pid }}
{{ entry.uid }}
{{ entry.type }}
{{ entry.layerOrDisplayId }}
{{ entry.what }}

Properties - Proto Dump

`, styles: [ ` .entries { flex: 3; display: flex; flex-direction: column; padding: 16px; } .container-properties { flex: 1; padding: 16px; } .entries .filters { display: flex; flex-direction: row; } .entries .scroll { flex: 1; height: 100%; } .scroll .entry { display: flex; flex-direction: row; } .filters div { flex: 1; padding: 4px; } .filters .vsyncid mat-form-field { width: 120px; } .filters div.time { flex: 2; } .filters div.what { flex: 3; } .filters .id mat-form-field { width: 150px; } .filters .what { margin-right: 16px; } .filters .what mat-form-field { width: 250px; } .entry div { flex: 1; padding: 4px; } .entry div.time { flex: 2; } .entry div.what { flex: 3; } .entry.current-entry { color: white; background-color: #365179; } .entry.selected-entry { color: white; background-color: #98aecd; } mat-form-field { width: 100px; } ::ng-deep .mat-select-panel-wrap { overflow: scroll; overflow-x: hidden; max-height: 75vh; } `, ], }) class ViewerTransactionsComponent { uiData: UiData = UiData.EMPTY; idString = ''; whatSearchString = ''; @ViewChild(CdkVirtualScrollViewport) private scrollComponent?: CdkVirtualScrollViewport; private elementRef: ElementRef; constructor(@Inject(ElementRef) elementRef: ElementRef) { this.elementRef = elementRef; } @Input() set inputData(data: UiData) { this.uiData = data; if (this.uiData.scrollToIndex !== undefined && this.scrollComponent) { this.scrollComponent.scrollToIndex(this.uiData.scrollToIndex); } } onVSyncIdFilterChanged(event: MatSelectChange) { this.emitEvent(Events.VSyncIdFilterChanged, event.value); } onPidFilterChanged(event: MatSelectChange) { this.emitEvent(Events.PidFilterChanged, event.value); } onUidFilterChanged(event: MatSelectChange) { this.emitEvent(Events.UidFilterChanged, event.value); } onTypeFilterChanged(event: MatSelectChange) { this.emitEvent(Events.TypeFilterChanged, event.value); } onLayerIdFilterChanged(event: MatSelectChange) { this.emitEvent(Events.LayerIdFilterChanged, event.value); } onWhatSearchStringChange() { this.emitEvent(Events.WhatSearchStringChanged, this.whatSearchString); } onIdSearchStringChanged() { this.emitEvent(Events.IdFilterChanges, this.idString); } onEntryClicked(index: number) { this.emitEvent(Events.EntryClicked, index); } isCurrentEntry(index: number): boolean { return index === this.uiData.currentEntryIndex; } isSelectedEntry(index: number): boolean { return index === this.uiData.selectedEntryIndex; } private emitEvent(event: string, data: any) { const customEvent = new CustomEvent(event, { bubbles: true, detail: data, }); this.elementRef.nativeElement.dispatchEvent(customEvent); } } export {ViewerTransactionsComponent};