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-spinner

PiperOrigin-RevId: 565194051
  • Loading branch information
zzzaries authored and copybara-github committed Sep 15, 2023
1 parent 8c0a84d commit 993d9e4
Show file tree
Hide file tree
Showing 68 changed files with 223 additions and 197 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
18 changes: 9 additions & 9 deletions frontend/app/common/angular/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ ts_library(
)

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

ts_library(
name = "angular_material_legacy_form_field",
name = "angular_material_form_field",
srcs = [],
deps = [
"@npm//@angular/material",
Expand All @@ -51,7 +51,7 @@ ts_library(
)

ts_library(
name = "angular_material_legacy_input",
name = "angular_material_input",
srcs = [],
deps = [
"@npm//@angular/material",
Expand All @@ -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 All @@ -115,7 +115,7 @@ ts_library(
)

ts_library(
name = "angular_material_legacy_progress_spinner",
name = "angular_material_progress_spinner",
srcs = [],
deps = [
"@npm//@angular/material",
Expand Down Expand Up @@ -163,15 +163,15 @@ ts_library(
)

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

ts_library(
name = "angular_material_legacy_select",
name = "angular_material_select",
srcs = [],
deps = [
"@npm//@angular/material",
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/capture_profile/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ 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_legacy_progress_spinner",
"@org_xprof//frontend/app/common/angular:angular_material_dialog",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_snack_bar",
"@org_xprof//frontend/app/common/angular:angular_material_progress_spinner",
"@org_xprof//frontend/app/common/interfaces",
"@org_xprof//frontend/app/components/capture_profile/capture_profile_dialog",
"@org_xprof//frontend/app/services/data_service",
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,13 +19,13 @@ 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_legacy_dialog",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_form_field",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_input",
"@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_radio",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_select",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_tooltip",
"@org_xprof//frontend/app/common/angular:angular_material_select",
"@org_xprof//frontend/app/common/interfaces",
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@

<div>
<mat-form-field>
<mat-label>Profiling duration(ms)</mat-label>
<input
matInput
type="number"
placeholder="Profiling Duration (milliseconds)"
[(ngModel)]="duration"
/>
</mat-form-field>
</div>

<div>
<mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Host Trace (TraceMe) Level</mat-label>
<mat-select
matTooltip="{{ hostTracerTooltip }}"
Expand All @@ -55,7 +55,7 @@
</div>

<div>
<mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Device Trace Level</mat-label>
<mat-select [(ngModel)]="deviceTracerLevel">
<mat-option value="0">disable</mat-option>
Expand All @@ -65,7 +65,7 @@
</div>

<div>
<mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Python Trace Level</mat-label>
<mat-select [(ngModel)]="pythonTracerLevel">
<mat-option value="0">disable</mat-option>
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,11 +3,11 @@ 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 {MatLegacyFormFieldModule} from '@angular/material/legacy-form-field';
import {MatLegacyInputModule} from '@angular/material/legacy-input';
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';
import {MatLegacySelectModule} from '@angular/material/legacy-select';
import {MatSelectModule} from '@angular/material/select';
import {MatLegacyTooltipModule} from '@angular/material/legacy-tooltip';
import {BrowserModule} from '@angular/platform-browser';

Expand All @@ -21,12 +21,12 @@ import {CaptureProfileDialog} from './capture_profile_dialog';
CommonModule,
FormsModule,
MatButtonModule,
MatLegacyDialogModule,
MatDialogModule,
MatExpansionModule,
MatLegacyFormFieldModule,
MatLegacyInputModule,
MatFormFieldModule,
MatInputModule,
MatLegacyRadioModule,
MatLegacySelectModule,
MatSelectModule,
MatLegacyTooltipModule,
],
exports: [CaptureProfileDialog]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {MatButtonModule} from '@angular/material/button';
import {MatLegacyDialogModule} from '@angular/material/legacy-dialog';
import {MatLegacyProgressSpinnerModule} from '@angular/material/legacy-progress-spinner';
import {MatDialogModule} from '@angular/material/dialog';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import {MatLegacySnackBarModule} from '@angular/material/legacy-snack-bar';

import {CaptureProfile} from './capture_profile';
Expand All @@ -15,8 +15,8 @@ import {CaptureProfileDialogModule} from './capture_profile_dialog/capture_profi
imports: [
CommonModule,
MatButtonModule,
MatLegacyDialogModule,
MatLegacyProgressSpinnerModule,
MatDialogModule,
MatProgressSpinnerModule,
CaptureProfileDialogModule,
MatLegacySnackBarModule,
],
Expand Down
6 changes: 3 additions & 3 deletions frontend/app/components/chart/table/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ xprof_ng_module(
deps = [
"@npm//@angular/core",
"@npm//@types/google.visualization",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_core",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_form_field",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_select",
"@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_select",
],
)

Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/chart/table/table.ng.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div [style.height]="height">
<mat-form-field *ngIf="displayPageSizeSelector()">
<mat-form-field *ngIf="displayPageSizeSelector()" appearance="outline">
<mat-label>Rows per Page: </mat-label>
<mat-select (selectionChange)="drawTable()" [(value)]="pageSize">
<mat-option *ngFor="let option of pageSizeOptions" [value]="option">{{option}}</mat-option>
Expand Down
12 changes: 6 additions & 6 deletions frontend/app/components/chart/table/table_module.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {MatLegacyOptionModule} from '@angular/material/legacy-core';
import {MatLegacyFormFieldModule} from '@angular/material/legacy-form-field';
import {MatLegacySelectModule} from '@angular/material/legacy-select';
import {MatOptionModule} from '@angular/material/core';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatSelectModule} from '@angular/material/select';

import {Table} from './table';

Expand All @@ -11,9 +11,9 @@ import {Table} from './table';
declarations: [Table],
imports: [
CommonModule,
MatLegacyOptionModule,
MatLegacySelectModule,
MatLegacyFormFieldModule,
MatOptionModule,
MatSelectModule,
MatFormFieldModule,
],
exports: [Table],
})
Expand Down
6 changes: 3 additions & 3 deletions frontend/app/components/controls/category_filter/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ xprof_ng_module(
"@npm//@angular/common",
"@npm//@angular/core",
"@npm//@types/google.visualization",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_core",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_form_field",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_select",
"@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_select",
],
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<mat-form-field class="control" *ngIf="columnLabel">
<mat-form-field class="control" *ngIf="columnLabel" appearance="outline">
<mat-label>{{columnLabel}}</mat-label>
<mat-select (selectionChange)="updateFilter()" [(value)]="value">
<mat-option *ngFor="let option of options" [value]="option">{{option}}</mat-option>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {MatLegacyOptionModule} from '@angular/material/legacy-core';
import {MatLegacyFormFieldModule} from '@angular/material/legacy-form-field';
import {MatLegacySelectModule} from '@angular/material/legacy-select';
import {MatOptionModule} from '@angular/material/core';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatSelectModule} from '@angular/material/select';

import {CategoryFilter} from './category_filter';

Expand All @@ -11,9 +11,9 @@ import {CategoryFilter} from './category_filter';
declarations: [CategoryFilter],
imports: [
CommonModule,
MatLegacyOptionModule,
MatLegacyFormFieldModule,
MatLegacySelectModule,
MatOptionModule,
MatFormFieldModule,
MatSelectModule,
],
exports: [CategoryFilter],
})
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/controls/string_filter/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ xprof_ng_module(
"@npm//@angular/common",
"@npm//@angular/core",
"@npm//@types/google.visualization",
"@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_legacy_form_field",
"@org_xprof//frontend/app/common/angular:angular_material_legacy_input",
"@org_xprof//frontend/app/common/angular:angular_material_input",
],
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<mat-form-field class="input-control" *ngIf="columnLabel">
<mat-form-field class="control" *ngIf="columnLabel" style="margin-right:8px;">
<mat-label>{{columnLabel}}</mat-label>
<input
matInput
[placeholder]="columnLabel"
[value]="value"
(input)="value = $event.target.value; updateFilter()"
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
/** CSS for a stats table component. */
/** CSS for string filter component. */

@import 'frontend/app/styles/common';

mat-icon {
color: $button-focus-color;
vertical-align: bottom;
}

// This control class never works for unknown reason
// added inline style instead
.control {
width: 240px;
margin-right: 8px;
}
Loading

0 comments on commit 993d9e4

Please sign in to comment.