Browse Source

Replaced the usage of alert() with navigation service

pull/3670/head
Daniel Idem 1 year ago
parent
commit
00071f1f1e
  1. 7
      apps/client/src/app/app.component.ts
  2. 3
      apps/client/src/app/components/accounts-table/accounts-table.component.ts
  3. 10
      apps/client/src/app/components/admin-jobs/admin-jobs.component.ts
  4. 3
      apps/client/src/app/components/admin-market-data/admin-market-data.service.ts
  5. 10
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
  6. 3
      apps/client/src/app/components/admin-overview/admin-overview.component.ts
  7. 7
      apps/client/src/app/components/header/header.component.ts
  8. 3
      apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts
  9. 7
      apps/client/src/app/components/user-account-membership/user-account-membership.component.ts
  10. 7
      apps/client/src/app/components/user-account-settings/user-account-settings.component.ts
  11. 7
      apps/client/src/app/pages/accounts/accounts-page.component.ts
  12. 7
      apps/client/src/app/pages/demo/demo-page.component.ts
  13. 7
      apps/client/src/app/pages/pricing/pricing-page.component.ts
  14. 7
      libs/ui/src/lib/activities-table/activities-table.component.ts
  15. 4
      package-lock.json

7
apps/client/src/app/app.component.ts

@ -82,12 +82,12 @@ export class AppComponent implements OnDestroy, OnInit {
private dialog: MatDialog, private dialog: MatDialog,
@Inject(DOCUMENT) private document: Document, @Inject(DOCUMENT) private document: Document,
private impersonationStorageService: ImpersonationStorageService, private impersonationStorageService: ImpersonationStorageService,
private notificationService: NotificationService,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private title: Title, private title: Title,
private tokenStorageService: TokenStorageService, private tokenStorageService: TokenStorageService,
private userService: UserService, private userService: UserService
private notificationService: NotificationService
) { ) {
this.initializeTheme(); this.initializeTheme();
this.user = undefined; this.user = undefined;
@ -202,8 +202,7 @@ export class AppComponent implements OnDestroy, OnInit {
this.router.navigate(this.user.systemMessage.routerLink); this.router.navigate(this.user.systemMessage.routerLink);
} else { } else {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: this.user.systemMessage.message
message: this.user.systemMessage.message
}); });
} }
} }

3
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) { public onOpenComment(aComment: string) {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: aComment
message: aComment
}); });
} }

10
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 adminService: AdminService,
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private userService: UserService, private notificationService: NotificationService,
private notificationService: NotificationService private userService: UserService
) { ) {
this.userService.stateChanged this.userService.stateChanged
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
@ -122,15 +122,13 @@ export class AdminJobsComponent implements OnDestroy, OnInit {
public onViewData(aData: AdminJobs['jobs'][0]['data']) { public onViewData(aData: AdminJobs['jobs'][0]['data']) {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: JSON.stringify(aData, null, ' ')
message: JSON.stringify(aData, null, ' ')
}); });
} }
public onViewStacktrace(aStacktrace: AdminJobs['jobs'][0]['stacktrace']) { public onViewStacktrace(aStacktrace: AdminJobs['jobs'][0]['stacktrace']) {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: JSON.stringify(aStacktrace, null, ' ')
message: JSON.stringify(aStacktrace, null, ' ')
}); });
} }

3
apps/client/src/app/components/admin-market-data/admin-market-data.service.ts

@ -51,8 +51,7 @@ export class AdminMarketDataService {
.pipe( .pipe(
catchError(() => { catchError(() => {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: $localize`Oops! Could not delete profiles.`
message: $localize`Oops! Could not delete profiles.`
}); });
return EMPTY; return EMPTY;

10
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, private dataService: DataService,
public dialogRef: MatDialogRef<AssetProfileDialog>, public dialogRef: MatDialogRef<AssetProfileDialog>,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private snackBar: MatSnackBar, private notificationService: NotificationService,
private notificationService: NotificationService private snackBar: MatSnackBar
) {} ) {}
public ngOnInit() { public ngOnInit() {
@ -332,8 +332,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
.pipe( .pipe(
catchError(({ error }) => { catchError(({ error }) => {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: `Error: ${error?.message}`
message: `Error: ${error?.message}`
}); });
return EMPTY; return EMPTY;
}), }),
@ -341,8 +340,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
) )
.subscribe(({ price }) => { .subscribe(({ price }) => {
this.notificationService.alert({ this.notificationService.alert({
title: '', title:
message:
$localize`The current market price is` + $localize`The current market price is` +
' ' + ' ' +
price + price +

3
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 }); this.putAdminSetting({ key: PROPERTY_CURRENCIES, value: currencies });
} else { } else {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: $localize`${currency} is an invalid currency!`
message: $localize`${currency} is an invalid currency!`
}); });
} }
} }

7
apps/client/src/app/components/header/header.component.ts

@ -94,11 +94,11 @@ export class HeaderComponent implements OnChanges {
private dialog: MatDialog, private dialog: MatDialog,
private impersonationStorageService: ImpersonationStorageService, private impersonationStorageService: ImpersonationStorageService,
private layoutService: LayoutService, private layoutService: LayoutService,
private notificationService: NotificationService,
private router: Router, private router: Router,
private settingsStorageService: SettingsStorageService, private settingsStorageService: SettingsStorageService,
private tokenStorageService: TokenStorageService, private tokenStorageService: TokenStorageService,
private userService: UserService, private userService: UserService
private notificationService: NotificationService
) { ) {
this.impersonationStorageService this.impersonationStorageService
.onChangeHasImpersonation() .onChangeHasImpersonation()
@ -243,8 +243,7 @@ export class HeaderComponent implements OnChanges {
.pipe( .pipe(
catchError(() => { catchError(() => {
this.notificationService.alert({ this.notificationService.alert({
title: 'Wrong', title: $localize`Oops! Incorrect Security Token.`
message: $localize`Oops! Incorrect Security Token.`
}); });
return EMPTY; return EMPTY;

3
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) => { catchError((error) => {
if (error.status === StatusCodes.BAD_REQUEST) { if (error.status === StatusCodes.BAD_REQUEST) {
this.notificationService.alert({ this.notificationService.alert({
title: 'Bad Request', title: $localize`Oops! Could not grant access.`
message: $localize`Oops! Could not grant access.`
}); });
} }

7
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( public constructor(
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService, private dataService: DataService,
private notificationService: NotificationService,
private snackBar: MatSnackBar, private snackBar: MatSnackBar,
private stripeService: StripeService, private stripeService: StripeService,
private userService: UserService, private userService: UserService
private notificationService: NotificationService
) { ) {
const { baseCurrency, globalPermissions, subscriptions } = const { baseCurrency, globalPermissions, subscriptions } =
this.dataService.fetchInfo(); this.dataService.fetchInfo();
@ -99,8 +99,7 @@ export class UserAccountMembershipComponent implements OnDestroy, OnInit {
}), }),
catchError((error) => { catchError((error) => {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: error
message: error
}); });
throw error; throw error;
}) })

7
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 changeDetectorRef: ChangeDetectorRef,
private dataService: DataService, private dataService: DataService,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private notificationService: NotificationService,
private settingsStorageService: SettingsStorageService, private settingsStorageService: SettingsStorageService,
private snackBar: MatSnackBar, private snackBar: MatSnackBar,
private tokenStorageService: TokenStorageService, private tokenStorageService: TokenStorageService,
private userService: UserService, private userService: UserService,
public webAuthnService: WebAuthnService, public webAuthnService: WebAuthnService
private notificationService: NotificationService
) { ) {
const { baseCurrency, currencies } = this.dataService.fetchInfo(); const { baseCurrency, currencies } = this.dataService.fetchInfo();
@ -158,8 +158,7 @@ export class UserAccountSettingsComponent implements OnDestroy, OnInit {
.pipe( .pipe(
catchError(() => { catchError(() => {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: $localize`Oops! Incorrect Security Token.`
message: $localize`Oops! Incorrect Security Token.`
}); });
return EMPTY; return EMPTY;

7
apps/client/src/app/pages/accounts/accounts-page.component.ts

@ -47,10 +47,10 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
private deviceService: DeviceDetectorService, private deviceService: DeviceDetectorService,
private dialog: MatDialog, private dialog: MatDialog,
private impersonationStorageService: ImpersonationStorageService, private impersonationStorageService: ImpersonationStorageService,
private notificationService: NotificationService,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private userService: UserService, private userService: UserService
private notificationService: NotificationService
) { ) {
this.route.queryParams this.route.queryParams
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
@ -308,8 +308,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
.pipe( .pipe(
catchError(() => { catchError(() => {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: $localize`Oops, cash balance transfer has failed.`
message: $localize`Oops, cash balance transfer has failed.`
}); });
return EMPTY; return EMPTY;

7
apps/client/src/app/pages/demo/demo-page.component.ts

@ -21,8 +21,8 @@ export class GfDemoPageComponent implements OnDestroy {
public constructor( public constructor(
private dataService: DataService, private dataService: DataService,
private router: Router, private router: Router,
private tokenStorageService: TokenStorageService, private notificationService: NotificationService,
private notificationService: NotificationService private tokenStorageService: TokenStorageService
) { ) {
this.info = this.dataService.fetchInfo(); this.info = this.dataService.fetchInfo();
} }
@ -32,8 +32,7 @@ export class GfDemoPageComponent implements OnDestroy {
if (hasToken) { if (hasToken) {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: $localize`As you are already logged in, you cannot access the demo account.`
message: $localize`As you are already logged in, you cannot access the demo account.`
}); });
} else { } else {
this.tokenStorageService.saveToken(this.info.demoAuthToken, true); this.tokenStorageService.saveToken(this.info.demoAuthToken, true);

7
apps/client/src/app/pages/pricing/pricing-page.component.ts

@ -42,9 +42,9 @@ export class PricingPageComponent implements OnDestroy, OnInit {
public constructor( public constructor(
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService, private dataService: DataService,
private notificationService: NotificationService,
private stripeService: StripeService, private stripeService: StripeService,
private userService: UserService, private userService: UserService
private notificationService: NotificationService
) {} ) {}
public ngOnInit() { public ngOnInit() {
@ -85,8 +85,7 @@ export class PricingPageComponent implements OnDestroy, OnInit {
}), }),
catchError((error) => { catchError((error) => {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: error
message: error
}); });
throw error; throw error;
}) })

7
libs/ui/src/lib/activities-table/activities-table.component.ts

@ -122,8 +122,8 @@ export class GfActivitiesTableComponent
private unsubscribeSubject = new Subject<void>(); private unsubscribeSubject = new Subject<void>();
public constructor( public constructor(
private router: Router, private notificationService: NotificationService,
private notificationService: NotificationService private router: Router
) {} ) {}
public ngOnInit() { public ngOnInit() {
@ -265,8 +265,7 @@ export class GfActivitiesTableComponent
public onOpenComment(aComment: string) { public onOpenComment(aComment: string) {
this.notificationService.alert({ this.notificationService.alert({
title: '', title: aComment
message: aComment
}); });
} }

4
package-lock.json

@ -1,12 +1,12 @@
{ {
"name": "ghostfolio", "name": "ghostfolio",
"version": "2.103.0", "version": "2.101.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ghostfolio", "name": "ghostfolio",
"version": "2.103.0", "version": "2.101.0",
"hasInstallScript": true, "hasInstallScript": true,
"license": "AGPL-3.0", "license": "AGPL-3.0",
"dependencies": { "dependencies": {

Loading…
Cancel
Save