diff --git a/CHANGELOG.md b/CHANGELOG.md index 45d3d5fc8..eb0e90e99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- Added the category title to the settings dialog to customize the rule thresholds of the _X-ray_ page (experimental) + ### Changed - Improved the label for asset profiles with `MANUAL` data source in the chart of the asset profile details dialog in the admin control panel diff --git a/apps/api/src/app/portfolio/rules.service.ts b/apps/api/src/app/portfolio/rules.service.ts index 48d1658aa..7f6d964f5 100644 --- a/apps/api/src/app/portfolio/rules.service.ts +++ b/apps/api/src/app/portfolio/rules.service.ts @@ -22,6 +22,7 @@ export class RulesService { return { evaluation, value, + categoryName: rule.getCategoryName(), configuration: rule.getConfiguration(), isActive: true, key: rule.getKey(), @@ -29,6 +30,7 @@ export class RulesService { }; } else { return { + categoryName: rule.getCategoryName(), isActive: false, key: rule.getKey(), name: rule.getName() diff --git a/apps/api/src/models/rule.ts b/apps/api/src/models/rule.ts index 0870be03e..52491a0b7 100644 --- a/apps/api/src/models/rule.ts +++ b/apps/api/src/models/rule.ts @@ -70,6 +70,8 @@ export abstract class Rule implements RuleInterface { public abstract evaluate(aRuleSettings: T): EvaluationResult; + public abstract getCategoryName(): string; + public abstract getConfiguration(): Partial< PortfolioReportRule['configuration'] >; diff --git a/apps/api/src/models/rules/account-cluster-risk/current-investment.ts b/apps/api/src/models/rules/account-cluster-risk/current-investment.ts index 501c9b803..06b2c5a8e 100644 --- a/apps/api/src/models/rules/account-cluster-risk/current-investment.ts +++ b/apps/api/src/models/rules/account-cluster-risk/current-investment.ts @@ -85,6 +85,13 @@ export class AccountClusterRiskCurrentInvestment extends Rule { }; } + public getCategoryName() { + return this.i18nService.getTranslation({ + id: 'rule.accountClusterRisk.category', + languageCode: this.getLanguageCode() + }); + } + public getConfiguration() { return { threshold: { diff --git a/apps/api/src/models/rules/account-cluster-risk/single-account.ts b/apps/api/src/models/rules/account-cluster-risk/single-account.ts index c35cabd9a..ea48f3538 100644 --- a/apps/api/src/models/rules/account-cluster-risk/single-account.ts +++ b/apps/api/src/models/rules/account-cluster-risk/single-account.ts @@ -46,6 +46,13 @@ export class AccountClusterRiskSingleAccount extends Rule { }; } + public getCategoryName() { + return this.i18nService.getTranslation({ + id: 'rule.accountClusterRisk.category', + languageCode: this.getLanguageCode() + }); + } + public getConfiguration() { return undefined; } @@ -55,7 +62,6 @@ export class AccountClusterRiskSingleAccount extends Rule { id: 'rule.accountClusterRiskSingleAccount', languageCode: this.getLanguageCode() }); - return 'Single Account'; } public getSettings({ xRayRules }: UserSettings): RuleSettings { diff --git a/apps/api/src/models/rules/asset-class-cluster-risk/equity.ts b/apps/api/src/models/rules/asset-class-cluster-risk/equity.ts index 704cfdb85..5cef0333c 100644 --- a/apps/api/src/models/rules/asset-class-cluster-risk/equity.ts +++ b/apps/api/src/models/rules/asset-class-cluster-risk/equity.ts @@ -81,6 +81,13 @@ export class AssetClassClusterRiskEquity extends Rule { }; } + public getCategoryName() { + return this.i18nService.getTranslation({ + id: 'rule.assetClassClusterRisk.category', + languageCode: this.getLanguageCode() + }); + } + public getConfiguration() { return { threshold: { diff --git a/apps/api/src/models/rules/asset-class-cluster-risk/fixed-income.ts b/apps/api/src/models/rules/asset-class-cluster-risk/fixed-income.ts index e0ca92311..ec20892e2 100644 --- a/apps/api/src/models/rules/asset-class-cluster-risk/fixed-income.ts +++ b/apps/api/src/models/rules/asset-class-cluster-risk/fixed-income.ts @@ -81,6 +81,13 @@ export class AssetClassClusterRiskFixedIncome extends Rule { }; } + public getCategoryName() { + return this.i18nService.getTranslation({ + id: 'rule.assetClassClusterRisk.category', + languageCode: this.getLanguageCode() + }); + } + public getConfiguration() { return { threshold: { diff --git a/apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts b/apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts index 0bf93e9b9..c427a842e 100644 --- a/apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts +++ b/apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts @@ -79,6 +79,13 @@ export class CurrencyClusterRiskBaseCurrencyCurrentInvestment extends Rule { }; } + public getCategoryName() { + return this.i18nService.getTranslation({ + id: 'rule.currencyClusterRisk.category', + languageCode: this.getLanguageCode() + }); + } + public getConfiguration() { return { threshold: { diff --git a/apps/api/src/models/rules/economic-market-cluster-risk/developed-markets.ts b/apps/api/src/models/rules/economic-market-cluster-risk/developed-markets.ts index 8f3ef0d65..d2c8fdae9 100644 --- a/apps/api/src/models/rules/economic-market-cluster-risk/developed-markets.ts +++ b/apps/api/src/models/rules/economic-market-cluster-risk/developed-markets.ts @@ -53,6 +53,10 @@ export class EconomicMarketClusterRiskDevelopedMarkets extends Rule { }; } + public getCategoryName() { + return 'Economic Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation + } + public getConfiguration() { return { threshold: { diff --git a/apps/api/src/models/rules/economic-market-cluster-risk/emerging-markets.ts b/apps/api/src/models/rules/economic-market-cluster-risk/emerging-markets.ts index 48eff22cf..fd3c0ab67 100644 --- a/apps/api/src/models/rules/economic-market-cluster-risk/emerging-markets.ts +++ b/apps/api/src/models/rules/economic-market-cluster-risk/emerging-markets.ts @@ -53,6 +53,10 @@ export class EconomicMarketClusterRiskEmergingMarkets extends Rule { }; } + public getCategoryName() { + return 'Economic Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation + } + public getConfiguration() { return { threshold: { diff --git a/apps/api/src/models/rules/emergency-fund/emergency-fund-setup.ts b/apps/api/src/models/rules/emergency-fund/emergency-fund-setup.ts index 67c0f297e..1de51d0e7 100644 --- a/apps/api/src/models/rules/emergency-fund/emergency-fund-setup.ts +++ b/apps/api/src/models/rules/emergency-fund/emergency-fund-setup.ts @@ -41,6 +41,13 @@ export class EmergencyFundSetup extends Rule { }; } + public getCategoryName() { + return this.i18nService.getTranslation({ + id: 'rule.emergencyFund.category', + languageCode: this.getLanguageCode() + }); + } + public getConfiguration() { return undefined; } diff --git a/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts b/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts index 89fe32dbf..805b86fd4 100644 --- a/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts +++ b/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts @@ -56,6 +56,13 @@ export class FeeRatioInitialInvestment extends Rule { }; } + public getCategoryName() { + return this.i18nService.getTranslation({ + id: 'rule.fees.category', + languageCode: this.getLanguageCode() + }); + } + public getConfiguration() { return { threshold: { diff --git a/apps/api/src/models/rules/regional-market-cluster-risk/asia-pacific.ts b/apps/api/src/models/rules/regional-market-cluster-risk/asia-pacific.ts index 823da9e27..cadb2f9cd 100644 --- a/apps/api/src/models/rules/regional-market-cluster-risk/asia-pacific.ts +++ b/apps/api/src/models/rules/regional-market-cluster-risk/asia-pacific.ts @@ -52,6 +52,10 @@ export class RegionalMarketClusterRiskAsiaPacific extends Rule { }; } + public getCategoryName() { + return 'Regional Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation + } + public getConfiguration() { return { threshold: { diff --git a/apps/api/src/models/rules/regional-market-cluster-risk/emerging-markets.ts b/apps/api/src/models/rules/regional-market-cluster-risk/emerging-markets.ts index b1ab74e1f..5c582834c 100644 --- a/apps/api/src/models/rules/regional-market-cluster-risk/emerging-markets.ts +++ b/apps/api/src/models/rules/regional-market-cluster-risk/emerging-markets.ts @@ -54,6 +54,10 @@ export class RegionalMarketClusterRiskEmergingMarkets extends Rule { }; } + public getCategoryName() { + return 'Regional Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation + } + public getConfiguration() { return { threshold: { diff --git a/apps/api/src/models/rules/regional-market-cluster-risk/europe.ts b/apps/api/src/models/rules/regional-market-cluster-risk/europe.ts index 3b069cf57..da1781786 100644 --- a/apps/api/src/models/rules/regional-market-cluster-risk/europe.ts +++ b/apps/api/src/models/rules/regional-market-cluster-risk/europe.ts @@ -52,6 +52,10 @@ export class RegionalMarketClusterRiskEurope extends Rule { }; } + public getCategoryName() { + return 'Regional Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation + } + public getConfiguration() { return { threshold: { diff --git a/apps/api/src/models/rules/regional-market-cluster-risk/japan.ts b/apps/api/src/models/rules/regional-market-cluster-risk/japan.ts index 511393cfb..915f3995b 100644 --- a/apps/api/src/models/rules/regional-market-cluster-risk/japan.ts +++ b/apps/api/src/models/rules/regional-market-cluster-risk/japan.ts @@ -52,6 +52,10 @@ export class RegionalMarketClusterRiskJapan extends Rule { }; } + public getCategoryName() { + return 'Regional Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation + } + public getConfiguration() { return { threshold: { diff --git a/apps/api/src/models/rules/regional-market-cluster-risk/north-america.ts b/apps/api/src/models/rules/regional-market-cluster-risk/north-america.ts index 5bea57db1..6322708d5 100644 --- a/apps/api/src/models/rules/regional-market-cluster-risk/north-america.ts +++ b/apps/api/src/models/rules/regional-market-cluster-risk/north-america.ts @@ -52,6 +52,10 @@ export class RegionalMarketClusterRiskNorthAmerica extends Rule { }; } + public getCategoryName() { + return 'Regional Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation + } + public getConfiguration() { return { threshold: { 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 index 97854ad7d..f5903e6d5 100644 --- 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 @@ -1,4 +1,4 @@ -
{{ data.rule.name }}
+
{{ data.rule.categoryName }} › {{ data.rule.name }}
@if ( diff --git a/apps/client/src/app/pages/i18n/i18n-page.html b/apps/client/src/app/pages/i18n/i18n-page.html index 4bb8c990d..d19b8bb98 100644 --- a/apps/client/src/app/pages/i18n/i18n-page.html +++ b/apps/client/src/app/pages/i18n/i18n-page.html @@ -11,6 +11,7 @@ performance, portfolio, software, stock, trading, wealth, web3
  • My Account
  • +
  • Account Cluster Risk
  • Investment
  • Over ${thresholdMax}% of your current investment is at @@ -28,6 +29,9 @@
  • Your net worth is managed by ${accountsLength} accounts
  • +
  • + Asset Class Cluster Risk +
  • Equity
  • The equity contribution of your current investment @@ -57,6 +61,7 @@ (${fixedIncomeValueRatio}%) is within the range of ${thresholdMin}% and ${thresholdMax}%
  • +
  • Currency Cluster Risk
  • Investment: Base Currency
  • @@ -78,6 +83,10 @@ (${maxValueRatio}%) and does not exceed ${thresholdMax}% +
  • + Economic Market Cluster Risk +
  • +
  • Emergency Fund
  • Set up
  • No emergency fund has been set up @@ -94,6 +103,10 @@ The fees do not exceed ${thresholdMax}% of your initial investment (${feeRatio}%)
  • +
  • Fees
  • +
  • + Regional Market Cluster Risk +
  • Open Source Wealth Management Software
  • 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 0296606b8..4df7a8eac 100644 --- a/libs/common/src/lib/interfaces/portfolio-report-rule.interface.ts +++ b/libs/common/src/lib/interfaces/portfolio-report-rule.interface.ts @@ -1,4 +1,5 @@ export interface PortfolioReportRule { + categoryName: string; configuration?: { threshold?: { max: number;