Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/app/components/trace_viewer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ xprof_ng_module(
"@org_xprof//frontend/app/common/angular:angular_material_progress_bar",
"@org_xprof//frontend/app/common/constants",
"@org_xprof//frontend/app/common/interfaces",
"@org_xprof//frontend/app/components/trace_viewer_container",
"@org_xprof//frontend/app/components/trace_viewer_v2:app_bundle_ts",
"@org_xprof//frontend/app/pipes",
"@org_xprof//frontend/app/services/communication_service",
Expand Down
6 changes: 6 additions & 0 deletions frontend/app/components/trace_viewer_container/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ xprof_ng_module(
deps = [
"@npm//@angular/common",
"@npm//@angular/core",
"@npm//@angular/forms",
"@npm//rxjs",
"@org_xprof//frontend/app/common/angular:angular_material_button",
"@org_xprof//frontend/app/common/angular:angular_material_form_field",
"@org_xprof//frontend/app/common/angular:angular_material_icon",
"@org_xprof//frontend/app/common/angular:angular_material_input",
"@org_xprof//frontend/app/common/angular:angular_material_progress_bar",
"@org_xprof//frontend/app/common/angular:angular_material_progress_spinner",
"@org_xprof//frontend/app/common/angular:angular_material_table",
"@org_xprof//frontend/app/components/trace_viewer_v2:app_bundle_ts",
"@org_xprof//frontend/app/pipes",
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,57 @@
<ng-container *ngIf="useTraceViewerV2; else traceViewV1">
<div class="error-overlay" *ngIf="traceViewerV2LoadingStatus === TraceViewerV2LoadingStatus.ERROR">
<mat-icon>error</mat-icon>
<div class="error-message">{{'Error, please use the old frontend. ' + (traceViewerV2ErrorMessage ?? '')}}</div>
</div>
<div class="loading-overlay" *ngIf="traceViewerV2LoadingStatus !== TraceViewerV2LoadingStatus.IDLE && traceViewerV2LoadingStatus !== TraceViewerV2LoadingStatus.ERROR">
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
<div class="loading-status">{{traceViewerV2LoadingStatus}}</div>
<div class="tutorial">{{tutorials[currentTutorialIndex]}}</div>
<!-- TODO(b/467799543): Use *ngIf for 3p migration, because 3P angular is still in v15 (@if is not supported yet.). -->
<ng-container *ngIf="traceViewerV2LoadingStatus === TraceViewerV2LoadingStatus.ERROR">
<div class="error-overlay">
<mat-icon>error</mat-icon>
<div class="error-message">{{'Error, please use the old frontend. ' + (traceViewerV2ErrorMessage ?? '')}}</div>
</div>
</ng-container>
<ng-container *ngIf="traceViewerV2LoadingStatus !== TraceViewerV2LoadingStatus.IDLE && traceViewerV2LoadingStatus !== TraceViewerV2LoadingStatus.ERROR">
<div *ngIf="isInitialLoading" class="loading-overlay">
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
<div class="loading-status">{{traceViewerV2LoadingStatus}}</div>
<div class="tutorial">{{tutorials[currentTutorialIndex]}}</div>
</div>
</ng-container>
<div class="search-container">
<mat-form-field appearance="outline">
<input matInput #searchBox placeholder="Search events" aria-label="Search trace events" (input)="onSearchEvent(searchBox.value)" />
</mat-form-field>
<div *ngIf="currentSearchQuery" class="search-result-count">{{searchResultCountText}}</div>
<button mat-icon-button aria-label="Previous search result" (click)="prevSearchResult()" [disabled]="!currentSearchQuery">
<mat-icon>chevron_left</mat-icon>
</button>
<button mat-icon-button aria-label="Next search result" (click)="nextSearchResult()" [disabled]="!currentSearchQuery">
<mat-icon>chevron_right</mat-icon>
</button>
<div class="spacer"></div>
<div class="incremental-loading" *ngIf="searching || (!isInitialLoading && traceViewerV2LoadingStatus !== TraceViewerV2LoadingStatus.IDLE && traceViewerV2LoadingStatus !== TraceViewerV2LoadingStatus.ERROR)">
<div class="loading-status">Loading more data...</div>
<mat-progress-spinner mode="indeterminate" diameter="24"></mat-progress-spinner>
</div>
</div>
-->
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
-->
<div *ngIf="selectedEvent" #drawer class="drawer">
<div>Name: {{selectedEvent.name}}</div>
<div>Start Time: {{selectedEvent.startUsFormatted}}</div>
<div>Duration: {{selectedEvent.durationUsFormatted}}</div>
<div class="event-detail-table-container">
<table mat-table class="event-detail-table" [dataSource]="selectedEventProperties">
<!-- Key Column -->
<ng-container matColumnDef="property">
<td mat-cell *matCellDef="let element"> {{element.property}} </td>
</ng-container>

<!-- Value Column -->
<ng-container matColumnDef="value">
<td mat-cell *matCellDef="let element" style="word-break: break-word;"> {{element.value}} </td>
</ng-container>

<tr mat-row *matRowDef="let row; columns: eventDetailColumns;"></tr>
</table>
<div *ngIf="selectedEvent.stackTraceLinkHtml" [innerHTML]="selectedEvent.stackTraceLinkHtml"></div>
<div *ngIf="selectedEvent.rooflineModelLinkHtml" [innerHTML]="selectedEvent.rooflineModelLinkHtml"></div>
<div *ngIf="selectedEvent.graphViewerLinkHtml" [innerHTML]="selectedEvent.graphViewerLinkHtml"></div>
</div>
</div>
</ng-container>
<ng-template #traceViewV1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,148 @@
:host {
display: block;
/** CSS for a trace viewer component. */

$menu-bar-height: 64px;
$filter-bar-height: 50px;
$search-bar-height: 50px;
$drawer-height: 300px;

iframe {
position: absolute;
width: 100%;
height: 100%;
height: calc(100% - $menu-bar-height - $filter-bar-height);
box-sizing: border-box;
border-style: unset;
transition: height 0.05s ease-in-out;
}

.emscripten {
canvas {
position: absolute;
width: 100%;
height: 100%;
display: block;
height: calc(100% - $menu-bar-height - $filter-bar-height - $search-bar-height);
box-sizing: border-box;
border-style: unset;
// Add a smooth transition when the height changes (e.g., when the drawer
// opens/closes).
// This is to make the canvas rendering more smooth.
transition: height 0.05s ease-in-out;
}

iframe {
border: 0;
display: block;
height: 100%;
.search-container {
display: flex;
align-items: center;
margin-left: 16px;
height: $search-bar-height;
border-bottom: 1px solid black;

box-sizing: border-box;
}

.search-container ::ng-deep .mat-mdc-form-field-infix {
min-height: 30px;
padding-top: 4px;
padding-bottom: 4px;
align-items: center;
}

.search-result-count {
margin: 0 8px;
}

.drawer {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: $drawer-height;
background-color: white;
border-top: 1px solid black;
padding: 10px;
box-sizing: border-box;
z-index: 100;
overflow: auto;

.event-detail-table-container {
width: 800px;
}

table.mat-mdc-table {
width: 100%;
table-layout: fixed;

th.mat-mdc-header-cell,
td.mat-mdc-cell {
border-bottom: none;
font-size: 12px;
padding-top: 0;
padding-bottom: 0;
}

td.mat-column-property {
width: 30%;
}

tr.mat-mdc-header-row {
height: 30px;
}

tr.mat-mdc-row {
height: 24px;
}
}
}

.error-overlay {
position: absolute;
width: 100%;
height: calc(100% - $menu-bar-height - $filter-bar-height - $search-bar-height);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
background-color: white;
color: red;

mat-icon {
margin-right: 10px;
}
}

.loading-overlay {
position: absolute;
width: 100%;
height: calc(100% - $menu-bar-height - $filter-bar-height - $search-bar-height);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: rgba(255, 255, 255, 0.5);
z-index: 1000;

.loading-status,
.tutorial {
margin-top: 10px;
}

mat-progress-bar {
width: 40%;
}
}

.spacer {
flex-grow: 1;
}

.incremental-loading {
display: flex;
align-items: center;
margin-right: 16px;

.loading-status {
margin-right: 8px;
}
}

:host(.drawer-open) {
canvas {
height: calc(100% - $menu-bar-height - $filter-bar-height - $search-bar-height - $drawer-height);
}
}
Loading