From e0731245a8a7401c6d90d2ff49049dd7cdac10af Mon Sep 17 00:00:00 2001 From: MD-Mushfiqur123 Date: Wed, 13 May 2026 10:07:41 +0600 Subject: [PATCH] fix: disable save button in rule settings dialog until form is dirty --- .../rule-settings-dialog.component.ts | 11 ++++++++++- .../rule-settings-dialog/rule-settings-dialog.html | 9 +++++---- 2 files changed, 15 insertions(+), 5 deletions(-) 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 5c2f3be79..60858b444 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 @@ -26,10 +26,19 @@ import { RuleSettingsDialogParams } from './interfaces/interfaces'; templateUrl: './rule-settings-dialog.html' }) export class GfRuleSettingsDialogComponent { + public hasChanges = false; public settings: XRayRulesSettings['AccountClusterRiskCurrentInvestment']; + private initialSettings: string; + public constructor( @Inject(MAT_DIALOG_DATA) public data: RuleSettingsDialogParams, public dialogRef: MatDialogRef - ) {} + ) { + this.initialSettings = JSON.stringify(data.settings); + } + + public onModelChange() { + this.hasChanges = JSON.stringify(this.data.settings) !== this.initialSettings; + } } 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 c88a9dc9d..bc0e25cdd 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" > - - + + - + - +