();
@@ -156,6 +167,8 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
) {}
public ngOnInit() {
+ this.initializeFilterForm();
+
this.assetClasses = Object.keys(AssetClass).map((assetClass) => {
return {
id: assetClass,
@@ -263,16 +276,7 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
this.filterForm.enable({ emitEvent: false });
}
- this.filterForm.setValue(
- {
- account: this.user?.settings?.['filters.accounts']?.[0] ?? null,
- assetClass: this.user?.settings?.['filters.assetClasses']?.[0] ?? null,
- tag: this.user?.settings?.['filters.tags']?.[0] ?? null
- },
- {
- emitEvent: false
- }
- );
+ this.initializeFilterForm();
this.tags =
this.user?.tags
@@ -298,6 +302,19 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
});
}
+ public holdingComparisonFunction(
+ option: PortfolioPosition,
+ value: PortfolioPosition
+ ): boolean {
+ if (value === null) {
+ return false;
+ }
+
+ return (
+ getAssetProfileIdentifier(option) === getAssetProfileIdentifier(value)
+ );
+ }
+
public async initialize() {
this.isLoading = true;
this.keyManager = new FocusKeyManager(this.assistantListItems).withWrap();
@@ -331,6 +348,14 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
id: this.filterForm.get('assetClass').value,
type: 'ASSET_CLASS'
},
+ {
+ id: this.filterForm.get('holding').value?.dataSource,
+ type: 'DATA_SOURCE'
+ },
+ {
+ id: this.filterForm.get('holding').value?.symbol,
+ type: 'SYMBOL'
+ },
{
id: this.filterForm.get('tag').value,
type: 'TAG'
@@ -473,4 +498,47 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
takeUntil(this.unsubscribeSubject)
);
}
+
+ private initializeFilterForm() {
+ this.dataService
+ .fetchPortfolioHoldings()
+ .pipe(takeUntil(this.unsubscribeSubject))
+ .subscribe(({ holdings }) => {
+ this.holdings = holdings
+ .filter(({ assetSubClass }) => {
+ return !['CASH'].includes(assetSubClass);
+ })
+ .sort((a, b) => {
+ return a.name?.localeCompare(b.name);
+ });
+ this.setFilterFormValues();
+ });
+ }
+
+ private setFilterFormValues() {
+ const dataSource = this.user?.settings?.[
+ 'filters.dataSource'
+ ] as DataSource;
+ const symbol = this.user?.settings?.['filters.symbol'];
+ const selectedHolding = this.holdings.find((holding) => {
+ return (
+ getAssetProfileIdentifier({
+ dataSource: holding.dataSource,
+ symbol: holding.symbol
+ }) === getAssetProfileIdentifier({ dataSource, symbol })
+ );
+ });
+
+ this.filterForm.setValue(
+ {
+ account: this.user?.settings?.['filters.accounts']?.[0] ?? null,
+ assetClass: this.user?.settings?.['filters.assetClasses']?.[0] ?? null,
+ holding: selectedHolding ?? null,
+ tag: this.user?.settings?.['filters.tags']?.[0] ?? null
+ },
+ {
+ emitEvent: false
+ }
+ );
+ }
}
diff --git a/libs/ui/src/lib/assistant/assistant.html b/libs/ui/src/lib/assistant/assistant.html
index 648c791ab..18c2145a3 100644
--- a/libs/ui/src/lib/assistant/assistant.html
+++ b/libs/ui/src/lib/assistant/assistant.html
@@ -122,6 +122,34 @@
+
+
+ Holding
+
+ {{
+ filterForm.get('holding')?.value?.name
+ }}
+
+ @for (holding of holdings; track holding.name) {
+
+
+ {{ holding.name }}
+
+ {{ holding.symbol | gfSymbol }} ·
+ {{ holding.currency }}
+
+
+ }
+
+
+
Tags
From 09a9148fecf8067e3bada5201a45f86900fe3b77 Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Sun, 10 Nov 2024 11:01:39 +0100
Subject: [PATCH 3/3] Bugfix/move changelog entry (#4038)
* Move changelog entry
---
CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a9aacf3c..5bb45d740 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,12 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Extended the assistant by a holding selector
+- Improved the language localization for Italian (`it`)
## 2.122.0 - 2024-11-07
### Changed
-- Improved the language localization for Italian (`it`)
- Upgraded `countries-list` from version `3.1.0` to `3.1.1`
### Fixed