diff --git a/CHANGELOG.md b/CHANGELOG.md index 90430f5c4..1c7fe47cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Improved the routing of the asset profile dialog in the market data section of the admin control panel +- Improved the routing of the create asset profile dialog in the market data section of the admin control panel + ## 2.238.0 - 2026-02-12 ### Changed diff --git a/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts b/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts index 8f956b782..4ceb70a6b 100644 --- a/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts +++ b/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts @@ -13,6 +13,7 @@ import { import { AdminMarketDataItem } from '@ghostfolio/common/interfaces/admin-market-data.interface'; import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { GfSymbolPipe } from '@ghostfolio/common/pipes'; +import { internalRoutes } from '@ghostfolio/common/routes/routes'; import { GfActivitiesFilterComponent } from '@ghostfolio/ui/activities-filter'; import { translate } from '@ghostfolio/ui/i18n'; import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator'; @@ -157,6 +158,8 @@ export class GfAdminMarketDataComponent public isUUID = isUUID; public placeholder = ''; public pageSize = DEFAULT_PAGE_SIZE; + public routerLinkAdminControlMarketData = + internalRoutes.adminControl.subRoutes.marketData.routerLink; public selection: SelectionModel>; public totalItems = 0; public user: User; @@ -203,22 +206,23 @@ export class GfAdminMarketDataComponent this.displayedColumns.push('comment'); this.displayedColumns.push('actions'); - this.route.queryParams - .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe((params) => { - if ( - params['assetProfileDialog'] && - params['dataSource'] && - params['symbol'] - ) { - this.openAssetProfileDialog({ - dataSource: params['dataSource'], - symbol: params['symbol'] - }); - } else if (params['createAssetProfileDialog']) { - this.openCreateAssetProfileDialog(); - } - }); + if (this.route.snapshot.routeConfig.path === 'market-data/create') { + this.openCreateAssetProfileDialog(); + } else { + this.route.paramMap + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe((paramMap) => { + const dataSource = paramMap.get('dataSource') as DataSource; + const symbol = paramMap.get('symbol'); + + if (dataSource && symbol) { + this.openAssetProfileDialog({ + dataSource, + symbol + }); + } + }); + } this.userService.stateChanged .pipe(takeUntil(this.unsubscribeSubject)) @@ -344,15 +348,15 @@ export class GfAdminMarketDataComponent dataSource, symbol }: AssetProfileIdentifier) { - this.router.navigate([], { - queryParams: { - dataSource, - symbol, - assetProfileDialog: true - } + this.router.navigate([dataSource, symbol], { + relativeTo: this.route }); } + public getRouterLinkToAdminControlMarketData(dataSource, symbol) { + return [...this.routerLinkAdminControlMarketData, dataSource, symbol]; + } + public ngOnDestroy() { this.unsubscribeSubject.next(); this.unsubscribeSubject.complete(); @@ -453,7 +457,9 @@ export class GfAdminMarketDataComponent if (newAssetProfileIdentifier) { this.onOpenAssetProfileDialog(newAssetProfileIdentifier); } else { - this.router.navigate(['.'], { relativeTo: this.route }); + this.router.navigate( + internalRoutes.adminControl.subRoutes.marketData.routerLink + ); } } ); @@ -484,7 +490,7 @@ export class GfAdminMarketDataComponent .pipe(takeUntil(this.unsubscribeSubject)) .subscribe((result) => { if (!result) { - this.router.navigate(['.'], { relativeTo: this.route }); + this.router.navigate(['..'], { relativeTo: this.route }); return; } diff --git a/apps/client/src/app/components/admin-market-data/admin-market-data.html b/apps/client/src/app/components/admin-market-data/admin-market-data.html index 156ae0f5f..d64b541a8 100644 --- a/apps/client/src/app/components/admin-market-data/admin-market-data.html +++ b/apps/client/src/app/components/admin-market-data/admin-market-data.html @@ -255,12 +255,12 @@ @@ -336,8 +336,7 @@ class="align-items-center d-flex justify-content-center" color="primary" mat-fab - [queryParams]="{ createAssetProfileDialog: true }" - [routerLink]="[]" + [routerLink]="['create']" > diff --git a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts index 427386796..f1987c021 100644 --- a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts +++ b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts @@ -618,6 +618,14 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit { } } + public getRouterLinkToAdminControlMarketDataForDataSourceAndSymbol() { + return [ + ...this.routerLinkAdminControlMarketData, + this.SymbolProfile?.dataSource, + this.SymbolProfile?.symbol + ]; + } + public onUpdateActivity(aActivity: Activity) { this.router.navigate( internalRoutes.portfolio.subRoutes.activities.routerLink, diff --git a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html index 86f4676f3..a649330eb 100644 --- a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html +++ b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html @@ -454,12 +454,9 @@ @if (data.hasPermissionToAccessAdminControl) { Manage Asset Profile