From 0ef2b828520f30ef5a296158ba31334e6e23ac56 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Thu, 12 Sep 2024 20:33:21 +0200 Subject: [PATCH 1/9] Bugfix/fix destructuring in activities filters (#3756) * Provide default value during destructuring * Update changelog --- CHANGELOG.md | 6 ++++++ apps/client/src/app/services/data.service.ts | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1779a268d..4b2072118 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 + +### Fixed + +- Fixed an issue in the activities filters that occured during destructuring + ## 2.107.0 - 2024-09-10 ### Added diff --git a/apps/client/src/app/services/data.service.ts b/apps/client/src/app/services/data.service.ts index 64376a606..cbdde0265 100644 --- a/apps/client/src/app/services/data.service.ts +++ b/apps/client/src/app/services/data.service.ts @@ -72,11 +72,11 @@ export class DataService { ACCOUNT: filtersByAccount, ASSET_CLASS: filtersByAssetClass, ASSET_SUB_CLASS: filtersByAssetSubClass, - DATA_SOURCE: [filterByDataSource], + DATA_SOURCE: [filterByDataSource] = [], HOLDING_TYPE: filtersByHoldingType, PRESET_ID: filtersByPresetId, SEARCH_QUERY: filtersBySearchQuery, - SYMBOL: [filterBySymbol], + SYMBOL: [filterBySymbol] = [], TAG: filtersByTag } = groupBy(filters, (filter) => { return filter.type; From 5a4f1c03cbc8bc38d96e8d117fcffffeacc3f2c2 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Thu, 12 Sep 2024 20:34:06 +0200 Subject: [PATCH 2/9] Feature/extend personal finance tools (#3751) Add etops --- libs/common/src/lib/personal-finance-tools.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/common/src/lib/personal-finance-tools.ts b/libs/common/src/lib/personal-finance-tools.ts index e19b1eb5b..ec1d78564 100644 --- a/libs/common/src/lib/personal-finance-tools.ts +++ b/libs/common/src/lib/personal-finance-tools.ts @@ -163,6 +163,14 @@ export const personalFinanceTools: Product[] = [ origin: 'United States', slogan: 'Portfolio Tracker Designed by Professional Investors' }, + { + founded: 2010, + hasFreePlan: false, + key: 'etops', + name: 'etops', + origin: 'Switzerland', + slogan: 'Your financial superpower' + }, { founded: 2020, hasFreePlan: true, From 7b8dc480f4fefa4f6c02cfd71af77ac67848eacb Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Thu, 12 Sep 2024 20:35:42 +0200 Subject: [PATCH 3/9] Release 2.107.1 (#3757) --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b2072118..0042fa7d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ 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 +## 2.107.1 - 2024-09-12 ### Fixed diff --git a/package.json b/package.json index 3a91229f0..4bdb8e19d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghostfolio", - "version": "2.107.0", + "version": "2.107.1", "homepage": "https://ghostfol.io", "license": "AGPL-3.0", "repository": "https://github.com/ghostfolio/ghostfolio", From 8735fc3fad9c5a119c75e2b6604daf1f65994970 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 14 Sep 2024 10:27:12 +0200 Subject: [PATCH 4/9] Bugfix/fix typo in changelog (#3758) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0042fa7d0..273b5457e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Fixed an issue in the activities filters that occured during destructuring +- Fixed an issue in the activities filters that occurred during destructuring ## 2.107.0 - 2024-09-10 From 323cfbfcaa7d3700af02508d0b63d231f08af34f Mon Sep 17 00:00:00 2001 From: Shaunak Das <51281688+shaun-ak@users.noreply.github.com> Date: Sat, 14 Sep 2024 14:23:39 +0530 Subject: [PATCH 5/9] Feature/introduce filters in account endpoint (#3764) * Introduce filters in acount endpoint * Integrate endpoint in holding detail dialog * Update changelog --------- Co-authored-by: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> --- CHANGELOG.md | 10 +++++++ .../api/src/app/account/account.controller.ts | 15 +++++++++- apps/api/src/app/account/account.module.ts | 2 ++ .../src/app/portfolio/portfolio.service.ts | 29 ++++++++++++++++--- .../holding-detail-dialog.component.ts | 24 +++++++++++---- apps/client/src/app/services/data.service.ts | 6 ++-- 6 files changed, 73 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 273b5457e..b69e9703f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ 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 + +### Added + +- Introduced filters (`dataSource` and `symbol`) in the accounts endpoint + +### Changed + +- Switched to the accounts endpoint in the holding detail dialog + ## 2.107.1 - 2024-09-12 ### Fixed diff --git a/apps/api/src/app/account/account.controller.ts b/apps/api/src/app/account/account.controller.ts index 594a733f7..d8c3dd002 100644 --- a/apps/api/src/app/account/account.controller.ts +++ b/apps/api/src/app/account/account.controller.ts @@ -3,6 +3,8 @@ import { PortfolioService } from '@ghostfolio/api/app/portfolio/portfolio.servic import { HasPermission } from '@ghostfolio/api/decorators/has-permission.decorator'; import { HasPermissionGuard } from '@ghostfolio/api/guards/has-permission.guard'; import { RedactValuesInResponseInterceptor } from '@ghostfolio/api/interceptors/redact-values-in-response/redact-values-in-response.interceptor'; +import { TransformDataSourceInRequestInterceptor } from '@ghostfolio/api/interceptors/transform-data-source-in-request/transform-data-source-in-request.interceptor'; +import { ApiService } from '@ghostfolio/api/services/api/api.service'; import { ImpersonationService } from '@ghostfolio/api/services/impersonation/impersonation.service'; import { HEADER_KEY_IMPERSONATION } from '@ghostfolio/common/config'; import { @@ -26,6 +28,7 @@ import { Param, Post, Put, + Query, UseGuards, UseInterceptors } from '@nestjs/common'; @@ -44,6 +47,7 @@ export class AccountController { public constructor( private readonly accountBalanceService: AccountBalanceService, private readonly accountService: AccountService, + private readonly apiService: ApiService, private readonly impersonationService: ImpersonationService, private readonly portfolioService: PortfolioService, @Inject(REQUEST) private readonly request: RequestWithUser @@ -84,13 +88,22 @@ export class AccountController { @Get() @UseGuards(AuthGuard('jwt'), HasPermissionGuard) @UseInterceptors(RedactValuesInResponseInterceptor) + @UseInterceptors(TransformDataSourceInRequestInterceptor) public async getAllAccounts( - @Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId + @Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId, + @Query('dataSource') filterByDataSource?: string, + @Query('symbol') filterBySymbol?: string ): Promise { const impersonationUserId = await this.impersonationService.validateImpersonationId(impersonationId); + const filters = this.apiService.buildFiltersFromQueryParams({ + filterByDataSource, + filterBySymbol + }); + return this.portfolioService.getAccountsWithAggregations({ + filters, userId: impersonationUserId || this.request.user.id, withExcludedAccounts: true }); diff --git a/apps/api/src/app/account/account.module.ts b/apps/api/src/app/account/account.module.ts index 1c2d20216..fb89bb2b6 100644 --- a/apps/api/src/app/account/account.module.ts +++ b/apps/api/src/app/account/account.module.ts @@ -1,6 +1,7 @@ import { AccountBalanceModule } from '@ghostfolio/api/app/account-balance/account-balance.module'; import { PortfolioModule } from '@ghostfolio/api/app/portfolio/portfolio.module'; import { RedactValuesInResponseModule } from '@ghostfolio/api/interceptors/redact-values-in-response/redact-values-in-response.module'; +import { ApiModule } from '@ghostfolio/api/services/api/api.module'; import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; import { ImpersonationModule } from '@ghostfolio/api/services/impersonation/impersonation.module'; @@ -16,6 +17,7 @@ import { AccountService } from './account.service'; exports: [AccountService], imports: [ AccountBalanceModule, + ApiModule, ConfigurationModule, ExchangeRateDataModule, ImpersonationModule, diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 0cd602046..e1dfc888d 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -115,12 +115,33 @@ export class PortfolioService { }): Promise { const where: Prisma.AccountWhereInput = { userId }; - const accountFilter = filters?.find(({ type }) => { + const filterByAccount = filters?.find(({ type }) => { return type === 'ACCOUNT'; - }); + })?.id; + + const filterByDataSource = filters?.find(({ type }) => { + return type === 'DATA_SOURCE'; + })?.id; + + const filterBySymbol = filters?.find(({ type }) => { + return type === 'SYMBOL'; + })?.id; - if (accountFilter) { - where.id = accountFilter.id; + if (filterByAccount) { + where.id = filterByAccount; + } + + if (filterByDataSource && filterBySymbol) { + where.Order = { + some: { + SymbolProfile: { + AND: [ + { dataSource: filterByDataSource }, + { symbol: filterBySymbol } + ] + } + } + }; } const [accounts, details] = await Promise.all([ 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 70cd08874..8541f65ac 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 @@ -9,6 +9,7 @@ import { DATE_FORMAT, downloadAsFile } from '@ghostfolio/common/helper'; import { DataProviderInfo, EnhancedSymbolProfile, + Filter, LineChartItem, User } from '@ghostfolio/common/interfaces'; @@ -152,6 +153,11 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit { tags: [] }); + const filters: Filter[] = [ + { id: this.data.dataSource, type: 'DATA_SOURCE' }, + { id: this.data.symbol, type: 'SYMBOL' } + ]; + this.tagsAvailable = tags.map(({ id, name }) => { return { id, @@ -173,12 +179,20 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit { .subscribe(); }); + this.dataService + .fetchAccounts({ + filters + }) + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe(({ accounts }) => { + this.accounts = accounts; + + this.changeDetectorRef.markForCheck(); + }); + this.dataService .fetchActivities({ - filters: [ - { id: this.data.dataSource, type: 'DATA_SOURCE' }, - { id: this.data.symbol, type: 'SYMBOL' } - ], + filters, sortColumn: this.sortColumn, sortDirection: this.sortDirection }) @@ -197,7 +211,6 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit { .pipe(takeUntil(this.unsubscribeSubject)) .subscribe( ({ - accounts, averagePrice, dataProviderInfo, dividendInBaseCurrency, @@ -219,7 +232,6 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit { transactionCount, value }) => { - this.accounts = accounts; this.averagePrice = averagePrice; this.benchmarkDataItems = []; this.countries = {}; diff --git a/apps/client/src/app/services/data.service.ts b/apps/client/src/app/services/data.service.ts index cbdde0265..78373adcc 100644 --- a/apps/client/src/app/services/data.service.ts +++ b/apps/client/src/app/services/data.service.ts @@ -173,8 +173,10 @@ export class DataService { ); } - public fetchAccounts() { - return this.http.get('/api/v1/account'); + public fetchAccounts({ filters }: { filters?: Filter[] } = {}) { + const params = this.buildFiltersAsQueryParams({ filters }); + + return this.http.get('/api/v1/account', { params }); } public fetchActivities({ From d236ecfe8501201a344d8e345a186f294ca1b032 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 14 Sep 2024 17:29:01 +0200 Subject: [PATCH 6/9] Feature/extend personal finance tools 20240914 (#3767) * Add Buxfer * Add Moneydance * Add Banktivity * Add Microsoft Money * Add Masttro * Add WealthPosition --- libs/common/src/lib/personal-finance-tools.ts | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/libs/common/src/lib/personal-finance-tools.ts b/libs/common/src/lib/personal-finance-tools.ts index ec1d78564..29fcc391e 100644 --- a/libs/common/src/lib/personal-finance-tools.ts +++ b/libs/common/src/lib/personal-finance-tools.ts @@ -44,6 +44,15 @@ export const personalFinanceTools: Product[] = [ pricingPerYear: '$120', slogan: 'Analyze and track your portfolio.' }, + { + hasFreePlan: false, + hasSelfHostingAbility: true, + key: 'banktivity', + name: 'Banktivity', + origin: 'United States', + pricingPerYear: '$59.99', + slogan: 'Proactive money management app for macOS & iOS' + }, { founded: 2022, hasFreePlan: true, @@ -62,6 +71,17 @@ export const personalFinanceTools: Product[] = [ pricingPerYear: '$100', slogan: 'Stock Portfolio Tracker for Smart Investors' }, + { + founded: 2007, + hasFreePlan: false, + hasSelfHostingAbility: false, + key: 'buxfer', + name: 'Buxfer', + origin: 'United States', + pricingPerYear: '$48', + regions: ['Global'], + slogan: 'Take control of your financial future' + }, { founded: 2013, hasFreePlan: true, @@ -329,6 +349,13 @@ export const personalFinanceTools: Product[] = [ regions: ['Global'], slogan: 'Track your investments' }, + { + founded: 2010, + key: 'masttro', + name: 'Masttro', + origin: 'United States', + slogan: 'Your platform for wealth in full view' + }, { founded: 2021, hasSelfHostingAbility: false, @@ -352,6 +379,14 @@ export const personalFinanceTools: Product[] = [ regions: ['Canada', 'United States'], slogan: 'The smartest way to track your crypto' }, + { + founded: 1991, + hasSelfHostingAbility: true, + key: 'microsoft-money', + name: 'Microsoft Money', + note: 'Microsoft Money was discontinued in 2010', + origin: 'United States' + }, { founded: 2019, hasFreePlan: false, @@ -362,6 +397,16 @@ export const personalFinanceTools: Product[] = [ pricingPerYear: '$99.99', slogan: 'The modern way to manage your money' }, + { + founded: 1999, + hasFreePlan: false, + hasSelfHostingAbility: true, + key: 'moneydance', + name: 'Moneydance', + origin: 'Scotland', + pricingPerYear: '$100', + slogan: 'Personal Finance Manager for Mac, Windows, and Linux' + }, { hasFreePlan: false, hasSelfHostingAbility: false, @@ -640,6 +685,14 @@ export const personalFinanceTools: Product[] = [ pricingPerYear: '$50', slogan: 'See all your investments in one place' }, + { + founded: 2018, + hasFreePlan: true, + key: 'wealthposition', + name: 'WealthPosition', + pricingPerYear: '$60', + slogan: 'Personal Finance & Budgeting App' + }, { founded: 2018, hasSelfHostingAbility: false, From 9fb80e5067e991b101813d7b0782dc99df78cb46 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 14 Sep 2024 17:29:52 +0200 Subject: [PATCH 7/9] Feature/remove accounts from holding endpoint (#3765) * Clean up accounts --- .../portfolio-holding-detail.interface.ts | 3 +-- apps/api/src/app/portfolio/portfolio.service.ts | 14 +------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/apps/api/src/app/portfolio/interfaces/portfolio-holding-detail.interface.ts b/apps/api/src/app/portfolio/interfaces/portfolio-holding-detail.interface.ts index 3ce23a3bc..79e4d40dc 100644 --- a/apps/api/src/app/portfolio/interfaces/portfolio-holding-detail.interface.ts +++ b/apps/api/src/app/portfolio/interfaces/portfolio-holding-detail.interface.ts @@ -5,10 +5,9 @@ import { HistoricalDataItem } from '@ghostfolio/common/interfaces'; -import { Account, Tag } from '@prisma/client'; +import { Tag } from '@prisma/client'; export interface PortfolioHoldingDetail { - accounts: Account[]; averagePrice: number; dataProviderInfo: DataProviderInfo; dividendInBaseCurrency: number; diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index e1dfc888d..39ac9cc6f 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -73,7 +73,7 @@ import { parseISO, set } from 'date-fns'; -import { isEmpty, last, uniq, uniqBy } from 'lodash'; +import { isEmpty, last, uniq } from 'lodash'; import { PortfolioCalculator } from './calculator/portfolio-calculator'; import { @@ -625,7 +625,6 @@ export class PortfolioService { if (activities.length === 0) { return { - accounts: [], averagePrice: undefined, dataProviderInfo: undefined, dividendInBaseCurrency: undefined, @@ -699,15 +698,6 @@ export class PortfolioService { ); }); - const accounts: PortfolioHoldingDetail['accounts'] = uniqBy( - activitiesOfPosition.filter(({ Account }) => { - return Account; - }), - 'Account.id' - ).map(({ Account }) => { - return Account; - }); - const dividendYieldPercent = getAnnualizedPerformancePercent({ daysInMarket: differenceInDays(new Date(), parseDate(firstBuyDate)), netPerformancePercentage: timeWeightedInvestment.eq(0) @@ -788,7 +778,6 @@ export class PortfolioService { } return { - accounts, firstBuyDate, marketPrice, maxPrice, @@ -883,7 +872,6 @@ export class PortfolioService { maxPrice, minPrice, SymbolProfile, - accounts: [], averagePrice: 0, dataProviderInfo: undefined, dividendInBaseCurrency: 0, From 3de192c65ef65b8e0e4b9c8f26a3921e1524d073 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 14 Sep 2024 19:42:37 +0200 Subject: [PATCH 8/9] Feature/expose thresholds in rule settings (#3770) --- apps/api/src/app/portfolio/rules.service.ts | 21 ++++++++++++------- .../portfolio-report-rule.interface.ts | 4 ++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/apps/api/src/app/portfolio/rules.service.ts b/apps/api/src/app/portfolio/rules.service.ts index 6b6526144..fd9d794b2 100644 --- a/apps/api/src/app/portfolio/rules.service.ts +++ b/apps/api/src/app/portfolio/rules.service.ts @@ -1,6 +1,9 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; import { Rule } from '@ghostfolio/api/models/rule'; -import { UserSettings } from '@ghostfolio/common/interfaces'; +import { + PortfolioReportRule, + UserSettings +} from '@ghostfolio/common/interfaces'; import { Injectable } from '@nestjs/common'; @@ -11,19 +14,23 @@ export class RulesService { public async evaluate( aRules: Rule[], aUserSettings: UserSettings - ) { + ): Promise { return aRules.map((rule) => { - if (rule.getSettings(aUserSettings)?.isActive) { - const { evaluation, value } = rule.evaluate( - rule.getSettings(aUserSettings) - ); + const settings = rule.getSettings(aUserSettings); + + if (settings?.isActive) { + const { evaluation, value } = rule.evaluate(settings); return { evaluation, value, isActive: true, key: rule.getKey(), - name: rule.getName() + name: rule.getName(), + settings: { + thresholdMax: settings['thresholdMax'], + thresholdMin: settings['thresholdMin'] + } }; } else { return { diff --git a/libs/common/src/lib/interfaces/portfolio-report-rule.interface.ts b/libs/common/src/lib/interfaces/portfolio-report-rule.interface.ts index 61fe389af..29cbb4a8f 100644 --- a/libs/common/src/lib/interfaces/portfolio-report-rule.interface.ts +++ b/libs/common/src/lib/interfaces/portfolio-report-rule.interface.ts @@ -3,5 +3,9 @@ export interface PortfolioReportRule { isActive: boolean; key: string; name: string; + settings?: { + thresholdMax?: number; + thresholdMin?: number; + }; value?: boolean; } From fbf377f67f938395e961dbf599349e0f9156d4a8 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 14 Sep 2024 20:44:36 +0200 Subject: [PATCH 9/9] Feature/set up rule settings dialog (#3771) --- .../interfaces/interfaces.ts | 5 ++ .../rule-settings-dialog.component.ts | 40 +++++++++++++++ .../rule-settings-dialog.html | 23 +++++++++ .../rule-settings-dialog.scss | 2 + .../app/components/rule/rule.component.html | 5 ++ .../src/app/components/rule/rule.component.ts | 49 ++++++++++++++++++- 6 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 apps/client/src/app/components/rule/rule-settings-dialog/interfaces/interfaces.ts create mode 100644 apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts create mode 100644 apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html create mode 100644 apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.scss diff --git a/apps/client/src/app/components/rule/rule-settings-dialog/interfaces/interfaces.ts b/apps/client/src/app/components/rule/rule-settings-dialog/interfaces/interfaces.ts new file mode 100644 index 000000000..a409ab503 --- /dev/null +++ b/apps/client/src/app/components/rule/rule-settings-dialog/interfaces/interfaces.ts @@ -0,0 +1,5 @@ +import { PortfolioReportRule } from '@ghostfolio/common/interfaces'; + +export interface IRuleSettingsDialogParams { + rule: PortfolioReportRule; +} diff --git a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts new file mode 100644 index 000000000..41ebf49db --- /dev/null +++ b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts @@ -0,0 +1,40 @@ +import { PortfolioReportRule } from '@ghostfolio/common/interfaces'; + +import { CommonModule } from '@angular/common'; +import { Component, Inject } from '@angular/core'; +import { MatButtonModule } from '@angular/material/button'; +import { + MAT_DIALOG_DATA, + MatDialogModule, + MatDialogRef +} from '@angular/material/dialog'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; + +import { IRuleSettingsDialogParams } from './interfaces/interfaces'; + +@Component({ + imports: [ + CommonModule, + MatButtonModule, + MatDialogModule, + MatFormFieldModule, + MatInputModule + ], + selector: 'gf-rule-settings-dialog', + standalone: true, + styleUrls: ['./rule-settings-dialog.scss'], + templateUrl: './rule-settings-dialog.html' +}) +export class GfRuleSettingsDialogComponent { + public settings: PortfolioReportRule['settings']; + + public constructor( + @Inject(MAT_DIALOG_DATA) public data: IRuleSettingsDialogParams, + public dialogRef: MatDialogRef + ) { + console.log(this.data.rule); + + this.settings = this.data.rule.settings; + } +} diff --git a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html new file mode 100644 index 000000000..e24db29f7 --- /dev/null +++ b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html @@ -0,0 +1,23 @@ +
{{ data.rule.name }}
+ +
+ + Threshold Min + + + + Threshold Max + + +
+ +
+ + +
diff --git a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.scss b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.scss new file mode 100644 index 000000000..dc9093b45 --- /dev/null +++ b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.scss @@ -0,0 +1,2 @@ +:host { +} diff --git a/apps/client/src/app/components/rule/rule.component.html b/apps/client/src/app/components/rule/rule.component.html index 80b442b7b..f19436aba 100644 --- a/apps/client/src/app/components/rule/rule.component.html +++ b/apps/client/src/app/components/rule/rule.component.html @@ -62,6 +62,11 @@ + @if (rule?.isActive && !isEmpty(rule.settings) && false) { + + }