Skip to content

Commit

Permalink
Migration to use the new MDC-based Angular Components. Components mig…
Browse files Browse the repository at this point in the history
…rated: progress-bar

PiperOrigin-RevId: 565193844
  • Loading branch information
zzzaries authored and copybara-github committed Sep 15, 2023
1 parent 2bcffaa commit 07c08e4
Show file tree
Hide file tree
Showing 27 changed files with 57 additions and 40 deletions.
2 changes: 1 addition & 1 deletion frontend/app/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ xprof_ng_module(
"@npm//@ngrx/store",
"@npm//rxjs",
"@org_xprof//frontend/app/common/angular:angular_common_http",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_progress_bar",
"@org_xprof//frontend/app/common/angular:angular_material_progress_bar",
"@org_xprof//frontend/app/common/angular:angular_platform-browser_animation",
"@org_xprof//frontend/app/common/constants",
"@org_xprof//frontend/app/common/interfaces",
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/app.ng.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>

<ng-template #progress_bar>
<div class="progress-container" [hidden]="!loading">
<div class="progress-container" *ngIf="loading">
<div class="loading-message">Loading data</div>
<mat-progress-bar color="primary" mode="indeterminate"></mat-progress-bar>
</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/app_module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {HttpClientModule} from '@angular/common/http';
import {NgModule} from '@angular/core';
import {MatLegacyProgressBarModule} from '@angular/material/legacy-progress-bar';
import {MatProgressBarModule} from '@angular/material/progress-bar';
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {EmptyPageModule} from 'org_xprof/frontend/app/components/empty_page/empty_page_module';
Expand All @@ -18,7 +18,7 @@ import {App} from './app';
imports: [
BrowserModule,
HttpClientModule,
MatLegacyProgressBarModule,
MatProgressBarModule,
EmptyPageModule,
MainPageModule,
BrowserAnimationsModule,
Expand Down
8 changes: 4 additions & 4 deletions frontend/app/common/angular/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ts_library(
)

ts_library(
name = "angular_material_legacy_progress_bar",
name = "angular_material_progress_bar",
srcs = [],
deps = [
"@npm//@angular/material",
Expand Down Expand Up @@ -75,7 +75,7 @@ ts_library(
)

ts_library(
name = "angular_material_legacy_menu",
name = "angular_material_menu",
srcs = [],
deps = [
"@npm//@angular/material",
Expand All @@ -91,15 +91,15 @@ ts_library(
)

ts_library(
name = "angular_material_legacy_checkbox",
name = "angular_material_checkbox",
srcs = [],
deps = [
"@npm//@angular/material",
],
)

ts_library(
name = "angular_material_legacy_dialog",
name = "angular_material_dialog",
srcs = [],
deps = [
"@npm//@angular/material",
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/capture_profile/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ xprof_ng_module(
"@npm//@ngrx/store",
"@npm//rxjs",
"@org_xprof//frontend/app/common/angular:angular_material_button",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_dialog",
"@org_xprof//frontend/app/common/angular:angular_material_dialog",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_progress_spinner",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_snack_bar",
"@org_xprof//frontend/app/common/interfaces",
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/capture_profile/capture_profile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component, OnDestroy} from '@angular/core';
import {MatLegacyDialog} from '@angular/material/legacy-dialog';
import {MatDialog} from '@angular/material/dialog';
import {MatLegacySnackBar} from '@angular/material/legacy-snack-bar';
import {Store} from '@ngrx/store';
import {CaptureProfileOptions, CaptureProfileResponse} from 'org_xprof/frontend/app/common/interfaces/capture_profile';
Expand Down Expand Up @@ -27,7 +27,7 @@ export class CaptureProfile implements OnDestroy {
capturingProfile: Observable<boolean>;

constructor(
private readonly dialog: MatLegacyDialog,
private readonly dialog: MatDialog,
private readonly snackBar: MatLegacySnackBar,
private readonly dataService: DataService,
private readonly store: Store<{}>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ xprof_ng_module(
"@npm//@angular/forms",
"@npm//@angular/platform-browser",
"@org_xprof//frontend/app/common/angular:angular_material_button",
"@org_xprof//frontend/app/common/angular:angular_material_dialog",
"@org_xprof//frontend/app/common/angular:angular_material_expansion",
"@org_xprof//frontend/app/common/angular:angular_material_form_field",
"@org_xprof//frontend/app/common/angular:angular_material_input",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_dialog",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_radio",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_tooltip",
"@org_xprof//frontend/app/common/angular:angular_material_select",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {MatLegacyDialogRef} from '@angular/material/legacy-dialog';
import {MatDialogRef} from '@angular/material/dialog';

/** A capture profile dialog component. */
@Component({
Expand All @@ -25,7 +25,7 @@ export class CaptureProfileDialog {
delay = 0;

constructor(private readonly dialogRef:
MatLegacyDialogRef<CaptureProfileDialog>) {}
MatDialogRef<CaptureProfileDialog>) {}

addressTypeChanged(value: string) {
this.isTpuName = value === 'tpu';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {MatExpansionModule} from '@angular/material/expansion';
import {MatButtonModule} from '@angular/material/button';
import {MatLegacyDialogModule} from '@angular/material/legacy-dialog';
import {MatDialogModule} from '@angular/material/dialog';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatInputModule} from '@angular/material/input';
import {MatLegacyRadioModule} from '@angular/material/legacy-radio';
Expand All @@ -21,7 +21,7 @@ import {CaptureProfileDialog} from './capture_profile_dialog';
CommonModule,
FormsModule,
MatButtonModule,
MatLegacyDialogModule,
MatDialogModule,
MatExpansionModule,
MatFormFieldModule,
MatInputModule,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {MatButtonModule} from '@angular/material/button';
import {MatLegacyDialogModule} from '@angular/material/legacy-dialog';
import {MatDialogModule} from '@angular/material/dialog';
import {MatLegacyProgressSpinnerModule} from '@angular/material/legacy-progress-spinner';
import {MatLegacySnackBarModule} from '@angular/material/legacy-snack-bar';

Expand All @@ -15,7 +15,7 @@ import {CaptureProfileDialogModule} from './capture_profile_dialog/capture_profi
imports: [
CommonModule,
MatButtonModule,
MatLegacyDialogModule,
MatDialogModule,
MatLegacyProgressSpinnerModule,
CaptureProfileDialogModule,
MatLegacySnackBarModule,
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/graph_viewer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ xprof_ng_module(
"@npm//@ngrx/store",
"@npm//rxjs",
"@org_xprof//frontend/app/common/angular:angular_material_core",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_progress_bar",
"@org_xprof//frontend/app/common/angular:angular_material_progress_bar",
"@org_xprof//frontend/app/common/angular:angular_material_sidenav",
"@org_xprof//frontend/app/common/constants",
"@org_xprof//frontend/app/common/interfaces",
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/graph_viewer/graph_config/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ xprof_ng_module(
"@npm//@angular/forms",
"@npm//rxjs",
"@org_xprof//frontend/app/common/angular:angular_material_button",
"@org_xprof//frontend/app/common/angular:angular_material_checkbox",
"@org_xprof//frontend/app/common/angular:angular_material_core",
"@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_legacy_checkbox",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_tooltip",
"@org_xprof//frontend/app/common/angular:angular_material_select",
"@org_xprof//frontend/app/common/angular:angular_material_sidenav",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {MatIconModule} from '@angular/material/icon';
import {MatButtonModule} from '@angular/material/button';
import {MatLegacyCheckboxModule} from '@angular/material/legacy-checkbox';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatOptionModule} from '@angular/material/core';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatInputModule} from '@angular/material/input';
Expand All @@ -18,7 +18,7 @@ import {GraphConfig} from './graph_config';
CommonModule,
FormsModule,
MatButtonModule,
MatLegacyCheckboxModule,
MatCheckboxModule,
MatFormFieldModule,
MatIconModule,
MatInputModule,
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/graph_viewer/graph_viewer.ng.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
</mat-sidenav>
<mat-sidenav-content>
<diagnostics-view [diagnostics]="diagnostics"></diagnostics-view>
<div class="progress-container" [hidden]="!loading">
<div class="progress-container" *ngIf="loading">
<div class="loading-message">Loading graph viewer data</div>
<mat-progress-bar color="primary" mode="indeterminate"></mat-progress-bar>
</div>
<iframe #iframe id="graph-html" [src]="graphvizUri | safe"></iframe>
<iframe #iframe id="graph-html" [src]="graphvizUri | safe" (load)="onIframeLoaded()"></iframe>
</mat-sidenav-content>
</mat-sidenav-container>
2 changes: 1 addition & 1 deletion frontend/app/components/graph_viewer/graph_viewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ mat-progress-bar {
.progress-container {
position: absolute;
width: 100%;
margin: 300 0;
margin: 300px 0;
z-index: 1;
}
10 changes: 10 additions & 0 deletions frontend/app/components/graph_viewer/graph_viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,18 @@ export class GraphViewer implements OnDestroy {
return this.opName && this.selectedModule;
}

setLoadingStatus(loading: boolean, diagnostics?: Diagnostics) {
this.loading = loading;
this.diagnostics = diagnostics || {...DIAGNOSTICS_DEFAULT};
}

onIframeLoaded() {
this.setLoadingStatus(false);
}

onPlot() {
if (!this.validToPlot()) return;
this.setLoadingStatus(true);

// Update the query parameters in url after form updates
const queryParams: GraphViewerQueryParams = {
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/graph_viewer/graph_viewer_module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {MatOptionModule} from '@angular/material/core';
import {MatLegacyProgressBarModule} from '@angular/material/legacy-progress-bar';
import {MatProgressBarModule} from '@angular/material/progress-bar';
import {MatSidenavModule} from '@angular/material/sidenav';
import {DiagnosticsViewModule} from 'org_xprof/frontend/app/components/diagnostics_view/diagnostics_view_module';
import {GraphConfigModule} from 'org_xprof/frontend/app/components/graph_viewer/graph_config/graph_config_module';
Expand All @@ -14,7 +14,7 @@ import {GraphViewer} from './graph_viewer';
CommonModule,
DiagnosticsViewModule,
MatOptionModule,
MatLegacyProgressBarModule,
MatProgressBarModule,
MatSidenavModule,
PipesModule,
GraphConfigModule,
Expand Down
3 changes: 2 additions & 1 deletion frontend/app/components/main_page/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ xprof_ng_module(
"main_page.ng.html",
],
deps = [
"@npm//@angular/common",
"@npm//@angular/core",
"@npm//@angular/router",
"@npm//@ngrx/store",
"@npm//rxjs",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_progress_bar",
"@org_xprof//frontend/app/common/angular:angular_material_progress_bar",
"@org_xprof//frontend/app/common/angular:angular_material_sidenav",
"@org_xprof//frontend/app/common/constants",
"@org_xprof//frontend/app/common/interfaces",
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/main_page/main_page.ng.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<sidenav></sidenav>
</mat-sidenav>
<mat-sidenav-content>
<div class="progress-container" [hidden]="!loading">
<div class="progress-container" *ngIf="loading">
<div class="loading-message">{{loadingMessage}}</div>
<mat-progress-bar color="primary" mode="indeterminate"></mat-progress-bar>
</div>
Expand Down
6 changes: 4 additions & 2 deletions frontend/app/components/main_page/main_page_module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {MatLegacyProgressBarModule} from '@angular/material/legacy-progress-bar';
import {MatProgressBarModule} from '@angular/material/progress-bar';
import {MatSidenavModule} from '@angular/material/sidenav';
import {RouterModule, Routes} from '@angular/router';
import {DcnCollectiveStats} from 'org_xprof/frontend/app/components/dcn_collective_stats/dcn_collective_stats';
Expand Down Expand Up @@ -65,7 +66,8 @@ export const routes: Routes = [
@NgModule({
declarations: [MainPage],
imports: [
MatLegacyProgressBarModule,
CommonModule,
MatProgressBarModule,
MatSidenavModule,
EmptyPageModule,
SideNavModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ xprof_ng_module(
"@npm//@angular/forms",
"@npm//@angular/router",
"@npm//@ngrx/store",
"@org_xprof//frontend/app/common/angular:angular_material_checkbox",
"@org_xprof//frontend/app/common/angular:angular_material_divider",
"@org_xprof//frontend/app/common/angular:angular_material_icon",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_checkbox",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_tooltip",
"@org_xprof//frontend/app/common/interfaces",
"@org_xprof//frontend/app/common/utils",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {MatDividerModule} from '@angular/material/divider';
import {MatIconModule} from '@angular/material/icon';
import {MatLegacyCheckboxModule} from '@angular/material/legacy-checkbox';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatLegacyTooltipModule} from '@angular/material/legacy-tooltip';
import {DiagnosticsViewModule} from 'org_xprof/frontend/app/components/diagnostics_view/diagnostics_view_module';
import {MaxHeapChartModule} from 'org_xprof/frontend/app/components/memory_viewer/max_heap_chart/max_heap_chart_module';
Expand All @@ -18,7 +18,7 @@ import {MemoryViewerMain} from './memory_viewer_main';
FormsModule,
MatDividerModule,
MaxHeapChartModule,
MatLegacyCheckboxModule,
MatCheckboxModule,
MatIconModule,
MatLegacyTooltipModule,
ProgramOrderChartModule,
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/pod_viewer/topology_graph/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ xprof_ng_module(
"@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_legacy_menu",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_slider",
"@org_xprof//frontend/app/common/angular:angular_material_menu",
"@org_xprof//frontend/app/common/constants",
"@org_xprof//frontend/app/common/interfaces",
"@org_xprof//frontend/app/common/utils",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {MatIconModule} from '@angular/material/icon';
import {MatButtonModule} from '@angular/material/button';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatInputModule} from '@angular/material/input';
import {MatLegacyMenuModule} from '@angular/material/legacy-menu';
import {MatMenuModule} from '@angular/material/menu';
import {MatLegacySliderModule} from '@angular/material/legacy-slider';

import {TopologyGraph} from './topology_graph';
Expand All @@ -18,7 +18,7 @@ import {TopologyGraph} from './topology_graph';
MatFormFieldModule,
MatIconModule,
MatInputModule,
MatLegacyMenuModule,
MatMenuModule,
MatLegacySliderModule,
],
exports: [TopologyGraph]
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/tensorflow_stats/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ xprof_ng_module(
"@org_xprof//frontend/app/common/angular:angular_material_button",
"@org_xprof//frontend/app/common/angular:angular_material_divider",
"@org_xprof//frontend/app/common/angular:angular_material_icon",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_menu",
"@org_xprof//frontend/app/common/angular:angular_material_menu",
"@org_xprof//frontend/app/common/constants",
"@org_xprof//frontend/app/common/interfaces",
"@org_xprof//frontend/app/common/interfaces:chart",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core';
import {MatDividerModule} from '@angular/material/divider';
import {MatIconModule} from '@angular/material/icon';
import {MatButtonModule} from '@angular/material/button';
import {MatLegacyMenuModule} from '@angular/material/legacy-menu';
import {MatMenuModule} from '@angular/material/menu';
import {ChartModule} from 'org_xprof/frontend/app/components/chart/chart';
import {ExportAsCsvModule} from 'org_xprof/frontend/app/components/controls/export_as_csv/export_as_csv_module';
import {FlopRateChartModule} from 'org_xprof/frontend/app/components/tensorflow_stats/flop_rate_chart/flop_rate_chart_module';
Expand All @@ -21,7 +21,7 @@ import {TensorflowStats} from './tensorflow_stats';
MatButtonModule,
MatDividerModule,
MatIconModule,
MatLegacyMenuModule,
MatMenuModule,
ChartModule,
ExportAsCsvModule,
FlopRateChartModule,
Expand Down
4 changes: 4 additions & 0 deletions frontend/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ $theme: mat.define-light-theme(
@include mat.core-theme($theme);
@include mat.input-theme($theme);
@include mat.form-field-theme($theme);
@include mat.checkbox-theme($theme);
@include mat.select-theme($theme);
@include mat.menu-theme($theme);
@include mat.dialog-theme($theme);
@include mat.progress-bar-theme($theme);

html, body {
height: 100%;
Expand Down

0 comments on commit 07c08e4

Please sign in to comment.