From 101e5e37f4ece60af8d08020c7e4bd8f473adce7 Mon Sep 17 00:00:00 2001 From: zhangab Date: Thu, 18 Oct 2018 12:36:05 +0800 Subject: Update usecase-ui version for R3 Change-Id: I6d9b3e71f69d17d34dc5f5074a6f2d7025516e58 Issue-ID: USECASEUI-153 Signed-off-by: zhangab --- .../app/correlation-ruleList/alarmRule.service.ts | 123 --------------------- 1 file changed, 123 deletions(-) delete mode 100644 usecaseui-holmes/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.service.ts (limited to 'usecaseui-holmes/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.service.ts') diff --git a/usecaseui-holmes/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.service.ts b/usecaseui-holmes/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.service.ts deleted file mode 100644 index c0ca2ad2..00000000 --- a/usecaseui-holmes/src/main/webapp/alarm/app/correlation-ruleList/alarmRule.service.ts +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright 2017 ZTE Corporation. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -import { Injectable } from '@angular/core'; -import { Http, Response, Headers } from '@angular/http'; -import 'rxjs/add/operator/toPromise'; -import 'rxjs/add/operator/map'; -import { RuleModel } from './alarmRule'; -import { RuleRequest } from './ruleRequest' -import { Router } from '@angular/router'; -import { ModalService } from '../correlation-modal/modal.service'; - -@Injectable() -export class AlarmRuleService { - 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) { } - - getRules(): Promise { - return this.http.get(this.ruleUrl) - .toPromise() - .then(res => res.json()) - .catch(this.handleError); - } - - private handleError(error: any): Promise { - console.error('An error occurred', error); - return Promise.reject(error._body || error); - } - - search(ruleid: string): Promise { - if (typeof (ruleid) == "string") { - let rule = [{ - ruleid: null, - rulename: null, - description: null, - content: null, - createtime: null, - creator: null, - updatetime: null, - modifier: null, - enabled: 0, - }] - } - let data = { 'ruleid': ruleid }; - var queryrequest = JSON.stringify(data); - const url = `${this.ruleUrl}?queryrequest=${queryrequest}`; - return this.http.get(url, {headers:this.headers}) - .toPromise() - .then(res => res.json().rules as RuleModel) - .catch(this.handleError); - } - - searchrules(rule: RuleRequest): Promise { - 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 }) - .toPromise() - .then(res => res.json().rules as RuleModel[]) - .catch(this.handleError); - } - - checkContent(ruleContent: string): Promise { - const url = "/api/holmes-engine-mgmt/v1/rule"; - let data = { content: ruleContent }; - return this.http - .post(url, JSON.stringify(data), { headers: this.headers }) - .toPromise() - .then(res => res) - .catch(error => error); - } - - updateRule(rule: RuleModel): Promise { - let rules = { - "ruleid": rule.ruleid, - "description": rule.description, - "content": rule.content, - "enabled": rule.enabled - } - const url = `${this.ruleUrl}` - return this.http - .post(url, JSON.stringify(rules), { headers: this.headers }) - .toPromise() - .then(res => res) - .catch(error => error) - } - - save(rule: RuleModel): Promise { - let ruledata = { - "description": rule.description, - "content": rule.content, - "enabled": rule.enabled, - "rulename": rule.rulename - } - return this.http.put(this.ruleUrl, JSON.stringify(ruledata), { headers: this.headers }) - .toPromise() - .then(res => res) - .catch(error => error); - } - - public delete(ruleid: string): Promise { - const url = `${this.ruleUrl}` + '/' + ruleid; - return this.http.delete(url, { headers: this.headers }) - .toPromise() - .then(res => { - - }) - .catch(this.handleError); - } -} \ No newline at end of file -- cgit 1.2.3-korg