summaryrefslogtreecommitdiffstats
path: root/public/src/app/rule-engine/api/rule-engine-api.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'public/src/app/rule-engine/api/rule-engine-api.service.ts')
-rw-r--r--public/src/app/rule-engine/api/rule-engine-api.service.ts50
1 files changed, 37 insertions, 13 deletions
diff --git a/public/src/app/rule-engine/api/rule-engine-api.service.ts b/public/src/app/rule-engine/api/rule-engine-api.service.ts
index 0d7ab5e..7bf5e18 100644
--- a/public/src/app/rule-engine/api/rule-engine-api.service.ts
+++ b/public/src/app/rule-engine/api/rule-engine-api.service.ts
@@ -1,17 +1,17 @@
-import { Injectable, EventEmitter } from '@angular/core';
+import { Injectable } from '@angular/core';
import {
- Http,
- Response,
Headers,
+ Http,
RequestOptions,
+ Response,
URLSearchParams
} from '@angular/http';
-import { Observable, Subject } from 'rxjs/Rx';
+import 'rxjs/add/operator/catch';
// Import RxJs required methods
import 'rxjs/add/operator/map';
-import 'rxjs/add/operator/catch';
-import { environment } from '../../../environments/environment';
+import { Observable, Subject } from 'rxjs/Rx';
import { v4 as uuid } from 'uuid';
+import { environment } from '../../../environments/environment';
@Injectable()
export class RuleEngineApiService {
@@ -25,6 +25,7 @@ export class RuleEngineApiService {
flowType: string;
editorData: Subject<any> = new Subject();
updateVersionLock: Subject<any> = new Subject();
+ tabIndex: Subject<any> = new Subject();
constructor(private http: Http) {
this.baseUrl = `${environment.apiBaseUrl}/rule-editor`;
@@ -108,16 +109,35 @@ export class RuleEngineApiService {
});
}
- translate() {
- const url = `${this.baseUrl}/rule/translate/${this.vfcmtUuid}/${
- this.dcaeCompName
- }/${this.nid}/${this.configParam}`;
+ translate(nofityId) {
+ const url = `${this.baseUrl}/rule/translate`;
+ const params = {
+ vfcmtUuid: this.vfcmtUuid,
+ dcaeCompLabel: this.dcaeCompName,
+ nid: this.nid,
+ configParam: this.configParam,
+ flowType: this.flowType,
+ notifyId: nofityId
+ };
+ this.options.headers.set('X-ECOMP-RequestID', uuid());
+ // const params = new URLSearchParams(); params.append('flowType',
+ // this.flowType); const options = { ...this.options, params: params };
+ return this.http
+ .post(url, params, this.options)
+ .map(response => response.json())
+ .catch((error: any) => {
+ return Observable.throw(error.json().requestError || 'Server error');
+ });
+ }
+
+ generateMappingRulesFileName(dcaeCompLabel, nid, vfcmtUuid) {
+ const url = `${
+ this.baseUrl
+ }/getExistingRuleTargets/${vfcmtUuid}/${dcaeCompLabel}/${nid}`;
this.options.headers.set('X-ECOMP-RequestID', uuid());
const params = new URLSearchParams();
- params.append('flowType', this.flowType);
- const options = { ...this.options, params: params };
return this.http
- .get(url, options)
+ .get(url, this.options)
.map(response => response.json())
.catch((error: any) => {
return Observable.throw(error.json().requestError || 'Server error');
@@ -131,4 +151,8 @@ export class RuleEngineApiService {
callUpdateVersionLock() {
this.updateVersionLock.next();
}
+
+ callUpdateTabIndex(index) {
+ this.tabIndex.next(index);
+ }
}