Skip to content

Commit 21b6bc6

Browse files
authored
chore: Upgrade Angular (to 15) and related dependencies (#6483)
Upgrade Angular to version 15. Upgrade related dependencies as needed. See: https://github.com/tensorflow/tensorboard/blob/master/DEVELOPMENT.md#updating-angular See: https://update.angular.io/?l=3&v=14.0-15.0 See: https://dev.to/ngrx/announcing-ngrx-v15-standalone-apis-type-safe-projectors-component-and-componentstore-updates-and-more-l7 Highlights: * Upgrade the following set of dependencies: * `@angular/*` and `@angular-devkit`: ^15.2.9 * `@ngrx/*`: ^15.4.0 * Note that the following dependencies did not require upgrade: * `typescript` * `rxjs` * `zone.js` * `ngx-color-picker` * Had to migrate much of the Angular material component usage to use the "Legacy" versions of the components. * https://rc.material.angular.io/guide/mdc-migration * Note: Migration to the current MDC-based material components will happen later. * Checkboxes no longer have the aria-checked property so some tests had to be updated. Most of the changes to use Legacy components are done with the following `sed` commands with some manual adjustments to manually revert changes to `MatButtonToggle` (which does not have a Legacy equivalent): ``` find . -type f -name '*.ts' -exec sed -i 's#MatAutocomplete#MatLegacyAutocomplete#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatButton#MatLegacyButton#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatCheckbox#MatLegacyCheckbox#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatDialog#MatLegacyDialog#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MAT_DIALOG#MAT_LEGACY_DIALOG#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatFormField#MatLegacyFormField#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatInput#MatLegacyInput#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatMenu#MatLegacyMenu#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatPaginator#MatLegacyPaginator#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatProgressSpinner#MatLegacyProgressSpinner#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatSelect#MatLegacySelect#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatSlider#MatLegacySlider#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatSnackBar#MatLegacySnackBar#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MAT_SNACK_BAR#MAT_LEGACY_SNACK_BAR#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatTable#MatLegacyTable#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatTabs#MatLegacyTabs#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#MatTabChangeEvent#MatLegacyTabChangeEvent#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/autocomplete#@angular/material/legacy-autocomplete#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/button#@angular/material/legacy-button#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/checkbox#@angular/material/legacy-checkbox#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/dialog#@angular/material/legacy-dialog#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/form-field#@angular/material/legacy-form-field#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/input#@angular/material/legacy-input#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/menu#@angular/material/legacy-menu#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/paginator#@angular/material/legacy-paginator#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/progress-spinner#@angular/material/legacy-progress-spinner#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/select#@angular/material/legacy-select#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/slider#@angular/material/legacy-slider#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/snack-bar#@angular/material/legacy-snack-bar#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/table#@angular/material/legacy-table#g' {} \; find . -type f -name '*.ts' -exec sed -i 's#@angular/material/tabs#@angular/material/legacy-tabs#g' {} \; ```
1 parent f3872e6 commit 21b6bc6

File tree

58 files changed

+2461
-1839
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2461
-1839
lines changed

package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
},
2929
"homepage": "https://github.com/tensorflow/tensorboard#readme",
3030
"devDependencies": {
31-
"@angular-devkit/build-angular": "^14.2.9",
31+
"@angular-devkit/build-angular": "^15.2.9",
3232
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#fb42478534df7d48ec23a6834fea94a776cb89a0",
33-
"@angular/cli": "^14.2.9",
34-
"@angular/compiler": "14.2.11",
35-
"@angular/compiler-cli": "^14.2.11",
33+
"@angular/cli": "^15.2.9",
34+
"@angular/compiler": "15.2.9",
35+
"@angular/compiler-cli": "^15.2.9",
3636
"@babel/core": "^7.16.12",
3737
"@bazel/concatjs": "5.7.0",
3838
"@bazel/esbuild": "5.7.0",
@@ -65,18 +65,18 @@
6565
"yarn-deduplicate": "^5.0.0"
6666
},
6767
"dependencies": {
68-
"@angular/animations": "^14.2.11",
69-
"@angular/cdk": "^14.2.7",
70-
"@angular/common": "14.2.11",
71-
"@angular/core": "^14.2.11",
72-
"@angular/forms": "^14.2.11",
73-
"@angular/localize": "^14.2.11",
74-
"@angular/material": "^14.2.7",
75-
"@angular/platform-browser": "^14.2.11",
76-
"@angular/platform-browser-dynamic": "^14.2.11",
77-
"@angular/router": "^14.2.11",
78-
"@ngrx/effects": "^14.3.2",
79-
"@ngrx/store": "^14.3.2",
68+
"@angular/animations": "^15.2.9",
69+
"@angular/cdk": "^15.2.9",
70+
"@angular/common": "15.2.9",
71+
"@angular/core": "^15.2.9",
72+
"@angular/forms": "^15.2.9",
73+
"@angular/localize": "^15.2.9",
74+
"@angular/material": "^15.2.9",
75+
"@angular/platform-browser": "^15.2.9",
76+
"@angular/platform-browser-dynamic": "^15.2.9",
77+
"@angular/router": "^15.2.9",
78+
"@ngrx/effects": "^15.4.0",
79+
"@ngrx/store": "^15.4.0",
8080
"@polymer/decorators": "^3.0.0",
8181
"@polymer/iron-behaviors": "^3.0.1",
8282
"@polymer/iron-collapse": "^3.0.1",

tensorboard/plugins/debugger_v2/tf_debugger_v2_plugin/views/timeline/timeline_module.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ limitations under the License.
1515

1616
import {CommonModule} from '@angular/common';
1717
import {NgModule} from '@angular/core';
18-
import {MatButtonModule} from '@angular/material/button';
19-
import {MatSliderModule} from '@angular/material/slider';
18+
import {MatLegacyButtonModule} from '@angular/material/legacy-button';
19+
import {MatLegacySliderModule} from '@angular/material/legacy-slider';
2020
import {ExecutionDataModule} from '../execution_data/execution_data_module';
2121
import {TimelineComponent} from './timeline_component';
2222
import {TimelineContainer} from './timeline_container';
@@ -26,8 +26,8 @@ import {TimelineContainer} from './timeline_container';
2626
imports: [
2727
CommonModule,
2828
ExecutionDataModule,
29-
MatButtonModule,
30-
MatSliderModule,
29+
MatLegacyButtonModule,
30+
MatLegacySliderModule,
3131
],
3232
// TODO(cais): The following two providers are meant to make the mat-slider
3333
// dragging to work. But the dragging is still not working, needs more

tensorboard/webapp/alert/views/alert_display_snackbar_container.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515
import {ChangeDetectionStrategy, Component, Inject} from '@angular/core';
16-
import {MatSnackBarRef, MAT_SNACK_BAR_DATA} from '@angular/material/snack-bar';
16+
import {
17+
MatLegacySnackBarRef,
18+
MAT_LEGACY_SNACK_BAR_DATA,
19+
} from '@angular/material/legacy-snack-bar';
1720
import {Store} from '@ngrx/store';
1821
import {State} from '../../app_state';
1922
import {splitByURL} from '../../util/string';
@@ -30,8 +33,8 @@ export class AlertDisplaySnackbarContainer {
3033
readonly splitByURL = splitByURL;
3134

3235
constructor(
33-
private readonly snackBarRef: MatSnackBarRef<AlertDisplaySnackbarContainer>,
34-
@Inject(MAT_SNACK_BAR_DATA) readonly unknownData: unknown,
36+
private readonly snackBarRef: MatLegacySnackBarRef<AlertDisplaySnackbarContainer>,
37+
@Inject(MAT_LEGACY_SNACK_BAR_DATA) readonly unknownData: unknown,
3538
private readonly store: Store<State>
3639
) {
3740
this.alert = unknownData as AlertInfo;

tensorboard/webapp/alert/views/alert_snackbar_container.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
OnDestroy,
1919
OnInit,
2020
} from '@angular/core';
21-
import {MatSnackBar} from '@angular/material/snack-bar';
21+
import {MatLegacySnackBar} from '@angular/material/legacy-snack-bar';
2222
import {Store} from '@ngrx/store';
2323
import {Subject} from 'rxjs';
2424
import {filter, takeUntil} from 'rxjs/operators';
@@ -40,7 +40,7 @@ export class AlertSnackbarContainer implements OnInit, OnDestroy {
4040

4141
constructor(
4242
private readonly store: Store<State>,
43-
private readonly snackBar: MatSnackBar
43+
private readonly snackBar: MatLegacySnackBar
4444
) {}
4545

4646
ngOnInit() {

tensorboard/webapp/alert/views/alert_snackbar_module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ limitations under the License.
1414
==============================================================================*/
1515
import {CommonModule} from '@angular/common';
1616
import {NgModule} from '@angular/core';
17-
import {MatButtonModule} from '@angular/material/button';
18-
import {MatSnackBarModule} from '@angular/material/snack-bar';
17+
import {MatLegacyButtonModule} from '@angular/material/legacy-button';
18+
import {MatLegacySnackBarModule} from '@angular/material/legacy-snack-bar';
1919
import {AlertDisplaySnackbarContainer} from './alert_display_snackbar_container';
2020
import {AlertSnackbarContainer} from './alert_snackbar_container';
2121

@@ -25,7 +25,7 @@ import {AlertSnackbarContainer} from './alert_snackbar_container';
2525
@NgModule({
2626
declarations: [AlertSnackbarContainer, AlertDisplaySnackbarContainer],
2727
exports: [AlertSnackbarContainer],
28-
imports: [CommonModule, MatButtonModule, MatSnackBarModule],
28+
imports: [CommonModule, MatLegacyButtonModule, MatLegacySnackBarModule],
2929
entryComponents: [
3030
// Required for non-Ivy Angular apps.
3131
AlertDisplaySnackbarContainer,

tensorboard/webapp/alert/views/alert_snackbar_test.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ limitations under the License.
1414
==============================================================================*/
1515
import {OverlayContainer} from '@angular/cdk/overlay';
1616
import {TestBed} from '@angular/core/testing';
17-
import {MatButtonModule} from '@angular/material/button';
18-
import {MatSnackBar, MatSnackBarModule} from '@angular/material/snack-bar';
17+
import {MatLegacyButtonModule} from '@angular/material/legacy-button';
18+
import {
19+
MatLegacySnackBar,
20+
MatLegacySnackBarModule,
21+
} from '@angular/material/legacy-snack-bar';
1922
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
2023
import {Action, createAction, props, Store} from '@ngrx/store';
2124
import {MockStore, provideMockStore} from '@ngrx/store/testing';
@@ -42,11 +45,15 @@ describe('alert snackbar', () => {
4245
let snackBarOpenSpy: jasmine.Spy;
4346
let recordedActions: Action[] = [];
4447
let overlayContainer: OverlayContainer;
45-
let snackbar: MatSnackBar;
48+
let snackbar: MatLegacySnackBar;
4649

4750
beforeEach(async () => {
4851
await TestBed.configureTestingModule({
49-
imports: [NoopAnimationsModule, MatButtonModule, MatSnackBarModule],
52+
imports: [
53+
NoopAnimationsModule,
54+
MatLegacyButtonModule,
55+
MatLegacySnackBarModule,
56+
],
5057
providers: [
5158
provideMockStore({
5259
initialState: buildStateFromAlertState(buildAlertState({})),
@@ -60,7 +67,7 @@ describe('alert snackbar', () => {
6067
recordedActions.push(action);
6168
});
6269
overlayContainer = TestBed.inject(OverlayContainer);
63-
snackbar = TestBed.inject(MatSnackBar);
70+
snackbar = TestBed.inject(MatLegacySnackBar);
6471
snackBarOpenSpy = spyOn(snackbar, 'openFromComponent').and.callThrough();
6572
});
6673

tensorboard/webapp/core/views/layout_module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ limitations under the License.
1414
==============================================================================*/
1515
import {CommonModule} from '@angular/common';
1616
import {NgModule} from '@angular/core';
17-
import {MatButtonModule} from '@angular/material/button';
17+
import {MatLegacyButtonModule} from '@angular/material/legacy-button';
1818
import {MatIconModule} from '@angular/material/icon';
1919
import {LayoutContainer} from './layout_container';
2020

@@ -24,6 +24,6 @@ import {LayoutContainer} from './layout_container';
2424
@NgModule({
2525
declarations: [LayoutContainer],
2626
exports: [LayoutContainer],
27-
imports: [CommonModule, MatIconModule, MatButtonModule],
27+
imports: [CommonModule, MatIconModule, MatLegacyButtonModule],
2828
})
2929
export class LayoutModule {}

tensorboard/webapp/feature_flag/views/feature_flag_dialog_module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ limitations under the License.
1414
==============================================================================*/
1515
import {CommonModule} from '@angular/common';
1616
import {NgModule} from '@angular/core';
17-
import {MatButtonModule} from '@angular/material/button';
18-
import {MatSelectModule} from '@angular/material/select';
17+
import {MatLegacyButtonModule} from '@angular/material/legacy-button';
18+
import {MatLegacySelectModule} from '@angular/material/legacy-select';
1919
import {FeatureFlagDialogComponent} from './feature_flag_dialog_component';
2020
import {FeatureFlagDialogContainer} from './feature_flag_dialog_container';
2121

@@ -24,7 +24,7 @@ import {FeatureFlagDialogContainer} from './feature_flag_dialog_container';
2424
*/
2525
@NgModule({
2626
declarations: [FeatureFlagDialogComponent, FeatureFlagDialogContainer],
27-
imports: [CommonModule, MatButtonModule, MatSelectModule],
27+
imports: [CommonModule, MatLegacyButtonModule, MatLegacySelectModule],
2828
exports: [FeatureFlagDialogContainer],
2929
entryComponents: [FeatureFlagDialogContainer],
3030
})

tensorboard/webapp/feature_flag/views/feature_flag_modal_trigger_container.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ limitations under the License.
1414
==============================================================================*/
1515
import {ComponentType} from '@angular/cdk/overlay';
1616
import {Component, OnDestroy, OnInit} from '@angular/core';
17-
import {MatDialog, MatDialogRef} from '@angular/material/dialog';
17+
import {
18+
MatLegacyDialog,
19+
MatLegacyDialogRef,
20+
} from '@angular/material/legacy-dialog';
1821
import {Store} from '@ngrx/store';
1922
import {Subject} from 'rxjs';
2023
import {takeUntil} from 'rxjs/operators';
@@ -39,12 +42,12 @@ export class FeatureFlagModalTriggerContainer implements OnInit, OnDestroy {
3942
featureFlagDialogType: ComponentType<any> = FeatureFlagDialogContainer;
4043

4144
readonly showFeatureFlags$ = this.store.select(getShowFlagsEnabled);
42-
private featureFlagsDialog?: MatDialogRef<FeatureFlagDialogContainer>;
45+
private featureFlagsDialog?: MatLegacyDialogRef<FeatureFlagDialogContainer>;
4346
private ngUnsubscribe = new Subject<void>();
4447

4548
constructor(
4649
private readonly store: Store<State>,
47-
private dialog: MatDialog
50+
private dialog: MatLegacyDialog
4851
) {}
4952

5053
ngOnInit() {

tensorboard/webapp/feature_flag/views/feature_flag_modal_trigger_container_test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import {HarnessLoader} from '@angular/cdk/testing';
1616
import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed';
1717
import {Component} from '@angular/core';
1818
import {ComponentFixture, TestBed} from '@angular/core/testing';
19-
import {MatDialogModule} from '@angular/material/dialog';
20-
import {MatDialogHarness} from '@angular/material/dialog/testing';
19+
import {MatLegacyDialogModule} from '@angular/material/legacy-dialog';
20+
import {MatLegacyDialogHarness} from '@angular/material/legacy-dialog/testing';
2121
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
2222
import {Store} from '@ngrx/store';
2323
import {MockStore} from '@ngrx/store/testing';
@@ -47,7 +47,7 @@ describe('feature_flag_modal_trigger_container', () => {
4747

4848
beforeEach(async () => {
4949
await TestBed.configureTestingModule({
50-
imports: [MatDialogModule, NoopAnimationsModule],
50+
imports: [MatLegacyDialogModule, NoopAnimationsModule],
5151
providers: [provideMockTbStore()],
5252
}).compileComponents();
5353

@@ -78,7 +78,7 @@ describe('feature_flag_modal_trigger_container', () => {
7878
store.overrideSelector(getOverriddenFeatureFlags, {});
7979
store.overrideSelector(getShowFlagsEnabled, true);
8080
createComponent();
81-
const dialog = await rootLoader.getHarness(MatDialogHarness);
81+
const dialog = await rootLoader.getHarness(MatLegacyDialogHarness);
8282
expect(
8383
(fixture.componentInstance as any).featureFlagsDialog
8484
).not.toBeUndefined();

0 commit comments

Comments
 (0)