From 9f72835d583dadaf4df626125198b0744e56ba26 Mon Sep 17 00:00:00 2001 From: Gianluca755 <19376177+Gianluca755@users.noreply.github.com> Date: Sat, 9 Nov 2024 20:20:13 +0100 Subject: [PATCH 1/3] Feature/improve language localization for it 20241109 (#4036) * Update translations * Update changelog --- CHANGELOG.md | 1 + apps/client/src/locales/messages.it.xlf | 108 ++++++++++++------------ 2 files changed, 55 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16dad74a1..8131113f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Improved the language localization for Italian (`it`) - Upgraded `countries-list` from version `3.1.0` to `3.1.1` ### Fixed diff --git a/apps/client/src/locales/messages.it.xlf b/apps/client/src/locales/messages.it.xlf index 9364d8356..8f55b3279 100644 --- a/apps/client/src/locales/messages.it.xlf +++ b/apps/client/src/locales/messages.it.xlf @@ -2872,7 +2872,7 @@ Hello, has shared a Portfolio with you! - Salve, ha condiviso un Portafoglio con te! + Salve, ha condiviso un Portafoglio con te! apps/client/src/app/pages/public/public-page.html 4 @@ -5881,7 +5881,7 @@ Currency Cluster Risks - Currency Cluster Risks + Rischio di Concentrazione Valutario apps/client/src/app/pages/portfolio/fire/fire-page.html 141 @@ -5889,7 +5889,7 @@ Account Cluster Risks - Account Cluster Risks + Rischi di Concentrazione dei Conti apps/client/src/app/pages/portfolio/fire/fire-page.html 160 @@ -6237,7 +6237,7 @@ Restricted view - Restricted view + Vista limitata apps/client/src/app/components/access-table/access-table.component.html 26 @@ -6357,7 +6357,7 @@ WTD - WTD + Settimana corrente libs/ui/src/lib/assistant/assistant.component.ts 212 @@ -6373,7 +6373,7 @@ MTD - MTD + Mese corrente libs/ui/src/lib/assistant/assistant.component.ts 216 @@ -6597,7 +6597,7 @@ {VAR_PLURAL, plural, =1 {activity} other {activities}} - {VAR_PLURAL, plural, =1 {activity} other {activities}} + {VAR_PLURAL, plural, =1 {attività} other {attività}} apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html 14 @@ -6781,7 +6781,7 @@ Family Office - Family Office + Ufficio familiare apps/client/src/app/pages/resources/personal-finance-tools/product-page.component.ts 87 @@ -6837,7 +6837,7 @@ User Experience - User Experience + Esperienza Utente apps/client/src/app/pages/resources/personal-finance-tools/product-page.component.ts 98 @@ -7061,7 +7061,7 @@ Copy link to clipboard - Copy link to clipboard + Copia link negli appunti apps/client/src/app/components/access-table/access-table.component.html 70 @@ -7069,7 +7069,7 @@ Portfolio Snapshot - Portfolio Snapshot + Stato del Portfolio apps/client/src/app/components/admin-jobs/admin-jobs.html 39 @@ -7077,7 +7077,7 @@ Change with currency effect Change - Change with currency effect Change + Cambio con effetto valuta Cambia apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html 50 @@ -7085,7 +7085,7 @@ Performance with currency effect Performance - Performance with currency effect Performance + Prestazioni con effetto valuta Prestazioni apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html 69 @@ -7093,7 +7093,7 @@ Threshold Min - Threshold Min + Soglia Minima apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html 9 @@ -7101,7 +7101,7 @@ Threshold Max - Threshold Max + Soglia Massima apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html 44 @@ -7109,7 +7109,7 @@ Close - Close + Chiudi apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html 77 @@ -7117,7 +7117,7 @@ Customize - Customize + Personalizza apps/client/src/app/components/rule/rule.component.html 67 @@ -7125,7 +7125,7 @@ No auto-renewal. - No auto-renewal. + No rinnovo automatico. apps/client/src/app/components/user-account-membership/user-account-membership.html 62 @@ -7133,7 +7133,7 @@ Today - Today + Oggi apps/client/src/app/pages/public/public-page.html 24 @@ -7141,7 +7141,7 @@ This year - This year + Anno corrente apps/client/src/app/pages/public/public-page.html 42 @@ -7149,7 +7149,7 @@ From the beginning - From the beginning + Dall'inizio apps/client/src/app/pages/public/public-page.html 60 @@ -7157,7 +7157,7 @@ Oops! Invalid currency. - Oops! Invalid currency. + Oops! Valuta sbagliata. apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.html 49 @@ -7165,7 +7165,7 @@ This page has been archived. - This page has been archived. + Questa pagina è stata archiviata. apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 14 @@ -7173,7 +7173,7 @@ is Open Source Software - is Open Source Software + è un programma Open Source apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 139 @@ -7181,7 +7181,7 @@ is not Open Source Software - is not Open Source Software + non è un programma Open Source apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 146 @@ -7189,7 +7189,7 @@ is Open Source Software - is Open Source Software + è un programma Open Source apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 156 @@ -7197,7 +7197,7 @@ is not Open Source Software - is not Open Source Software + non è un programma Open Source apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 163 @@ -7205,7 +7205,7 @@ can be self-hosted - can be self-hosted + può essere ospitato in proprio apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 178 @@ -7213,7 +7213,7 @@ cannot be self-hosted - cannot be self-hosted + non può essere ospitato in proprio apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 185 @@ -7221,7 +7221,7 @@ can be self-hosted - can be self-hosted + può essere ospitato in proprio apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 195 @@ -7229,7 +7229,7 @@ cannot be self-hosted - cannot be self-hosted + non può essere ospitato in proprio apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 202 @@ -7237,7 +7237,7 @@ can be used anonymously - can be used anonymously + può essere usato anonimamente apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 217 @@ -7245,7 +7245,7 @@ cannot be used anonymously - cannot be used anonymously + non può essere usato anonimamente apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 224 @@ -7253,7 +7253,7 @@ can be used anonymously - can be used anonymously + può essere usato anonimamente apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 234 @@ -7261,7 +7261,7 @@ cannot be used anonymously - cannot be used anonymously + non può essere usato anonimamente apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 241 @@ -7269,7 +7269,7 @@ offers a free plan - offers a free plan + ha un piano gratuito apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 256 @@ -7277,7 +7277,7 @@ does not offer a free plan - does not offer a free plan + non ha un piano gratuito apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 263 @@ -7285,7 +7285,7 @@ offers a free plan - offers a free plan + ha un piano gratuito apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 273 @@ -7293,7 +7293,7 @@ does not offer a free plan - does not offer a free plan + non ha un piano gratuito apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 280 @@ -7301,7 +7301,7 @@ Oops! Could not find any assets. - Oops! Could not find any assets. + Oops! Non ho trovato alcun asset. libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.component.html 37 @@ -7309,7 +7309,7 @@ Data Providers - Data Providers + Fornitori di dati apps/client/src/app/components/admin-settings/admin-settings.component.html 4 @@ -7317,7 +7317,7 @@ NEW - NEW + NUOVO apps/client/src/app/components/admin-settings/admin-settings.component.html 14 @@ -7325,7 +7325,7 @@ Set API Key - Set API Key + Imposta API Key apps/client/src/app/components/admin-settings/admin-settings.component.html 29 @@ -7333,7 +7333,7 @@ Want to stay updated? Click below to get notified as soon as it’s available. - Want to stay updated? Click below to get notified as soon as it’s available. + Vuoi seguire le novità? Clicca sotto per essere notificato appena è disponibile. apps/client/src/app/components/admin-settings/ghostfolio-premium-api-dialog/ghostfolio-premium-api-dialog.html 23 @@ -7341,7 +7341,7 @@ Notify me - Notify me + Notificami apps/client/src/app/components/admin-settings/ghostfolio-premium-api-dialog/ghostfolio-premium-api-dialog.html 32 @@ -7349,7 +7349,7 @@ Get access to 100’000+ tickers from over 50 exchanges - Get access to 100’000+ tickers from over 50 exchanges + Ottieni accesso a oltre 100’000+ titoli da oltre 50 borse libs/ui/src/lib/i18n.ts 24 @@ -7357,7 +7357,7 @@ Ukraine - Ukraine + Ucraina libs/ui/src/lib/i18n.ts 92 @@ -7365,7 +7365,7 @@ Skip - Skip + Salta apps/client/src/app/components/subscription-interstitial-dialog/subscription-interstitial-dialog.html 83 @@ -7373,7 +7373,7 @@ Join now - Join now + Iscriviti adesso apps/client/src/app/components/subscription-interstitial-dialog/subscription-interstitial-dialog.html 93 @@ -7381,7 +7381,7 @@ Allocation Cluster Risks - Allocation Cluster Risks + Rischi di allocazione dei Conti apps/client/src/app/pages/portfolio/fire/fire-page.html 179 @@ -7389,7 +7389,7 @@ Glossary - Glossary + Glossario apps/client/src/app/pages/resources/glossary/resources-glossary-routing.module.ts 10 @@ -7401,7 +7401,7 @@ Guides - Guides + Guide apps/client/src/app/pages/resources/guides/resources-guides-routing.module.ts 10 @@ -7413,7 +7413,7 @@ guides - guides + guide snake-case apps/client/src/app/pages/resources/overview/resources-overview.component.ts @@ -7426,7 +7426,7 @@ glossary - glossary + glossario snake-case apps/client/src/app/pages/resources/overview/resources-overview.component.ts From 6057794eb6649f0542e9261418df5e478e5b5109 Mon Sep 17 00:00:00 2001 From: Amandee Ellawala <47607256+amandee27@users.noreply.github.com> Date: Sun, 10 Nov 2024 09:29:43 +0000 Subject: [PATCH 2/3] Feature/extend assistant by holding selector (#4031) * Extend assistant by holding selector * Update changelog --- CHANGELOG.md | 6 ++ .../src/app/portfolio/portfolio.controller.ts | 25 +++++ .../src/app/user/update-user-setting.dto.ts | 8 ++ .../app/components/header/header.component.ts | 14 +-- apps/client/src/app/services/data.service.ts | 2 +- .../src/app/services/user/user.service.ts | 14 +++ .../lib/interfaces/user-settings.interface.ts | 2 + .../src/lib/assistant/assistant.component.ts | 94 ++++++++++++++++--- libs/ui/src/lib/assistant/assistant.html | 28 ++++++ 9 files changed, 172 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8131113f3..9a9aacf3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ 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 + +- Extended the assistant by a holding selector + ## 2.122.0 - 2024-11-07 ### Changed diff --git a/apps/api/src/app/portfolio/portfolio.controller.ts b/apps/api/src/app/portfolio/portfolio.controller.ts index 326dda151..f2415dff3 100644 --- a/apps/api/src/app/portfolio/portfolio.controller.ts +++ b/apps/api/src/app/portfolio/portfolio.controller.ts @@ -74,12 +74,15 @@ export class PortfolioController { @Get('details') @UseGuards(AuthGuard('jwt'), HasPermissionGuard) @UseInterceptors(RedactValuesInResponseInterceptor) + @UseInterceptors(TransformDataSourceInRequestInterceptor) @UseInterceptors(TransformDataSourceInResponseInterceptor) public async getDetails( @Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string, @Query('accounts') filterByAccounts?: string, @Query('assetClasses') filterByAssetClasses?: string, + @Query('dataSource') filterByDataSource?: string, @Query('range') dateRange: DateRange = 'max', + @Query('symbol') filterBySymbol?: string, @Query('tags') filterByTags?: string, @Query('withMarkets') withMarketsParam = 'false' ): Promise { @@ -95,6 +98,8 @@ export class PortfolioController { const filters = this.apiService.buildFiltersFromQueryParams({ filterByAccounts, filterByAssetClasses, + filterByDataSource, + filterBySymbol, filterByTags }); @@ -289,17 +294,22 @@ export class PortfolioController { @Get('dividends') @UseGuards(AuthGuard('jwt'), HasPermissionGuard) + @UseInterceptors(TransformDataSourceInRequestInterceptor) public async getDividends( @Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string, @Query('accounts') filterByAccounts?: string, @Query('assetClasses') filterByAssetClasses?: string, + @Query('dataSource') filterByDataSource?: string, @Query('groupBy') groupBy?: GroupBy, @Query('range') dateRange: DateRange = 'max', + @Query('symbol') filterBySymbol?: string, @Query('tags') filterByTags?: string ): Promise { const filters = this.apiService.buildFiltersFromQueryParams({ filterByAccounts, filterByAssetClasses, + filterByDataSource, + filterBySymbol, filterByTags }); @@ -356,21 +366,26 @@ export class PortfolioController { @Get('holdings') @UseGuards(AuthGuard('jwt'), HasPermissionGuard) @UseInterceptors(RedactValuesInResponseInterceptor) + @UseInterceptors(TransformDataSourceInRequestInterceptor) @UseInterceptors(TransformDataSourceInResponseInterceptor) public async getHoldings( @Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string, @Query('accounts') filterByAccounts?: string, @Query('assetClasses') filterByAssetClasses?: string, + @Query('dataSource') filterByDataSource?: string, @Query('holdingType') filterByHoldingType?: string, @Query('query') filterBySearchQuery?: string, @Query('range') dateRange: DateRange = 'max', + @Query('symbol') filterBySymbol?: string, @Query('tags') filterByTags?: string ): Promise { const filters = this.apiService.buildFiltersFromQueryParams({ filterByAccounts, filterByAssetClasses, + filterByDataSource, filterByHoldingType, filterBySearchQuery, + filterBySymbol, filterByTags }); @@ -386,17 +401,22 @@ export class PortfolioController { @Get('investments') @UseGuards(AuthGuard('jwt'), HasPermissionGuard) + @UseInterceptors(TransformDataSourceInRequestInterceptor) public async getInvestments( @Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string, @Query('accounts') filterByAccounts?: string, @Query('assetClasses') filterByAssetClasses?: string, + @Query('dataSource') filterByDataSource?: string, @Query('groupBy') groupBy?: GroupBy, @Query('range') dateRange: DateRange = 'max', + @Query('symbol') filterBySymbol?: string, @Query('tags') filterByTags?: string ): Promise { const filters = this.apiService.buildFiltersFromQueryParams({ filterByAccounts, filterByAssetClasses, + filterByDataSource, + filterBySymbol, filterByTags }); @@ -451,13 +471,16 @@ export class PortfolioController { @Get('performance') @UseGuards(AuthGuard('jwt'), HasPermissionGuard) @UseInterceptors(PerformanceLoggingInterceptor) + @UseInterceptors(TransformDataSourceInRequestInterceptor) @UseInterceptors(TransformDataSourceInResponseInterceptor) @Version('2') public async getPerformanceV2( @Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string, @Query('accounts') filterByAccounts?: string, @Query('assetClasses') filterByAssetClasses?: string, + @Query('dataSource') filterByDataSource?: string, @Query('range') dateRange: DateRange = 'max', + @Query('symbol') filterBySymbol?: string, @Query('tags') filterByTags?: string, @Query('withExcludedAccounts') withExcludedAccountsParam = 'false' ): Promise { @@ -466,6 +489,8 @@ export class PortfolioController { const filters = this.apiService.buildFiltersFromQueryParams({ filterByAccounts, filterByAssetClasses, + filterByDataSource, + filterBySymbol, filterByTags }); diff --git a/apps/api/src/app/user/update-user-setting.dto.ts b/apps/api/src/app/user/update-user-setting.dto.ts index 13a3a5d2c..b34b6fae2 100644 --- a/apps/api/src/app/user/update-user-setting.dto.ts +++ b/apps/api/src/app/user/update-user-setting.dto.ts @@ -64,6 +64,14 @@ export class UpdateUserSettingDto { @IsOptional() 'filters.assetClasses'?: string[]; + @IsString() + @IsOptional() + 'filters.dataSource'?: string; + + @IsString() + @IsOptional() + 'filters.symbol'?: string; + @IsArray() @IsOptional() 'filters.tags'?: string[]; diff --git a/apps/client/src/app/components/header/header.component.ts b/apps/client/src/app/components/header/header.component.ts index 1739d113f..004fa5f3f 100644 --- a/apps/client/src/app/components/header/header.component.ts +++ b/apps/client/src/app/components/header/header.component.ts @@ -175,17 +175,17 @@ export class HeaderComponent implements OnChanges { const userSetting: UpdateUserSettingDto = {}; for (const filter of filters) { - let filtersType: string; - if (filter.type === 'ACCOUNT') { - filtersType = 'accounts'; + userSetting['filters.accounts'] = filter.id ? [filter.id] : null; } else if (filter.type === 'ASSET_CLASS') { - filtersType = 'assetClasses'; + userSetting['filters.assetClasses'] = filter.id ? [filter.id] : null; + } else if (filter.type === 'DATA_SOURCE') { + userSetting['filters.dataSource'] = filter.id ? filter.id : null; + } else if (filter.type === 'SYMBOL') { + userSetting['filters.symbol'] = filter.id ? filter.id : null; } else if (filter.type === 'TAG') { - filtersType = 'tags'; + userSetting['filters.tags'] = filter.id ? [filter.id] : null; } - - userSetting[`filters.${filtersType}`] = filter.id ? [filter.id] : null; } this.dataService diff --git a/apps/client/src/app/services/data.service.ts b/apps/client/src/app/services/data.service.ts index cde7555b2..dccbb064a 100644 --- a/apps/client/src/app/services/data.service.ts +++ b/apps/client/src/app/services/data.service.ts @@ -532,7 +532,7 @@ export class DataService { }: { filters?: Filter[]; range?: DateRange; - }) { + } = {}) { let params = this.buildFiltersAsQueryParams({ filters }); if (range) { diff --git a/apps/client/src/app/services/user/user.service.ts b/apps/client/src/app/services/user/user.service.ts index 3ecc58c16..aa91a90bd 100644 --- a/apps/client/src/app/services/user/user.service.ts +++ b/apps/client/src/app/services/user/user.service.ts @@ -65,6 +65,20 @@ export class UserService extends ObservableStore { }); } + if (user?.settings['filters.dataSource']) { + filters.push({ + id: user.settings['filters.dataSource'], + type: 'DATA_SOURCE' + }); + } + + if (user?.settings['filters.symbol']) { + filters.push({ + id: user.settings['filters.symbol'], + type: 'SYMBOL' + }); + } + if (user?.settings['filters.tags']) { filters.push({ id: user.settings['filters.tags'][0], diff --git a/libs/common/src/lib/interfaces/user-settings.interface.ts b/libs/common/src/lib/interfaces/user-settings.interface.ts index e9e90e71f..d72be7c7c 100644 --- a/libs/common/src/lib/interfaces/user-settings.interface.ts +++ b/libs/common/src/lib/interfaces/user-settings.interface.ts @@ -14,6 +14,8 @@ export interface UserSettings { dateRange?: DateRange; emergencyFund?: number; 'filters.accounts'?: string[]; + 'filters.dataSource'?: string; + 'filters.symbol'?: string; 'filters.tags'?: string[]; holdingsViewMode?: HoldingsViewMode; isExperimentalFeatures?: boolean; diff --git a/libs/ui/src/lib/assistant/assistant.component.ts b/libs/ui/src/lib/assistant/assistant.component.ts index d73cdb416..3a5e6a2f8 100644 --- a/libs/ui/src/lib/assistant/assistant.component.ts +++ b/libs/ui/src/lib/assistant/assistant.component.ts @@ -1,7 +1,9 @@ import { GfAssetProfileIconComponent } from '@ghostfolio/client/components/asset-profile-icon/asset-profile-icon.component'; +import { GfSymbolModule } from '@ghostfolio/client/pipes/symbol/symbol.module'; import { AdminService } from '@ghostfolio/client/services/admin.service'; import { DataService } from '@ghostfolio/client/services/data.service'; -import { Filter, User } from '@ghostfolio/common/interfaces'; +import { getAssetProfileIdentifier } from '@ghostfolio/common/helper'; +import { Filter, PortfolioPosition, User } from '@ghostfolio/common/interfaces'; import { DateRange } from '@ghostfolio/common/types'; import { translate } from '@ghostfolio/ui/i18n'; @@ -35,7 +37,7 @@ import { MatFormFieldModule } from '@angular/material/form-field'; import { MatMenuTrigger } from '@angular/material/menu'; import { MatSelectModule } from '@angular/material/select'; import { RouterModule } from '@angular/router'; -import { Account, AssetClass } from '@prisma/client'; +import { Account, AssetClass, DataSource } from '@prisma/client'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { EMPTY, Observable, Subject, lastValueFrom } from 'rxjs'; import { @@ -61,6 +63,7 @@ import { FormsModule, GfAssetProfileIconComponent, GfAssistantListItemComponent, + GfSymbolModule, MatButtonModule, MatFormFieldModule, MatSelectModule, @@ -132,8 +135,10 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { public filterForm = this.formBuilder.group({ account: new FormControl(undefined), assetClass: new FormControl(undefined), + holding: new FormControl(undefined), tag: new FormControl(undefined) }); + public holdings: PortfolioPosition[] = []; public isLoading = false; public isOpen = false; public placeholder = $localize`Find holding...`; @@ -144,7 +149,13 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { }; public tags: Filter[] = []; - private filterTypes: Filter['type'][] = ['ACCOUNT', 'ASSET_CLASS', 'TAG']; + private filterTypes: Filter['type'][] = [ + 'ACCOUNT', + 'ASSET_CLASS', + 'DATA_SOURCE', + 'SYMBOL', + 'TAG' + ]; private keyManager: FocusKeyManager; private unsubscribeSubject = new Subject(); @@ -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