From 031e83d7014c52d90f432caceb1bb2a54ff14068 Mon Sep 17 00:00:00 2001 From: aias00 Date: Sun, 18 Aug 2024 09:30:09 +0800 Subject: [PATCH] [bugfix] clear qbdata when cascade change (#2545) Co-authored-by: YuLuo --- .../alert/alert-setting/alert-setting.component.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts b/web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts index beb75d5e8b9..cfcb9326d96 100644 --- a/web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts +++ b/web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts @@ -164,7 +164,7 @@ export class AlertSettingComponent implements OnInit { onNewAlertDefine() { this.define = new AlertDefine(); this.define.tags = []; - this.resetQbData({ condition: 'and', rules: [] }); + this.resetQbDataDefault(); this.isManageModalAdd = true; this.isManageModalVisible = true; this.isManageModalOkLoading = false; @@ -593,6 +593,7 @@ export class AlertSettingComponent implements OnInit { }; cascadeOnChange(values: string[]): void { + this.resetQbDataDefault(); if (values == null || values.length != 3) { return; } @@ -645,7 +646,7 @@ export class AlertSettingComponent implements OnInit { } catch (e) { console.error(e); this.isExpr = true; - this.resetQbData({ condition: 'and', rules: [] }); + this.resetQbDataDefault(); return; } } @@ -653,7 +654,7 @@ export class AlertSettingComponent implements OnInit { onManageModalCancel() { this.cascadeValues = []; this.isExpr = false; - this.resetQbData({ condition: 'and', rules: [] }); + this.resetQbDataDefault(); this.isManageModalVisible = false; } @@ -661,10 +662,14 @@ export class AlertSettingComponent implements OnInit { this.qbFormCtrl.reset((this.qbData = qbData)); } + resetQbDataDefault() { + this.resetQbData({ condition: 'and', rules: [] }); + } + resetManageModalData() { this.cascadeValues = []; this.isExpr = false; - this.resetQbData({ condition: 'and', rules: [] }); + this.resetQbDataDefault(); this.isManageModalVisible = false; }