From 00071f1f1ec9bd985b678174d3e9165b1b6c0109 Mon Sep 17 00:00:00 2001 From: Daniel Idem Date: Tue, 13 Aug 2024 08:22:15 +0100 Subject: [PATCH] Replaced the usage of alert() with navigation service --- apps/client/src/app/app.component.ts | 7 +++---- .../accounts-table/accounts-table.component.ts | 3 +-- .../app/components/admin-jobs/admin-jobs.component.ts | 10 ++++------ .../admin-market-data/admin-market-data.service.ts | 3 +-- .../asset-profile-dialog.component.ts | 10 ++++------ .../admin-overview/admin-overview.component.ts | 3 +-- .../src/app/components/header/header.component.ts | 7 +++---- .../create-or-update-access-dialog.component.ts | 3 +-- .../user-account-membership.component.ts | 7 +++---- .../user-account-settings.component.ts | 7 +++---- .../src/app/pages/accounts/accounts-page.component.ts | 7 +++---- apps/client/src/app/pages/demo/demo-page.component.ts | 7 +++---- .../src/app/pages/pricing/pricing-page.component.ts | 7 +++---- .../lib/activities-table/activities-table.component.ts | 7 +++---- package-lock.json | 4 ++-- 15 files changed, 38 insertions(+), 54 deletions(-) diff --git a/apps/client/src/app/app.component.ts b/apps/client/src/app/app.component.ts index 9e8c99ee6..fbc358590 100644 --- a/apps/client/src/app/app.component.ts +++ b/apps/client/src/app/app.component.ts @@ -82,12 +82,12 @@ export class AppComponent implements OnDestroy, OnInit { private dialog: MatDialog, @Inject(DOCUMENT) private document: Document, private impersonationStorageService: ImpersonationStorageService, + private notificationService: NotificationService, private route: ActivatedRoute, private router: Router, private title: Title, private tokenStorageService: TokenStorageService, - private userService: UserService, - private notificationService: NotificationService + private userService: UserService ) { this.initializeTheme(); this.user = undefined; @@ -202,8 +202,7 @@ export class AppComponent implements OnDestroy, OnInit { this.router.navigate(this.user.systemMessage.routerLink); } else { this.notificationService.alert({ - title: '', - message: this.user.systemMessage.message + title: this.user.systemMessage.message }); } } diff --git a/apps/client/src/app/components/accounts-table/accounts-table.component.ts b/apps/client/src/app/components/accounts-table/accounts-table.component.ts index e49cfa180..ff0358baa 100644 --- a/apps/client/src/app/components/accounts-table/accounts-table.component.ts +++ b/apps/client/src/app/components/accounts-table/accounts-table.component.ts @@ -121,8 +121,7 @@ export class AccountsTableComponent implements OnChanges, OnDestroy, OnInit { public onOpenComment(aComment: string) { this.notificationService.alert({ - title: '', - message: aComment + title: aComment }); } diff --git a/apps/client/src/app/components/admin-jobs/admin-jobs.component.ts b/apps/client/src/app/components/admin-jobs/admin-jobs.component.ts index 77dee044d..820b3651d 100644 --- a/apps/client/src/app/components/admin-jobs/admin-jobs.component.ts +++ b/apps/client/src/app/components/admin-jobs/admin-jobs.component.ts @@ -60,8 +60,8 @@ export class AdminJobsComponent implements OnDestroy, OnInit { private adminService: AdminService, private changeDetectorRef: ChangeDetectorRef, private formBuilder: FormBuilder, - private userService: UserService, - private notificationService: NotificationService + private notificationService: NotificationService, + private userService: UserService ) { this.userService.stateChanged .pipe(takeUntil(this.unsubscribeSubject)) @@ -122,15 +122,13 @@ export class AdminJobsComponent implements OnDestroy, OnInit { public onViewData(aData: AdminJobs['jobs'][0]['data']) { this.notificationService.alert({ - title: '', - message: JSON.stringify(aData, null, ' ') + title: JSON.stringify(aData, null, ' ') }); } public onViewStacktrace(aStacktrace: AdminJobs['jobs'][0]['stacktrace']) { this.notificationService.alert({ - title: '', - message: JSON.stringify(aStacktrace, null, ' ') + title: JSON.stringify(aStacktrace, null, ' ') }); } diff --git a/apps/client/src/app/components/admin-market-data/admin-market-data.service.ts b/apps/client/src/app/components/admin-market-data/admin-market-data.service.ts index 7a92ccb6a..a7fe0b6a2 100644 --- a/apps/client/src/app/components/admin-market-data/admin-market-data.service.ts +++ b/apps/client/src/app/components/admin-market-data/admin-market-data.service.ts @@ -51,8 +51,7 @@ export class AdminMarketDataService { .pipe( catchError(() => { this.notificationService.alert({ - title: '', - message: $localize`Oops! Could not delete profiles.` + title: $localize`Oops! Could not delete profiles.` }); return EMPTY; diff --git a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts index 7297dd895..5f483d13f 100644 --- a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts +++ b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts @@ -95,8 +95,8 @@ export class AssetProfileDialog implements OnDestroy, OnInit { private dataService: DataService, public dialogRef: MatDialogRef, private formBuilder: FormBuilder, - private snackBar: MatSnackBar, - private notificationService: NotificationService + private notificationService: NotificationService, + private snackBar: MatSnackBar ) {} public ngOnInit() { @@ -332,8 +332,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { .pipe( catchError(({ error }) => { this.notificationService.alert({ - title: '', - message: `Error: ${error?.message}` + title: `Error: ${error?.message}` }); return EMPTY; }), @@ -341,8 +340,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { ) .subscribe(({ price }) => { this.notificationService.alert({ - title: '', - message: + title: $localize`The current market price is` + ' ' + price + diff --git a/apps/client/src/app/components/admin-overview/admin-overview.component.ts b/apps/client/src/app/components/admin-overview/admin-overview.component.ts index 043117685..3da170424 100644 --- a/apps/client/src/app/components/admin-overview/admin-overview.component.ts +++ b/apps/client/src/app/components/admin-overview/admin-overview.component.ts @@ -129,8 +129,7 @@ export class AdminOverviewComponent implements OnDestroy, OnInit { this.putAdminSetting({ key: PROPERTY_CURRENCIES, value: currencies }); } else { this.notificationService.alert({ - title: '', - message: $localize`${currency} is an invalid currency!` + title: $localize`${currency} is an invalid currency!` }); } } diff --git a/apps/client/src/app/components/header/header.component.ts b/apps/client/src/app/components/header/header.component.ts index 0c5741498..7d740ce5b 100644 --- a/apps/client/src/app/components/header/header.component.ts +++ b/apps/client/src/app/components/header/header.component.ts @@ -94,11 +94,11 @@ export class HeaderComponent implements OnChanges { private dialog: MatDialog, private impersonationStorageService: ImpersonationStorageService, private layoutService: LayoutService, + private notificationService: NotificationService, private router: Router, private settingsStorageService: SettingsStorageService, private tokenStorageService: TokenStorageService, - private userService: UserService, - private notificationService: NotificationService + private userService: UserService ) { this.impersonationStorageService .onChangeHasImpersonation() @@ -243,8 +243,7 @@ export class HeaderComponent implements OnChanges { .pipe( catchError(() => { this.notificationService.alert({ - title: 'Wrong', - message: $localize`Oops! Incorrect Security Token.` + title: $localize`Oops! Incorrect Security Token.` }); return EMPTY; diff --git a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts index 90902b4bc..dd755a8b9 100644 --- a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts +++ b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts @@ -88,8 +88,7 @@ export class CreateOrUpdateAccessDialog implements OnDestroy { catchError((error) => { if (error.status === StatusCodes.BAD_REQUEST) { this.notificationService.alert({ - title: 'Bad Request', - message: $localize`Oops! Could not grant access.` + title: $localize`Oops! Could not grant access.` }); } diff --git a/apps/client/src/app/components/user-account-membership/user-account-membership.component.ts b/apps/client/src/app/components/user-account-membership/user-account-membership.component.ts index 44992fd04..0ad426e03 100644 --- a/apps/client/src/app/components/user-account-membership/user-account-membership.component.ts +++ b/apps/client/src/app/components/user-account-membership/user-account-membership.component.ts @@ -47,10 +47,10 @@ export class UserAccountMembershipComponent implements OnDestroy, OnInit { public constructor( private changeDetectorRef: ChangeDetectorRef, private dataService: DataService, + private notificationService: NotificationService, private snackBar: MatSnackBar, private stripeService: StripeService, - private userService: UserService, - private notificationService: NotificationService + private userService: UserService ) { const { baseCurrency, globalPermissions, subscriptions } = this.dataService.fetchInfo(); @@ -99,8 +99,7 @@ export class UserAccountMembershipComponent implements OnDestroy, OnInit { }), catchError((error) => { this.notificationService.alert({ - title: '', - message: error + title: error }); throw error; }) diff --git a/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts b/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts index 439de2ab3..02019a220 100644 --- a/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts +++ b/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts @@ -70,12 +70,12 @@ export class UserAccountSettingsComponent implements OnDestroy, OnInit { private changeDetectorRef: ChangeDetectorRef, private dataService: DataService, private formBuilder: FormBuilder, + private notificationService: NotificationService, private settingsStorageService: SettingsStorageService, private snackBar: MatSnackBar, private tokenStorageService: TokenStorageService, private userService: UserService, - public webAuthnService: WebAuthnService, - private notificationService: NotificationService + public webAuthnService: WebAuthnService ) { const { baseCurrency, currencies } = this.dataService.fetchInfo(); @@ -158,8 +158,7 @@ export class UserAccountSettingsComponent implements OnDestroy, OnInit { .pipe( catchError(() => { this.notificationService.alert({ - title: '', - message: $localize`Oops! Incorrect Security Token.` + title: $localize`Oops! Incorrect Security Token.` }); return EMPTY; diff --git a/apps/client/src/app/pages/accounts/accounts-page.component.ts b/apps/client/src/app/pages/accounts/accounts-page.component.ts index d88389a46..3f1ed9efe 100644 --- a/apps/client/src/app/pages/accounts/accounts-page.component.ts +++ b/apps/client/src/app/pages/accounts/accounts-page.component.ts @@ -47,10 +47,10 @@ export class AccountsPageComponent implements OnDestroy, OnInit { private deviceService: DeviceDetectorService, private dialog: MatDialog, private impersonationStorageService: ImpersonationStorageService, + private notificationService: NotificationService, private route: ActivatedRoute, private router: Router, - private userService: UserService, - private notificationService: NotificationService + private userService: UserService ) { this.route.queryParams .pipe(takeUntil(this.unsubscribeSubject)) @@ -308,8 +308,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit { .pipe( catchError(() => { this.notificationService.alert({ - title: '', - message: $localize`Oops, cash balance transfer has failed.` + title: $localize`Oops, cash balance transfer has failed.` }); return EMPTY; diff --git a/apps/client/src/app/pages/demo/demo-page.component.ts b/apps/client/src/app/pages/demo/demo-page.component.ts index 6b151e3f6..a390fce9f 100644 --- a/apps/client/src/app/pages/demo/demo-page.component.ts +++ b/apps/client/src/app/pages/demo/demo-page.component.ts @@ -21,8 +21,8 @@ export class GfDemoPageComponent implements OnDestroy { public constructor( private dataService: DataService, private router: Router, - private tokenStorageService: TokenStorageService, - private notificationService: NotificationService + private notificationService: NotificationService, + private tokenStorageService: TokenStorageService ) { this.info = this.dataService.fetchInfo(); } @@ -32,8 +32,7 @@ export class GfDemoPageComponent implements OnDestroy { if (hasToken) { this.notificationService.alert({ - title: '', - message: $localize`As you are already logged in, you cannot access the demo account.` + title: $localize`As you are already logged in, you cannot access the demo account.` }); } else { this.tokenStorageService.saveToken(this.info.demoAuthToken, true); diff --git a/apps/client/src/app/pages/pricing/pricing-page.component.ts b/apps/client/src/app/pages/pricing/pricing-page.component.ts index dd6e2f0bf..325642ca1 100644 --- a/apps/client/src/app/pages/pricing/pricing-page.component.ts +++ b/apps/client/src/app/pages/pricing/pricing-page.component.ts @@ -42,9 +42,9 @@ export class PricingPageComponent implements OnDestroy, OnInit { public constructor( private changeDetectorRef: ChangeDetectorRef, private dataService: DataService, + private notificationService: NotificationService, private stripeService: StripeService, - private userService: UserService, - private notificationService: NotificationService + private userService: UserService ) {} public ngOnInit() { @@ -85,8 +85,7 @@ export class PricingPageComponent implements OnDestroy, OnInit { }), catchError((error) => { this.notificationService.alert({ - title: '', - message: error + title: error }); throw error; }) diff --git a/libs/ui/src/lib/activities-table/activities-table.component.ts b/libs/ui/src/lib/activities-table/activities-table.component.ts index 9446d9be9..61fbdad82 100644 --- a/libs/ui/src/lib/activities-table/activities-table.component.ts +++ b/libs/ui/src/lib/activities-table/activities-table.component.ts @@ -122,8 +122,8 @@ export class GfActivitiesTableComponent private unsubscribeSubject = new Subject(); public constructor( - private router: Router, - private notificationService: NotificationService + private notificationService: NotificationService, + private router: Router ) {} public ngOnInit() { @@ -265,8 +265,7 @@ export class GfActivitiesTableComponent public onOpenComment(aComment: string) { this.notificationService.alert({ - title: '', - message: aComment + title: aComment }); } diff --git a/package-lock.json b/package-lock.json index d70b8744f..49eadc623 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ghostfolio", - "version": "2.103.0", + "version": "2.101.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ghostfolio", - "version": "2.103.0", + "version": "2.101.0", "hasInstallScript": true, "license": "AGPL-3.0", "dependencies": {