Browse Source

Replaced the usage of alert() with navigation service

pull/3670/head
Daniel Idem 1 year ago
parent
commit
72bbefbd48
  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,
@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
});
}
}

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

3
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;

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,
public dialogRef: MatDialogRef<AssetProfileDialog>,
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 +

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

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) => {
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.`
});
}

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(
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;
})

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

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

7
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);

7
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;
})

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

@ -122,8 +122,8 @@ export class GfActivitiesTableComponent
private unsubscribeSubject = new Subject<void>();
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
});
}

4
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": {

Loading…
Cancel
Save