diff --git a/tensorboard/webapp/alert/effects/index.ts b/tensorboard/webapp/alert/effects/index.ts index 8e924fdfa6..4a4b4940ad 100644 --- a/tensorboard/webapp/alert/effects/index.ts +++ b/tensorboard/webapp/alert/effects/index.ts @@ -12,7 +12,7 @@ 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 {Injectable} from '@angular/core'; +import {Injectable, inject} from '@angular/core'; import {Actions, createEffect} from '@ngrx/effects'; import {Store} from '@ngrx/store'; import {tap} from 'rxjs/operators'; @@ -22,11 +22,9 @@ import {AlertActionModule} from '../alert_action_module'; @Injectable() export class AlertEffects { - constructor( - private readonly actions$: Actions, - private readonly store: Store, - private readonly alertActionModule: AlertActionModule - ) {} + private readonly actions$ = inject(Actions); + private readonly store: Store = inject(Store); + private readonly alertActionModule = inject(AlertActionModule); /** @export */ reportRegisteredActionAlerts$ = createEffect( diff --git a/tensorboard/webapp/feature_flag/effects/feature_flag_effects.ts b/tensorboard/webapp/feature_flag/effects/feature_flag_effects.ts index af68bd69e1..61d07290c8 100644 --- a/tensorboard/webapp/feature_flag/effects/feature_flag_effects.ts +++ b/tensorboard/webapp/feature_flag/effects/feature_flag_effects.ts @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -import {Injectable} from '@angular/core'; +import {inject, Injectable} from '@angular/core'; import {Actions, createEffect, ofType} from '@ngrx/effects'; import {Action, createAction, Store} from '@ngrx/store'; import {combineLatestWith, map, tap, withLatestFrom} from 'rxjs/operators'; @@ -37,6 +37,10 @@ const effectsInitialized = createAction('[FEATURE FLAG] Effects Init'); @Injectable() export class FeatureFlagEffects { + private readonly actions$ = inject(Actions); + private readonly store: Store = inject(Store); + private readonly dataSource = inject(TBFeatureFlagDataSource); + // Ngrx assumes all Effect classes have properties that inherit from the base // JS Object. `tf_feature_flags` does not, so we wrap it. private readonly tfFeatureFlags = { @@ -128,12 +132,6 @@ export class FeatureFlagEffects { {dispatch: false} ); - constructor( - private readonly actions$: Actions, - private readonly store: Store, - private readonly dataSource: TBFeatureFlagDataSource - ) {} - /** @export */ ngrxOnInitEffects(): Action { return effectsInitialized(); diff --git a/tensorboard/webapp/notification_center/_redux/notification_center_effects.ts b/tensorboard/webapp/notification_center/_redux/notification_center_effects.ts index 7d545ab060..56157a6092 100644 --- a/tensorboard/webapp/notification_center/_redux/notification_center_effects.ts +++ b/tensorboard/webapp/notification_center/_redux/notification_center_effects.ts @@ -12,7 +12,7 @@ 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 {Injectable} from '@angular/core'; +import {Injectable, inject} from '@angular/core'; import {Actions, createEffect, ofType, OnInitEffects} from '@ngrx/effects'; import {Action, createAction, Store} from '@ngrx/store'; import {EMPTY, Observable} from 'rxjs'; @@ -26,11 +26,9 @@ export const initAction = createAction('[NotificationCenter Effects] Init'); @Injectable() export class NotificationCenterEffects implements OnInitEffects { - constructor( - private readonly actions$: Actions, - private readonly store: Store, - private readonly dataSource: NotificationCenterDataSource - ) {} + private readonly actions$ = inject(Actions); + private readonly store: Store = inject(Store); + private readonly dataSource = inject(NotificationCenterDataSource); /** @export */ ngrxOnInitEffects(): Action { diff --git a/tensorboard/webapp/persistent_settings/_redux/persistent_settings_effects.ts b/tensorboard/webapp/persistent_settings/_redux/persistent_settings_effects.ts index 626b425963..ea958ec758 100644 --- a/tensorboard/webapp/persistent_settings/_redux/persistent_settings_effects.ts +++ b/tensorboard/webapp/persistent_settings/_redux/persistent_settings_effects.ts @@ -12,7 +12,7 @@ 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 {Injectable} from '@angular/core'; +import {Injectable, inject} from '@angular/core'; import {Actions, createEffect, ofType} from '@ngrx/effects'; import {Store} from '@ngrx/store'; import {EMPTY, Observable, merge} from 'rxjs'; @@ -45,6 +45,15 @@ const DEBOUNCE_PERIOD_IN_MS = 500; */ @Injectable() export class PersistentSettingsEffects { + private readonly actions$: Actions = inject(Actions); + private readonly store: Store<{}> = inject(Store); + private readonly configModule: PersistentSettingsConfigModule< + {}, + PersistableSettings + > = inject(PersistentSettingsConfigModule); + private readonly dataSource: PersistentSettingsDataSource = + inject(PersistentSettingsDataSource); + /** @export */ readonly initializeAndUpdateSettings$: Observable = createEffect( () => { @@ -109,16 +118,6 @@ export class PersistentSettingsEffects { }, {dispatch: false} ); - - constructor( - private readonly actions$: Actions, - private readonly store: Store<{}>, - private readonly configModule: PersistentSettingsConfigModule< - {}, - PersistableSettings - >, - private readonly dataSource: PersistentSettingsDataSource - ) {} } export const TEST_ONLY = {DEBOUNCE_PERIOD_IN_MS}; diff --git a/tensorboard/webapp/runs/views/runs_table/regex_edit_dialog_container.ts b/tensorboard/webapp/runs/views/runs_table/regex_edit_dialog_container.ts index 17e36c402f..eb267417c7 100644 --- a/tensorboard/webapp/runs/views/runs_table/regex_edit_dialog_container.ts +++ b/tensorboard/webapp/runs/views/runs_table/regex_edit_dialog_container.ts @@ -12,7 +12,7 @@ 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 {Component, Inject} from '@angular/core'; +import {Component, inject} from '@angular/core'; import {MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; import {Store} from '@ngrx/store'; import {combineLatest, defer, merge, Observable, Subject} from 'rxjs'; @@ -69,6 +69,9 @@ const INPUT_CHANGE_DEBOUNCE_INTERVAL_MS = 500; ], }) export class RegexEditDialogContainer { + private readonly store = inject>(Store); + dialogRef = inject>(MatDialogRef); + private readonly experimentIds: string[]; private readonly runIdToEid$: Observable>; private readonly allRuns$: Observable; @@ -152,14 +155,11 @@ export class RegexEditDialogContainer { ); }).pipe(startWith([])); - constructor( - private readonly store: Store, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) - data: { + constructor() { + const data = inject<{ experimentIds: string[]; - } - ) { + }>(MAT_DIALOG_DATA); + this.expNameByExpId$ = this.store.select(getDashboardExperimentNames); this.enableColorByExperiment$ = this.store.select( getEnableColorByExperiment