From 0d55c2e3df210da06c3f4c8856d71ec590721810 Mon Sep 17 00:00:00 2001
From: YILI
Date: Sat, 1 Apr 2017 10:12:49 +0800
Subject: Modify i18n file and other bugs
modify i18n configuration in app.component.ts file and modify other bugs
Issue-ID:CLIENT-164
Change-Id: I7d3b1db9fd3f8d8e58ff0ddc84965e457afa3c6b
Signed-off-by: YILI
---
.../src/main/webapp/alarm/app/app.component.ts | 2 +-
.../app/correlation-ruleInfo/ruleInfo.component.ts | 43 ++++++----------------
.../correlation-ruleList/alarmRule.component.html | 16 ++++----
.../correlation-ruleList/alarmRule.component.ts | 23 ++++++++++--
.../app/correlation-ruleList/alarmRule.service.ts | 8 ++--
.../webapp/alarm/app/pages/remote.component.html | 2 -
alarm-analysis/src/main/webapp/alarm/index.html | 12 +++---
7 files changed, 51 insertions(+), 55 deletions(-)
(limited to 'alarm-analysis/src/main')
diff --git a/alarm-analysis/src/main/webapp/alarm/app/app.component.ts b/alarm-analysis/src/main/webapp/alarm/app/app.component.ts
index d6ad1c0e..cc8fdc7e 100644
--- a/alarm-analysis/src/main/webapp/alarm/app/app.component.ts
+++ b/alarm-analysis/src/main/webapp/alarm/app/app.component.ts
@@ -33,7 +33,7 @@ export class AppComponent implements OnInit{
}
ngOnInit():void {
- this.translate.addLangs(["en", "zh"]);
+ this.translate.addLangs(["en-US", "zh-CN"]);
this.translate.setDefaultLang('zh');
let language = this.getLanguage();
this.translate.use(language);
diff --git a/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleInfo/ruleInfo.component.ts b/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleInfo/ruleInfo.component.ts
index 8bcbad5b..26c28b82 100644
--- a/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleInfo/ruleInfo.component.ts
+++ b/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleInfo/ruleInfo.component.ts
@@ -41,18 +41,16 @@ export class RuleInfo implements OnInit {
this.alarmRuleService.checkContent(this.queryRule.content)
.then(res => {
- if (res.status == 200) {
+ if (res._body == 'true') {
this.alarmRuleService.updateRule(this.queryRule)
.then(res => {
- if (res.status == 200) {
+ let resp: string = res._body;
+ if (resp.includes("ruleid")) {
let msg = { title: "modalTitleUpdate", message: "message_update_rule_success" };
this.modalService.getmodalObservable.next(msg);
this.router.navigate(['alarmRule']);
- } else if (res.status == 499) {
- let msg = { title: "modalTitleUpdate", message: "message_exception_rule_fail" };
- this.modalService.getmodalObservable.next(msg);
} else {
- let msg = { title: "modalTitleUpdate", message: "message_other_exception_rule_fail" };
+ let msg = { title: "modalTitleUpdate", message: res._body };
this.modalService.getmodalObservable.next(msg);
}
}).catch(
@@ -62,14 +60,9 @@ export class RuleInfo implements OnInit {
}
);
- } else if (res.status == 499) {
- let msg = { "title": "modalTitleCheck", message: "message_rule_content_repeat_error" };
- this.modalService.getmodalObservable.next(msg);
- return false;
} else {
- let msg = { "title": "modalTitleCheck", message: "message_other_exception_rule_fail" };
+ let msg = { title: "modalTitleUpdate", message: res._body };
this.modalService.getmodalObservable.next(msg);
- return false;
}
})
}
@@ -85,17 +78,15 @@ export class RuleInfo implements OnInit {
this.modalService.getmodalObservable.next(msg);
} else {
this.alarmRuleService.checkContent(this.queryRule.content).then(res => {
- if (res.status == 200) {
+ if (res._body == 'true') {
this.alarmRuleService.save(this.queryRule).then(res => {
- if (res.status == 200) {
+ let resp: string = res._body;
+ if (resp.includes("ruleid")) {
let msg = { title: "modalTitleDefault", message: "message_add_rule_success" };
this.modalService.getmodalObservable.next(msg);
this.router.navigate(['alarmRule']);
- } else if (res.status == 499) {
- let msg = { title: "modalTitleDefault", message: "message_rule_name_repeat_error" };
- this.modalService.getmodalObservable.next(msg);
} else {
- let msg = { "title": "modalTitleCheck", message: "message_other_exception_rule_fail" };
+ let msg = { "title": "modalTitleCheck", message: res._body };
this.modalService.getmodalObservable.next(msg);
}
@@ -103,15 +94,9 @@ export class RuleInfo implements OnInit {
let msg = { title: "modalTitleDefault", message: "message_rule_name_repeat_error" };
this.modalService.getmodalObservable.next(msg);
});
- return true;
- } else if (res.status == 499) {
- let msg = { "title": "modalTitleCheck", message: "message_rule_content_repeat_error" };
- this.modalService.getmodalObservable.next(msg);
- return false;
} else {
- let msg = { "title": "modalTitleCheck", message: "message_other_exception_rule_fail" };
+ let msg = { "title": "modalTitleCheck", message: res._body };
this.modalService.getmodalObservable.next(msg);
- return false;
}
})
}
@@ -132,15 +117,11 @@ export class RuleInfo implements OnInit {
} else {
this.alarmRuleService.checkContent(this.queryRule.content)
.then(res => {
- if (res.status == 200) {
+ if (res._body == 'true') {
let msg = { "title": "modalTitleCheck", message: "message_checkContent_rule_success" };
this.modalService.getmodalObservable.next(msg);
- } else if (res.status == 499) {
- let msg = { "title": "modalTitleCheck", message: "message_rule_content_repeat_error" };
- this.modalService.getmodalObservable.next(msg);
- return false;
} else {
- let msg = { "title": "modalTitleCheck", message: "message_other_exception_rule_fail" };
+ let msg = { "title": "modalTitleCheck", message: res._body };
this.modalService.getmodalObservable.next(msg);
return false;
}
diff --git a/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.component.html b/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.component.html
index 3a259fda..ead93003 100644
--- a/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.component.html
+++ b/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.component.html
@@ -78,27 +78,27 @@
{{rule.rulename}} |
- |
- |
+ |
+ |
{{rule.createtime | date:'yyyy-MM-dd HH:mm:ss'}} |
{{rule.creator}} |
{{rule.updatetime | date:'yyyy-MM-dd HH:mm:ss'}} |
-
+
-
-
+
+
-
-
+
+
-
+
|
diff --git a/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.component.ts b/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.component.ts
index 7fec7a8c..f46ece06 100644
--- a/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.component.ts
+++ b/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.component.ts
@@ -104,11 +104,28 @@ export class AlarmRule implements OnInit {
}
on_off(rule: RuleModel) {
- rule.enabled == 0 ? rule.enabled = 1 : rule.enabled = 0;
+
+ let ru: RuleModel = rule;
+ if (ru.enabled == 0) {
+ ru.enabled = 1;
+ } else {
+ ru.enabled = 0;
+ }
this._alarmRuleService
- .updateRule(rule)
+ .updateRule(ru)
.then(res => {
- rule = res;
+ let resp: string = res._body;
+ if (resp.includes("ruleid")) {
+ if (rule.enabled == 0) {
+ rule.enabled = 1;
+ } else {
+ rule.enabled = 0;
+ }
+ } else {
+ let msg = { title: "modalTitleUpdate", message: resp };
+ this.modalService.getmodalObservable.next(msg);
+ }
+
});
}
diff --git a/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.service.ts b/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.service.ts
index a76319f1..5f84a5ba 100644
--- a/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.service.ts
+++ b/alarm-analysis/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.service.ts
@@ -23,8 +23,8 @@ import { Router } from '@angular/router';
import { ModalService } from '../correlation-modal/modal.service';
@Injectable()
-export class AlarmRuleService {
- private ruleUrl = "/api/correlation-mgt/v1/rule";
+export class AlarmRuleService {//api/holmes-rule-mgmt/v1 /api/correlation-mgt/v1/rul
+ private ruleUrl = "/api/holmes-rule-mgmt/v1/rule";
private headers = new Headers({ 'Content-Type': 'application/json' });
constructor(private http: Http, private modalService: ModalService, private router: Router) { }
@@ -73,8 +73,8 @@ export class AlarmRuleService {
.catch(this.handleError);
}
- checkContent(ruleContent: string): Promise {
- const url = "/api/correlation-engine/v1/rule";
+ checkContent(ruleContent: string): Promise {//api/holmes-engine-mgmt/v1 api/correlation-engine/v1
+ const url = "/api/holmes-engine-mgmt/v1/rule";
let data = { content: ruleContent };
return this.http
.post(url, JSON.stringify(data), { headers: this.headers })
diff --git a/alarm-analysis/src/main/webapp/alarm/app/pages/remote.component.html b/alarm-analysis/src/main/webapp/alarm/app/pages/remote.component.html
index 398159a3..3d8c4838 100644
--- a/alarm-analysis/src/main/webapp/alarm/app/pages/remote.component.html
+++ b/alarm-analysis/src/main/webapp/alarm/app/pages/remote.component.html
@@ -13,7 +13,5 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
\ No newline at end of file
diff --git a/alarm-analysis/src/main/webapp/alarm/index.html b/alarm-analysis/src/main/webapp/alarm/index.html
index 094e972f..234d7160 100644
--- a/alarm-analysis/src/main/webapp/alarm/index.html
+++ b/alarm-analysis/src/main/webapp/alarm/index.html
@@ -20,12 +20,12 @@
-
+
--
cgit 1.2.3-korg