diff --git a/CHANGELOG.md b/CHANGELOG.md index 6755fa2a7..43d115644 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improved the language localization for Spanish (`es`) - Upgraded `countries-list` from version `3.2.2` to `3.3.0` +### Fixed + +- Fixed the _Save_ button state in the rule settings dialog of the _X-ray_ section + ## 2.251.0 - 2026-03-24 ### Added 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..9366a29ff 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,8 +2,8 @@ import { XRayRulesSettings } from '@ghostfolio/common/interfaces'; import { GfValueComponent } from '@ghostfolio/ui/value'; import { CommonModule } from '@angular/common'; -import { Component, Inject } from '@angular/core'; -import { FormsModule } from '@angular/forms'; +import { Component, Inject, OnInit } from '@angular/core'; +import { FormControl, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MAT_DIALOG_DATA, @@ -17,21 +17,47 @@ import { RuleSettingsDialogParams } from './interfaces/interfaces'; @Component({ imports: [ CommonModule, - FormsModule, GfValueComponent, MatButtonModule, MatDialogModule, - MatSliderModule + MatSliderModule, + ReactiveFormsModule ], selector: 'gf-rule-settings-dialog', styleUrls: ['./rule-settings-dialog.scss'], templateUrl: './rule-settings-dialog.html' }) -export class GfRuleSettingsDialogComponent { +export class GfRuleSettingsDialogComponent implements OnInit { public settings: XRayRulesSettings['AccountClusterRiskCurrentInvestment']; + public thresholdMaxControl: FormControl; + public thresholdMinControl: FormControl; public constructor( @Inject(MAT_DIALOG_DATA) public data: RuleSettingsDialogParams, public dialogRef: MatDialogRef ) {} + + public get isDirty(): boolean { + return this.thresholdMinControl.dirty || this.thresholdMaxControl.dirty; + } + + public ngOnInit() { + this.thresholdMinControl = new FormControl( + this.data.settings.thresholdMin, + { nonNullable: true } + ); + + this.thresholdMaxControl = new FormControl( + this.data.settings.thresholdMax, + { nonNullable: true } + ); + } + + public onSave() { + this.dialogRef.close({ + ...this.data.settings, + thresholdMax: this.thresholdMaxControl.value, + thresholdMin: this.thresholdMinControl.value + }); + } } 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..6d1ad25c3 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 @@ -12,14 +12,14 @@ [isPercent]="data.rule.configuration.threshold.unit === '%'" [locale]="data.locale" [precision]="2" - [value]="data.settings.thresholdMin" + [value]="thresholdMinControl.value" /> -
@@ -35,8 +35,8 @@ [min]="data.rule.configuration.threshold.min" [step]="data.rule.configuration.threshold.step" > - - + +
@@ -75,7 +75,7 @@ [min]="data.rule.configuration.threshold.min" [step]="data.rule.configuration.threshold.step" > - +
@@ -113,7 +113,7 @@ [min]="data.rule.configuration.threshold.min" [step]="data.rule.configuration.threshold.step" > - + Save