Browse Source

Bugfix/open account details dialog on allocations page (#6988)

* Fix open account details dialog

* Update changelog

---------

Co-authored-by: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
pull/7047/head^2
Parman Mohammadalizadeh 7 days ago
committed by GitHub
parent
commit
f4d17c786a
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 6
      apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts
  3. 5
      libs/ui/src/lib/portfolio-proportion-chart/interfaces/interfaces.ts
  4. 18
      libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

1
CHANGELOG.md

@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed a chart error on interaction by registering the annotation plugin early - Fixed a chart error on interaction by registering the annotation plugin early
- Fixed an issue on the allocations page where clicking an account in the _By Account_ chart did not open the detail dialog
## 3.11.0 - 2026-06-14 ## 3.11.0 - 2026-06-14

6
apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts

@ -185,10 +185,10 @@ export class GfAllocationsPageComponent implements OnInit {
this.initialize(); this.initialize();
} }
public onAccountChartClicked({ symbol }: AssetProfileIdentifier) { public onAccountChartClicked({ accountId }: { accountId: string }) {
if (symbol && symbol !== UNKNOWN_KEY) { if (accountId && accountId !== UNKNOWN_KEY) {
this.router.navigate([], { this.router.navigate([], {
queryParams: { accountId: symbol, accountDetailDialog: true } queryParams: { accountId, accountDetailDialog: true }
}); });
} }
} }

5
libs/ui/src/lib/portfolio-proportion-chart/interfaces/interfaces.ts

@ -0,0 +1,5 @@
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
export type PortfolioProportionChartClickEvent =
| AssetProfileIdentifier
| { accountId: string };

18
libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

@ -1,10 +1,7 @@
import { getTooltipOptions } from '@ghostfolio/common/chart-helper'; import { getTooltipOptions } from '@ghostfolio/common/chart-helper';
import { UNKNOWN_KEY } from '@ghostfolio/common/config'; import { UNKNOWN_KEY } from '@ghostfolio/common/config';
import { getLocale, getSum, getTextColor } from '@ghostfolio/common/helper'; import { getLocale, getSum, getTextColor } from '@ghostfolio/common/helper';
import { import { PortfolioPosition } from '@ghostfolio/common/interfaces';
AssetProfileIdentifier,
PortfolioPosition
} from '@ghostfolio/common/interfaces';
import { ColorScheme } from '@ghostfolio/common/types'; import { ColorScheme } from '@ghostfolio/common/types';
import { import {
@ -36,6 +33,8 @@ import Color from 'color';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import OpenColor from 'open-color'; import OpenColor from 'open-color';
import { PortfolioProportionChartClickEvent } from './interfaces/interfaces';
const { const {
blue, blue,
cyan, cyan,
@ -80,7 +79,8 @@ export class GfPortfolioProportionChartComponent
public chart: Chart<'doughnut'>; public chart: Chart<'doughnut'>;
public isLoading = true; public isLoading = true;
protected readonly proportionChartClicked = output<AssetProfileIdentifier>(); protected readonly proportionChartClicked =
output<PortfolioProportionChartClickEvent>();
private readonly OTHER_KEY = 'OTHER'; private readonly OTHER_KEY = 'OTHER';
@ -355,11 +355,11 @@ export class GfPortfolioProportionChartComponent
const dataIndex = activeElements[0].index; const dataIndex = activeElements[0].index;
const symbol = chart.data.labels?.[dataIndex] as string; const symbol = chart.data.labels?.[dataIndex] as string;
const dataSource = this.data[symbol].dataSource; const dataSource = this.data[symbol]?.dataSource;
if (dataSource) { this.proportionChartClicked.emit(
this.proportionChartClicked.emit({ dataSource, symbol }); dataSource ? { dataSource, symbol } : { accountId: symbol }
} );
} catch {} } catch {}
}, },
onHover: (event, chartElement) => { onHover: (event, chartElement) => {

Loading…
Cancel
Save