From 6ebc6d22c0654cbdfde1329d5ea7a2f23df5988d Mon Sep 17 00:00:00 2001 From: Guangrong Fu Date: Tue, 16 Aug 2022 17:46:09 +0800 Subject: [PATCH] bugfix - rule query failure with empty criteria Issue-ID: HOLMES-493 Signed-off-by: Guangrong Fu Change-Id: I5ded38ec48f869174a7eec4383ec3488e5eba6d2 --- .../src/app/correlation-ruleList/alarmRule.component.ts | 9 ++++----- .../src/app/correlation-ruleList/alarmRule.service.ts | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/rulemgt-frontend/src/app/correlation-ruleList/alarmRule.component.ts b/rulemgt-frontend/src/app/correlation-ruleList/alarmRule.component.ts index d3897fe..05f36ca 100644 --- a/rulemgt-frontend/src/app/correlation-ruleList/alarmRule.component.ts +++ b/rulemgt-frontend/src/app/correlation-ruleList/alarmRule.component.ts @@ -52,8 +52,7 @@ export class AlarmRule implements OnInit { } else if (select == "common_disabled") { this.ruleModel.enabled = 0; } else { - - this.ruleModel.enabled = null; + this.ruleModel.enabled = 2; } this.setActiveText(); } @@ -116,7 +115,7 @@ export class AlarmRule implements OnInit { public reset(): void { this.ruleModel.ruleName = null; this.activeText = 'option_all'; - this.ruleModel.enabled = null; + this.ruleModel.enabled = 2; this.getRules(); } @@ -144,7 +143,7 @@ export class AlarmRule implements OnInit { creator: null, updateTime: null, modifier: null, - enabled: 0, + enabled: 2, loopControlName: '' }; this.ruleRequest = { @@ -152,7 +151,7 @@ export class AlarmRule implements OnInit { ruleName: null, creator: null, modifier: null, - enabled: null, + enabled: 2, loopControlName: '' }; this.getRules(); diff --git a/rulemgt-frontend/src/app/correlation-ruleList/alarmRule.service.ts b/rulemgt-frontend/src/app/correlation-ruleList/alarmRule.service.ts index ebab289..90964b1 100644 --- a/rulemgt-frontend/src/app/correlation-ruleList/alarmRule.service.ts +++ b/rulemgt-frontend/src/app/correlation-ruleList/alarmRule.service.ts @@ -57,7 +57,7 @@ export class AlarmRuleService { let data = {'ruleId': ruleId}; var queryrequest = JSON.stringify(data); const url = `${this.ruleUrl}?queryrequest=${queryrequest}`; - return this.http.get(url, {headers: this.headers}) + return this.http.get(encodeURI(url)) .toPromise() .then(res => res.json().correlationRules as RuleModel[]) .catch(this.handleError); @@ -67,7 +67,7 @@ export class AlarmRuleService { let data = {ruleName: rule.ruleName, enabled: rule.enabled} console.log(JSON.stringify(data)); const url = `${this.ruleUrl}?queryrequest=${JSON.stringify(data)}` - return this.http.get(url, {body: data, headers: this.headers}) + return this.http.get(encodeURI(url)) .toPromise() .then(res => res.json().correlationRules as RuleModel[]) .catch(this.handleError); -- 2.16.6