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 index 65300c6d8..86a3a445d 100644 --- 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 @@ -2,7 +2,7 @@ import { XRayRulesSettings } from '@ghostfolio/common/interfaces'; import { GfValueComponent } from '@ghostfolio/ui/value'; import { CommonModule } from '@angular/common'; -import { Component, Inject } from '@angular/core'; +import { Component, Inject, OnInit } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { @@ -27,11 +27,27 @@ import { RuleSettingsDialogParams } from './interfaces/interfaces'; styleUrls: ['./rule-settings-dialog.scss'], templateUrl: './rule-settings-dialog.html' }) -export class GfRuleSettingsDialogComponent { +export class GfRuleSettingsDialogComponent implements OnInit { + public hasChanges = false; public settings: XRayRulesSettings['AccountClusterRiskCurrentInvestment']; + private originalSettings: XRayRulesSettings['AccountClusterRiskCurrentInvestment']; + public constructor( @Inject(MAT_DIALOG_DATA) public data: RuleSettingsDialogParams, public dialogRef: MatDialogRef ) {} + + public ngOnInit() { + this.originalSettings = { + ...this.data.settings + }; + this.settings = this.data.settings; + } + + public onChange() { + this.hasChanges = + this.settings.thresholdMin !== this.originalSettings.thresholdMin || + this.settings.thresholdMax !== this.originalSettings.thresholdMax; + } } 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 83d4e2d19..37b53a1aa 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 @@ -35,8 +35,8 @@ [min]="data.rule.configuration.threshold.min" [step]="data.rule.configuration.threshold.step" > - - + + - + - + Save