diff --git a/CHANGELOG.md b/CHANGELOG.md index e600373b0..c60c62904 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Refactored the dark theme CSS selector - Improved the language localization for German (`de`) +- Upgraded `zone.js` from version `0.14.7` to `0.14.10` ### Fixed diff --git a/apps/client/src/app/app.component.ts b/apps/client/src/app/app.component.ts index ad6e6e808..fbc358590 100644 --- a/apps/client/src/app/app.component.ts +++ b/apps/client/src/app/app.component.ts @@ -28,6 +28,7 @@ import { DeviceDetectorService } from 'ngx-device-detector'; import { Subject } from 'rxjs'; import { filter, takeUntil } from 'rxjs/operators'; +import { NotificationService } from './core/notification/notification.service'; import { DataService } from './services/data.service'; import { ImpersonationStorageService } from './services/impersonation-storage.service'; import { TokenStorageService } from './services/token-storage.service'; @@ -81,6 +82,7 @@ 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, @@ -199,7 +201,9 @@ export class AppComponent implements OnDestroy, OnInit { if (this.user.systemMessage.routerLink) { this.router.navigate(this.user.systemMessage.routerLink); } else { - alert(this.user.systemMessage.message); + this.notificationService.alert({ + 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 d19cd748f..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 @@ -120,7 +120,9 @@ export class AccountsTableComponent implements OnChanges, OnDestroy, OnInit { } public onOpenComment(aComment: string) { - alert(aComment); + this.notificationService.alert({ + title: aComment + }); } public onTransferBalance() { 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 23730f3aa..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 @@ -1,3 +1,4 @@ +import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; import { AdminService } from '@ghostfolio/client/services/admin.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; import { @@ -59,6 +60,7 @@ export class AdminJobsComponent implements OnDestroy, OnInit { private adminService: AdminService, private changeDetectorRef: ChangeDetectorRef, private formBuilder: FormBuilder, + private notificationService: NotificationService, private userService: UserService ) { this.userService.stateChanged @@ -119,11 +121,15 @@ export class AdminJobsComponent implements OnDestroy, OnInit { } public onViewData(aData: AdminJobs['jobs'][0]['data']) { - alert(JSON.stringify(aData, null, ' ')); + this.notificationService.alert({ + title: JSON.stringify(aData, null, ' ') + }); } public onViewStacktrace(aStacktrace: AdminJobs['jobs'][0]['stacktrace']) { - alert(JSON.stringify(aStacktrace, null, ' ')); + this.notificationService.alert({ + title: JSON.stringify(aStacktrace, null, ' ') + }); } public ngOnDestroy() { 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 4d882826c..f1bd9e826 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 @@ -54,15 +54,22 @@ export class AdminMarketDataService { message: $localize`Oops! Could not delete profiles.` }); - return EMPTY; - }), - finalize(() => { - setTimeout(() => { - window.location.reload(); - }, 300); - }) - ) - .subscribe(() => {}); + forkJoin(deleteRequests) + .pipe( + catchError(() => { + this.notificationService.alert({ + title: $localize`Oops! Could not delete profiles.` + }); + + return EMPTY; + }), + finalize(() => { + window.location.reload(); + setTimeout(() => { + }, 300); + }) + ) + .subscribe(() => {}); }, confirmType: ConfirmationDialogType.Warn, title: $localize`Do you really want to delete these profiles?` 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 a24d6dc30..7cb3aac08 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 @@ -1,6 +1,7 @@ import { UpdateAssetProfileDto } from '@ghostfolio/api/app/admin/update-asset-profile.dto'; import { UpdateMarketDataDto } from '@ghostfolio/api/app/admin/update-market-data.dto'; import { AdminMarketDataService } from '@ghostfolio/client/components/admin-market-data/admin-market-data.service'; +import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; import { AdminService } from '@ghostfolio/client/services/admin.service'; import { DataService } from '@ghostfolio/client/services/data.service'; import { validateObjectForForm } from '@ghostfolio/client/util/form.util'; @@ -94,6 +95,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { private dataService: DataService, public dialogRef: MatDialogRef, private formBuilder: FormBuilder, + private notificationService: NotificationService, private snackBar: MatSnackBar ) {} @@ -329,19 +331,23 @@ export class AssetProfileDialog implements OnDestroy, OnInit { }) .pipe( catchError(({ error }) => { - alert(`Error: ${error?.message}`); + this.notificationService.alert({ + message: error?.message, + title: $localize`Error` + }); return EMPTY; }), takeUntil(this.unsubscribeSubject) ) .subscribe(({ price }) => { - alert( - $localize`The current market price is` + + this.notificationService.alert({ + title: + $localize`The current market price is` + ' ' + price + ' ' + this.assetProfileForm.get('currency').value - ); + }); }); } 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 d64c02dfc..6ea955873 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 @@ -1,4 +1,3 @@ -import { ConfirmationDialogType } from '@ghostfolio/client/core/notification/confirmation-dialog/confirmation-dialog.type'; import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; import { AdminService } from '@ghostfolio/client/services/admin.service'; import { CacheService } from '@ghostfolio/client/services/cache.service'; @@ -62,8 +61,8 @@ export class AdminOverviewComponent implements OnDestroy, OnInit { private cacheService: CacheService, private changeDetectorRef: ChangeDetectorRef, private dataService: DataService, - private userService: UserService, - private notificationService: NotificationService + private notificationService: NotificationService, + private userService: UserService ) { this.info = this.dataService.fetchInfo(); @@ -129,7 +128,9 @@ export class AdminOverviewComponent implements OnDestroy, OnInit { const currencies = uniq([...this.customCurrencies, currency]); this.putAdminSetting({ key: PROPERTY_CURRENCIES, value: currencies }); } else { - alert($localize`${currency} is an invalid currency!`); + this.notificationService.alert({ + 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 0007c1612..7d740ce5b 100644 --- a/apps/client/src/app/components/header/header.component.ts +++ b/apps/client/src/app/components/header/header.component.ts @@ -1,6 +1,7 @@ import { UpdateUserSettingDto } from '@ghostfolio/api/app/user/update-user-setting.dto'; import { LoginWithAccessTokenDialog } from '@ghostfolio/client/components/login-with-access-token-dialog/login-with-access-token-dialog.component'; import { LayoutService } from '@ghostfolio/client/core/layout.service'; +import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; import { DataService } from '@ghostfolio/client/services/data.service'; import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; import { @@ -93,6 +94,7 @@ 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, @@ -240,7 +242,9 @@ export class HeaderComponent implements OnChanges { .loginAnonymous(data?.accessToken) .pipe( catchError(() => { - alert($localize`Oops! Incorrect Security Token.`); + this.notificationService.alert({ + 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 d7a41f62f..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 @@ -1,4 +1,5 @@ import { CreateAccessDto } from '@ghostfolio/api/app/access/create-access.dto'; +import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; import { DataService } from '@ghostfolio/client/services/data.service'; import { validateObjectForForm } from '@ghostfolio/client/util/form.util'; @@ -33,7 +34,8 @@ export class CreateOrUpdateAccessDialog implements OnDestroy { @Inject(MAT_DIALOG_DATA) private data: CreateOrUpdateAccessDialogParams, public dialogRef: MatDialogRef, private dataService: DataService, - private formBuilder: FormBuilder + private formBuilder: FormBuilder, + private notificationService: NotificationService ) {} ngOnInit() { @@ -85,7 +87,9 @@ export class CreateOrUpdateAccessDialog implements OnDestroy { .pipe( catchError((error) => { if (error.status === StatusCodes.BAD_REQUEST) { - alert($localize`Oops! Could not grant access.`); + this.notificationService.alert({ + title: $localize`Oops! Could not grant access.` + }); } return EMPTY; 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 bc9212b15..e21a85418 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 @@ -1,3 +1,4 @@ +import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; import { DataService } from '@ghostfolio/client/services/data.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; import { getDateFormatString } from '@ghostfolio/common/helper'; @@ -46,6 +47,7 @@ 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 @@ -96,13 +98,18 @@ export class UserAccountMembershipComponent implements OnDestroy, OnInit { return this.stripeService.redirectToCheckout({ sessionId }); }), catchError((error) => { - alert(error.message); + this.notificationService.alert({ + title: error.message + }); + throw error; }) ) .subscribe((result) => { if (result.error) { - alert(result.error.message); + this.notificationService.alert({ + title: result.error.message + }); } }); } 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 1d8c17d6d..eef5fe143 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 @@ -1,5 +1,5 @@ -import { ConfirmationDialogType } from '@ghostfolio/client/core/notification/confirmation-dialog/confirmation-dialog.type'; import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; +import { ConfirmationDialogType } from '@ghostfolio/client/core/notification/confirmation-dialog/confirmation-dialog.type'; import { DataService } from '@ghostfolio/client/services/data.service'; import { KEY_STAY_SIGNED_IN, @@ -71,6 +71,7 @@ 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, @@ -160,6 +161,17 @@ export class UserAccountSettingsComponent implements OnDestroy, OnInit { message: $localize`Oops! Incorrect Security Token.` }); + if (confirmation) { + this.dataService + .deleteOwnUser({ + accessToken: this.deleteOwnUserForm.get('accessToken').value + }) + .pipe( + catchError(() => { + this.notificationService.alert({ + title: $localize`Oops! Incorrect Security Token.` + }); + return EMPTY; }), takeUntil(this.unsubscribeSubject) 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 9f86bf587..3f1ed9efe 100644 --- a/apps/client/src/app/pages/accounts/accounts-page.component.ts +++ b/apps/client/src/app/pages/accounts/accounts-page.component.ts @@ -3,6 +3,7 @@ import { TransferBalanceDto } from '@ghostfolio/api/app/account/transfer-balance import { UpdateAccountDto } from '@ghostfolio/api/app/account/update-account.dto'; import { AccountDetailDialog } from '@ghostfolio/client/components/account-detail-dialog/account-detail-dialog.component'; import { AccountDetailDialogParams } from '@ghostfolio/client/components/account-detail-dialog/interfaces/interfaces'; +import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; import { DataService } from '@ghostfolio/client/services/data.service'; import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; @@ -46,6 +47,7 @@ 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 @@ -305,7 +307,9 @@ export class AccountsPageComponent implements OnDestroy, OnInit { }) .pipe( catchError(() => { - alert($localize`Oops, cash balance transfer has failed.`); + this.notificationService.alert({ + 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 23f13b1ca..720bb4974 100644 --- a/apps/client/src/app/pages/demo/demo-page.component.ts +++ b/apps/client/src/app/pages/demo/demo-page.component.ts @@ -1,3 +1,4 @@ +import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; import { DataService } from '@ghostfolio/client/services/data.service'; import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service'; import { InfoItem } from '@ghostfolio/common/interfaces'; @@ -19,6 +20,7 @@ export class GfDemoPageComponent implements OnDestroy { public constructor( private dataService: DataService, + private notificationService: NotificationService, private router: Router, private tokenStorageService: TokenStorageService ) { @@ -29,9 +31,9 @@ export class GfDemoPageComponent implements OnDestroy { const hasToken = this.tokenStorageService.getToken()?.length > 0; if (hasToken) { - alert( - $localize`As you are already logged in, you cannot access the demo account.` - ); + this.notificationService.alert({ + 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 280f7bf74..b366f3d63 100644 --- a/apps/client/src/app/pages/pricing/pricing-page.component.ts +++ b/apps/client/src/app/pages/pricing/pricing-page.component.ts @@ -1,3 +1,4 @@ +import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; import { DataService } from '@ghostfolio/client/services/data.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; import { User } from '@ghostfolio/common/interfaces'; @@ -41,6 +42,7 @@ export class PricingPageComponent implements OnDestroy, OnInit { public constructor( private changeDetectorRef: ChangeDetectorRef, private dataService: DataService, + private notificationService: NotificationService, private stripeService: StripeService, private userService: UserService ) {} @@ -82,13 +84,18 @@ export class PricingPageComponent implements OnDestroy, OnInit { return this.stripeService.redirectToCheckout({ sessionId }); }), catchError((error) => { - alert(error.message); + this.notificationService.alert({ + title: error.message + }); + throw error; }) ) .subscribe((result) => { if (result.error) { - alert(result.error.message); + this.notificationService.alert({ + title: result.error.message + }); } }); } 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 78ea2eb24..698da3044 100644 --- a/libs/ui/src/lib/activities-table/activities-table.component.ts +++ b/libs/ui/src/lib/activities-table/activities-table.component.ts @@ -1,7 +1,7 @@ import { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interface'; import { GfAssetProfileIconComponent } from '@ghostfolio/client/components/asset-profile-icon/asset-profile-icon.component'; -import { ConfirmationDialogType } from '@ghostfolio/client/core/notification/confirmation-dialog/confirmation-dialog.type'; import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; +import { ConfirmationDialogType } from '@ghostfolio/client/core/notification/confirmation-dialog/confirmation-dialog.type'; import { GfSymbolModule } from '@ghostfolio/client/pipes/symbol/symbol.module'; import { DEFAULT_PAGE_SIZE } from '@ghostfolio/common/config'; import { getDateFormatString, getLocale } from '@ghostfolio/common/helper'; @@ -123,8 +123,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,7 +265,9 @@ export class GfActivitiesTableComponent } public onOpenComment(aComment: string) { - alert(aComment); + this.notificationService.alert({ + title: aComment + }); } public onOpenPositionDialog({ dataSource, symbol }: AssetProfileIdentifier) { diff --git a/package-lock.json b/package-lock.json index 49eadc623..6babe2793 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ghostfolio", - "version": "2.101.0", + "version": "2.103.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ghostfolio", - "version": "2.101.0", + "version": "2.103.0", "hasInstallScript": true, "license": "AGPL-3.0", "dependencies": { @@ -92,7 +92,7 @@ "twitter-api-v2": "1.14.2", "uuid": "9.0.1", "yahoo-finance2": "2.11.3", - "zone.js": "0.14.7" + "zone.js": "0.14.10" }, "devDependencies": { "@angular-devkit/build-angular": "18.1.1", @@ -130,7 +130,7 @@ "@types/color": "3.0.3", "@types/google-spreadsheet": "3.1.5", "@types/jest": "29.4.4", - "@types/lodash": "4.17.0", + "@types/lodash": "4.17.7", "@types/node": "20.14.10", "@types/papaparse": "5.3.7", "@types/passport-google-oauth20": "2.0.16", @@ -11736,10 +11736,11 @@ } }, "node_modules/@types/lodash": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.0.tgz", - "integrity": "sha512-t7dhREVv6dbNj0q17X12j7yDG4bD/DHYX7o5/DbDxobP0HnGPgpRz2Ej77aL7TZT3DSw13fqUTj8J4mMnqa7WA==", - "dev": true + "version": "4.17.7", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.7.tgz", + "integrity": "sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==", + "dev": true, + "license": "MIT" }, "node_modules/@types/mdast": { "version": "3.0.15", @@ -34390,9 +34391,10 @@ } }, "node_modules/zone.js": { - "version": "0.14.7", - "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.14.7.tgz", - "integrity": "sha512-0w6DGkX2BPuiK/NLf+4A8FLE43QwBfuqz2dVgi/40Rj1WmqUskCqj329O/pwrqFJLG5X8wkeG2RhIAro441xtg==" + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.14.10.tgz", + "integrity": "sha512-YGAhaO7J5ywOXW6InXNlLmfU194F8lVgu7bRntUF3TiG8Y3nBK0x1UJJuHUP/e8IyihkjCYqhCScpSwnlaSRkQ==", + "license": "MIT" } } } diff --git a/package.json b/package.json index 0e38d32a3..38429a369 100644 --- a/package.json +++ b/package.json @@ -136,7 +136,7 @@ "twitter-api-v2": "1.14.2", "uuid": "9.0.1", "yahoo-finance2": "2.11.3", - "zone.js": "0.14.7" + "zone.js": "0.14.10" }, "devDependencies": { "@angular-devkit/build-angular": "18.1.1", @@ -174,7 +174,7 @@ "@types/color": "3.0.3", "@types/google-spreadsheet": "3.1.5", "@types/jest": "29.4.4", - "@types/lodash": "4.17.0", + "@types/lodash": "4.17.7", "@types/node": "20.14.10", "@types/papaparse": "5.3.7", "@types/passport-google-oauth20": "2.0.16",