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) 10 months ago committed by GitHub
parent d195703e3d
commit 9064b8bde2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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

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

@ -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']
>;

@ -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: {

@ -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 {

@ -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: {

@ -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: {

@ -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;
}

@ -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: {

@ -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: {

@ -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: {

@ -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;
}

@ -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: {

@ -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: {

@ -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: {

@ -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: {

@ -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: {

@ -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: {

@ -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 (

@ -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,4 +1,5 @@
export interface PortfolioReportRule {
categoryName: string;
configuration?: {
threshold?: {
max: number;

Loading…
Cancel
Save