Browse Source

Feature/show category in rule settings dialog of X-ray (#5158)

* Show category in rule settings dialog of X-ray

* Update changelog
pull/5166/head^2
Quan Huynh (John) 1 week ago
committed by GitHub
parent
commit
9064b8bde2
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      CHANGELOG.md
  2. 2
      apps/api/src/app/portfolio/rules.service.ts
  3. 2
      apps/api/src/models/rule.ts
  4. 7
      apps/api/src/models/rules/account-cluster-risk/current-investment.ts
  5. 8
      apps/api/src/models/rules/account-cluster-risk/single-account.ts
  6. 7
      apps/api/src/models/rules/asset-class-cluster-risk/equity.ts
  7. 7
      apps/api/src/models/rules/asset-class-cluster-risk/fixed-income.ts
  8. 7
      apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts
  9. 7
      apps/api/src/models/rules/currency-cluster-risk/current-investment.ts
  10. 4
      apps/api/src/models/rules/economic-market-cluster-risk/developed-markets.ts
  11. 4
      apps/api/src/models/rules/economic-market-cluster-risk/emerging-markets.ts
  12. 7
      apps/api/src/models/rules/emergency-fund/emergency-fund-setup.ts
  13. 7
      apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts
  14. 4
      apps/api/src/models/rules/regional-market-cluster-risk/asia-pacific.ts
  15. 4
      apps/api/src/models/rules/regional-market-cluster-risk/emerging-markets.ts
  16. 4
      apps/api/src/models/rules/regional-market-cluster-risk/europe.ts
  17. 4
      apps/api/src/models/rules/regional-market-cluster-risk/japan.ts
  18. 4
      apps/api/src/models/rules/regional-market-cluster-risk/north-america.ts
  19. 2
      apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html
  20. 13
      apps/client/src/app/pages/i18n/i18n-page.html
  21. 1
      libs/common/src/lib/interfaces/portfolio-report-rule.interface.ts

4
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

2
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()

2
apps/api/src/models/rule.ts

@ -70,6 +70,8 @@ export abstract class Rule<T extends RuleSettings> implements RuleInterface<T> {
public abstract evaluate(aRuleSettings: T): EvaluationResult;
public abstract getCategoryName(): string;
public abstract getConfiguration(): Partial<
PortfolioReportRule['configuration']
>;

7
apps/api/src/models/rules/account-cluster-risk/current-investment.ts

@ -85,6 +85,13 @@ export class AccountClusterRiskCurrentInvestment extends Rule<Settings> {
};
}
public getCategoryName() {
return this.i18nService.getTranslation({
id: 'rule.accountClusterRisk.category',
languageCode: this.getLanguageCode()
});
}
public getConfiguration() {
return {
threshold: {

8
apps/api/src/models/rules/account-cluster-risk/single-account.ts

@ -46,6 +46,13 @@ export class AccountClusterRiskSingleAccount extends Rule<RuleSettings> {
};
}
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<RuleSettings> {
id: 'rule.accountClusterRiskSingleAccount',
languageCode: this.getLanguageCode()
});
return 'Single Account';
}
public getSettings({ xRayRules }: UserSettings): RuleSettings {

7
apps/api/src/models/rules/asset-class-cluster-risk/equity.ts

@ -81,6 +81,13 @@ export class AssetClassClusterRiskEquity extends Rule<Settings> {
};
}
public getCategoryName() {
return this.i18nService.getTranslation({
id: 'rule.assetClassClusterRisk.category',
languageCode: this.getLanguageCode()
});
}
public getConfiguration() {
return {
threshold: {

7
apps/api/src/models/rules/asset-class-cluster-risk/fixed-income.ts

@ -81,6 +81,13 @@ export class AssetClassClusterRiskFixedIncome extends Rule<Settings> {
};
}
public getCategoryName() {
return this.i18nService.getTranslation({
id: 'rule.assetClassClusterRisk.category',
languageCode: this.getLanguageCode()
});
}
public getConfiguration() {
return {
threshold: {

7
apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts

@ -79,6 +79,13 @@ export class CurrencyClusterRiskBaseCurrencyCurrentInvestment extends Rule<Setti
};
}
public getCategoryName() {
return this.i18nService.getTranslation({
id: 'rule.currencyClusterRisk.category',
languageCode: this.getLanguageCode()
});
}
public getConfiguration() {
return undefined;
}

7
apps/api/src/models/rules/currency-cluster-risk/current-investment.ts

@ -72,6 +72,13 @@ export class CurrencyClusterRiskCurrentInvestment extends Rule<Settings> {
};
}
public getCategoryName() {
return this.i18nService.getTranslation({
id: 'rule.currencyClusterRisk.category',
languageCode: this.getLanguageCode()
});
}
public getConfiguration() {
return {
threshold: {

4
apps/api/src/models/rules/economic-market-cluster-risk/developed-markets.ts

@ -53,6 +53,10 @@ export class EconomicMarketClusterRiskDevelopedMarkets extends Rule<Settings> {
};
}
public getCategoryName() {
return 'Economic Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation
}
public getConfiguration() {
return {
threshold: {

4
apps/api/src/models/rules/economic-market-cluster-risk/emerging-markets.ts

@ -53,6 +53,10 @@ export class EconomicMarketClusterRiskEmergingMarkets extends Rule<Settings> {
};
}
public getCategoryName() {
return 'Economic Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation
}
public getConfiguration() {
return {
threshold: {

7
apps/api/src/models/rules/emergency-fund/emergency-fund-setup.ts

@ -41,6 +41,13 @@ export class EmergencyFundSetup extends Rule<Settings> {
};
}
public getCategoryName() {
return this.i18nService.getTranslation({
id: 'rule.emergencyFund.category',
languageCode: this.getLanguageCode()
});
}
public getConfiguration() {
return undefined;
}

7
apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts

@ -56,6 +56,13 @@ export class FeeRatioInitialInvestment extends Rule<Settings> {
};
}
public getCategoryName() {
return this.i18nService.getTranslation({
id: 'rule.fees.category',
languageCode: this.getLanguageCode()
});
}
public getConfiguration() {
return {
threshold: {

4
apps/api/src/models/rules/regional-market-cluster-risk/asia-pacific.ts

@ -52,6 +52,10 @@ export class RegionalMarketClusterRiskAsiaPacific extends Rule<Settings> {
};
}
public getCategoryName() {
return 'Regional Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation
}
public getConfiguration() {
return {
threshold: {

4
apps/api/src/models/rules/regional-market-cluster-risk/emerging-markets.ts

@ -54,6 +54,10 @@ export class RegionalMarketClusterRiskEmergingMarkets extends Rule<Settings> {
};
}
public getCategoryName() {
return 'Regional Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation
}
public getConfiguration() {
return {
threshold: {

4
apps/api/src/models/rules/regional-market-cluster-risk/europe.ts

@ -52,6 +52,10 @@ export class RegionalMarketClusterRiskEurope extends Rule<Settings> {
};
}
public getCategoryName() {
return 'Regional Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation
}
public getConfiguration() {
return {
threshold: {

4
apps/api/src/models/rules/regional-market-cluster-risk/japan.ts

@ -52,6 +52,10 @@ export class RegionalMarketClusterRiskJapan extends Rule<Settings> {
};
}
public getCategoryName() {
return 'Regional Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation
}
public getConfiguration() {
return {
threshold: {

4
apps/api/src/models/rules/regional-market-cluster-risk/north-america.ts

@ -52,6 +52,10 @@ export class RegionalMarketClusterRiskNorthAmerica extends Rule<Settings> {
};
}
public getCategoryName() {
return 'Regional Market Cluster Risk'; // TODO: Replace hardcoded text with i18n translation
}
public getConfiguration() {
return {
threshold: {

2
apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html

@ -1,4 +1,4 @@
<div mat-dialog-title>{{ data.rule.name }}</div>
<div mat-dialog-title>{{ data.rule.categoryName }} › {{ data.rule.name }}</div>
<div class="py-3" mat-dialog-content>
@if (

13
apps/client/src/app/pages/i18n/i18n-page.html

@ -11,6 +11,7 @@
performance, portfolio, software, stock, trading, wealth, web3
</li>
<li i18n="@@myAccount">My Account</li>
<li i18n="@@rule.accountClusterRisk.category">Account Cluster Risk</li>
<li i18n="@@rule.accountClusterRiskCurrentInvestment">Investment</li>
<li i18n="@@rule.accountClusterRiskCurrentInvestment.false">
Over $&#123;thresholdMax&#125;% of your current investment is at
@ -28,6 +29,9 @@
<li i18n="@@rule.accountClusterRiskSingleAccount.true">
Your net worth is managed by $&#123;accountsLength&#125; accounts
</li>
<li i18n="@@rule.assetClassClusterRisk.category">
Asset Class Cluster Risk
</li>
<li i18n="@@rule.assetClassClusterRiskEquity">Equity</li>
<li i18n="@@rule.assetClassClusterRiskEquity.false.max">
The equity contribution of your current investment
@ -57,6 +61,7 @@
($&#123;fixedIncomeValueRatio&#125;%) is within the range of
$&#123;thresholdMin&#125;% and $&#123;thresholdMax&#125;%
</li>
<li i18n="@@rule.currencyClusterRisk.category">Currency Cluster Risk</li>
<li i18n="@@rule.currencyClusterRiskBaseCurrencyCurrentInvestment">
Investment: Base Currency
</li>
@ -78,6 +83,10 @@
($&#123;maxValueRatio&#125;%) and does not exceed
$&#123;thresholdMax&#125;%
</li>
<li i18n="@@rule.economicMarketClusterRisk.category">
Economic Market Cluster Risk
</li>
<li i18n="@@rule.emergencyFund.category">Emergency Fund</li>
<li i18n="@@rule.emergencyFundSetup">Set up</li>
<li i18n="@@rule.emergencyFundSetup.false">
No emergency fund has been set up
@ -94,6 +103,10 @@
The fees do not exceed $&#123;thresholdMax&#125;% of your initial
investment ($&#123;feeRatio&#125;%)
</li>
<li i18n="@@rule.fees.category">Fees</li>
<li i18n="@@rule.regionalMarketClusterRisk.category">
Regional Market Cluster Risk
</li>
<li i18n="@@slogan">Open Source Wealth Management Software</li>
</ul>
</div>

1
libs/common/src/lib/interfaces/portfolio-report-rule.interface.ts

@ -1,4 +1,5 @@
export interface PortfolioReportRule {
categoryName: string;
configuration?: {
threshold?: {
max: number;

Loading…
Cancel
Save