2 ============LICENSE_START==========================================
 
   3 ===================================================================
 
   4 Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
 
   5 ===================================================================
 
   7 Unless otherwise specified, all software contained herein is licensed
 
   8 under the Apache License, Version 2.0 (the License);
 
   9 you may not use this software except in compliance with the License.
 
  10 You may obtain a copy of the License at
 
  12     http://www.apache.org/licenses/LICENSE-2.0
 
  14 Unless required by applicable law or agreed to in writing, software
 
  15 distributed under the License is distributed on an "AS IS" BASIS,
 
  16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  17 See the License for the specific language governing permissions and
 
  18 limitations under the License.
 
  20 ECOMP is a trademark and service mark of AT&T Intellectual Property.
 
  21 ============LICENSE_END============================================
 
  24 import { Component, Input, OnInit, ViewChild } from '@angular/core';
 
  25 import { HttpUtilService } from '../../../../shared/services/httpUtil/http-util.service';
 
  26 import { MappingEditorService } from '../../../../shared/services/mapping-editor.service';
 
  27 import { ArtifactRequest } from '../../../../shared/models/index';
 
  28 import { ActivatedRoute, Router } from '@angular/router';
 
  29 import { saveAs } from 'file-saver';
 
  30 import { NotificationService } from '../../../../shared/services/notification.service';
 
  31 import { NotificationsService } from 'angular2-notifications';
 
  32 import { ParamShareService } from '../../../../shared/services/paramShare.service';
 
  33 import { DialogService } from 'ng2-bootstrap-modal';
 
  34 import { ConfirmComponent } from '../../../../shared/confirmModal/confirm.component';
 
  35 import { BuildDesignComponent } from '../../build-artifacts.component';
 
  36 import { environment } from '../../../../../environments/environment';
 
  37 import { ModalComponent } from 'ng2-bs3-modal/ng2-bs3-modal';
 
  38 import { NgProgress } from 'ngx-progressbar';
 
  41 @Component({ selector: 'app-golden-configuration', templateUrl: './template-configuration.component.html', styleUrls: ['./template-configuration.component.css'] })
 
  42 export class GoldenConfigurationComponent implements OnInit {
 
  43   @ViewChild('templateeditor') templateeditor;
 
  44   @Input() configMappingEditorContent: string;
 
  45   @Input() isMappingComp: boolean;
 
  46   @ViewChild('myInput') myInputVariable: any;
 
  47   @ViewChild('myModal') modal: ModalComponent;
 
  50   showTemplateVersionDiv: any;
 
  51   downloadedTemplateFileName: any;
 
  52   downloadedParamFileName: any;
 
  53   templateVersionNo: any = '0.0.1';
 
  54   saveToGuiCacheFlag = 'false';
 
  56   public referenceData: Array<Object> = [];
 
  57   public scopeName: any;
 
  58   public subscription: any;
 
  59   public item: any = {};
 
  60   public goldenActions: Array<string> = [];
 
  61   public refNameObj = {};
 
  63   public artifactName = '';
 
  65   public showError: boolean = false;
 
  66   public tempretrieveFlag: boolean = false;
 
  67   public fileNameForTempSave;
 
  69   showDownloadDiv: boolean = false;
 
  71   enableBrowse: boolean = true;
 
  72   enableMerge: boolean = false;
 
  73   uploadValidationSuccess: boolean = false;
 
  74   fileExtension: any = "xml";
 
  75   apiToken = localStorage['apiToken'];
 
  76   public appDataObject: any;
 
  77   public downloadDataObject: any;
 
  78   public checkNameEntered: boolean = true;
 
  79   public selectedWord: any = this.mappingEditorService.getSelectedWord();
 
  81     { action: "ConfigBackup", value: "ConfigBackup" },
 
  82     { action: "ConfigModify", value: "ConfigModify" },
 
  83     { action: "ConfigRestore", value: "ConfigRestore" },
 
  84     { action: "Configure", value: "Configure" },
 
  85     { action: "GetRunningConfig", value: "GetRunningConfig" },
 
  86     { action: "HealthCheck", value: "HealthCheck" },
 
  87     { action: "StartApplication", value: "StartApplication" },
 
  88     { action: "StopApplication", value: "StopApplication" }
 
  92     showProgressBar: true,
 
  98   public enableDownloadButtons: boolean = false;
 
  99   constructor(private buildDesignComponent: BuildDesignComponent, private paramShareService: ParamShareService, private dialogService: DialogService, private notificationService: NotificationService, private httpUtil: HttpUtilService, private mappingEditorService: MappingEditorService, private activeRoutes: ActivatedRoute, private router: Router, private nService: NotificationsService, private ngProgress: NgProgress) {
 
 100     this.artifactRequest.action = '';
 
 101     this.artifactRequest.version = '';
 
 102     this.artifactRequest.paramsContent = '{}';
 
 103     this.artifactRequest.paramKeysContent = '';
 
 105   public templateEditor: any;
 
 106   public fileType: any = '';
 
 107   public actionType: any;
 
 108   public myfileName: any;
 
 109   userId = localStorage['userId'];
 
 110   public artifactRequest: ArtifactRequest = new ArtifactRequest();
 
 111   public showUploadStatus: boolean = false;
 
 112   public uploadStatus: boolean = false;
 
 113   public uploadTypes = [
 
 115       value: 'Generated Template',
 
 116       display: 'Sample Json Param File'
 
 119       value: 'Mapping Data',
 
 120       display: 'Sample Json Param File'
 
 130   enableValidateTemplate: boolean = false;;
 
 131   public selectedUploadType: string = this.uploadTypes[0].value;
 
 133   public tempRetrievalResponse:any;
 
 134   public mergeStatus:boolean=false;
 
 136   //======================================Start of ngOnInit() Method============================================
 
 138     var refObj = this.refObj = this.prepareFileName();
 
 139     if (refObj && refObj != undefined) {
 
 142       this.vnfType = this.item.scope["vnf-type"];
 
 143       this.vnfcType = this.item.scope["vnfc-type"];
 
 144       this.protocol = this.item['device-protocol'];
 
 145       this.action = this.item.action;
 
 146       this.artifactRequest.action = this.item.action;
 
 147       this.artifactRequest.vnfType = this.vnfType;
 
 148       if (this.vnfcType != undefined && this.vnfcType.length != 0) {
 
 149         this.scopeName = this.vnfcType;
 
 152         this.scopeName = this.vnfType;
 
 156       this.item = { "action": "", "scope": { "vnf-type": "", "vnfc-type": "" }, "vm": [], "protocol": "", "download-dg-reference": "", "user-name": "", "port-number": "", "artifact-list": [], "deviceTemplate": "", "scopeType": "" };
 
 158     this.initialAction = this.item.action;
 
 159     this.activeRoutes.url.subscribe(UrlSegment => {
 
 160       this.actionType = UrlSegment[0].path
 
 162     this.mappingEditorService.fromScreen = 'MappingScreen';
 
 163     this.identifier = this.mappingEditorService.identifier;
 
 165   //========================== End of ngOnInit() Method============================================
 
 167     if (this.refObj && this.refObj != undefined) {
 
 168       if (this.configMappingEditorContent && this.configMappingEditorContent != undefined) {
 
 170         this.prepareAppData();
 
 171         this.prepareDownloadData();
 
 172         this.mappingEditorService.changeNavAppData(this.appDataObject);
 
 173         this.mappingEditorService.changeNavDownloadData(this.downloadDataObject);
 
 177   //========================== End of ngOnDestroy() Method============================================
 
 179     if (this.mappingEditorService.latestAction) {
 
 180       this.refNameObj = this.mappingEditorService.latestAction;
 
 181       if (this.vnfcType !== 'null') {
 
 182         this.type = this.vnfcType;
 
 185         this.type = this.vnfType;
 
 187       for (let i = 0; i < this.refNameObj['artifact-list'].length; i++) {
 
 188         let artifactList = this.refNameObj['artifact-list'];
 
 189         if (artifactList[i]['artifact-type'] === 'config_template') {
 
 190           this.artifactName = artifactList[i]['artifact-name'];
 
 195     this.templateEditor = self.templateeditor.getEditor();
 
 196     this.templateeditor.getEditor().commands.addCommand({
 
 197       name: 'annotateCommand',
 
 198       bindKey: { win: 'ENTER', mac: 'ENTER' },
 
 199       exec: (editor: any) => {
 
 200         this.handleAnnotation(this.modal);
 
 203     if (this.mappingEditorService.fromScreen === 'MappingScreen') {
 
 204       this.configMappingEditorContent = this.mappingEditorService.getTemplateMappingDataFromStore();
 
 205       this.fileType = sessionStorage.getItem('fileType');
 
 207     if (this.configMappingEditorContent) {
 
 208       this.artifactRequest.templateContent = this.configMappingEditorContent;
 
 209       this.mappingEditorService.initialise(this.templateeditor.getEditor(), this.artifactRequest.templateContent, this.modal);
 
 212       if (this.mappingEditorService.getTemplateMappingDataFromStore() && this.mappingEditorService.getTemplateMappingDataFromStore() != undefined) {
 
 213         this.configMappingEditorContent = this.mappingEditorService.getTemplateMappingDataFromStore();
 
 216         if (this.artifactName) this.retrieveTemplateFromAppc();
 
 221       this.enableBrowse = false;
 
 222       this.nService.error("Error", "Please enter Action and VNF type in Reference Data screen");
 
 226   //========================== End of ngAfterViewInit() Method============================================
 
 228     $("#inputFile").trigger('click');
 
 230   //========================== End of browseOption() Method============================================
 
 232   public saveTemplate() {
 
 233     this.saveToGuiCacheFlag = 'true';
 
 234     this.mappingEditorService.paramData = [];
 
 235     if (this.configMappingEditorContent) {
 
 236       this.initialData = this.configMappingEditorContent;
 
 237       this.mappingEditorService.refreshEditor();
 
 238       let paramArr: any = []
 
 239       if (this.mappingEditorService.paramData && this.mappingEditorService.paramData != undefined) {
 
 240         if (this.mappingEditorService.paramData.length === 0 && this.mappingEditorService.hasErrorCode === true) {
 
 241           this.nService.error("Error", 'Special characters error', 'Error')
 
 245           this.showError = false;
 
 248       this.showTemplateVersionDiv = true;
 
 250       if (this.mappingEditorService.fromScreen === 'MappingScreen') {
 
 251         this.mappingEditorService.setTemplateMappingDataFromStore(this.configMappingEditorContent);
 
 253       if (this.fileType === 'text/xml') {
 
 254         sessionStorage.setItem('fileType', 'text/xml');
 
 256       if (this.fileType === '') {
 
 257         sessionStorage.setItem('fileType', '');
 
 261   //========================== End of saveTemplate() Method============================================
 
 262   retrieveTemplateFromAppc() {
 
 263     let refObj = this.refObj;
 
 264     if (refObj && refObj != undefined) {
 
 266       let fileName = this.artifactName;
 
 267       let payload = '{"userID": "' + this.userId + '","action": "' + this.item.action + '", "vnf-type" : "' + this.vnfType + '", "artifact-type":"APPC-CONFIG", "artifact-name":"' + fileName + '"}';
 
 271             "request-id": this.apiToken,
 
 272             "action": "getArtifact",
 
 277       let artifactContent: any;
 
 278       this.ngProgress.start();
 
 280         url: environment.getDesigns,
 
 282       }).subscribe(resp => {
 
 283         if (resp.output.status.code === '400' && resp.output.status.message === "success") {
 
 284           this.nService.success("Success", "Template retrieved successfully from APPC");
 
 285           this.tempRetrievalResponse=resp;
 
 286           let result = JSON.parse(resp.output.data.block).artifactInfo[0];
 
 287           result = result['artifact-content'];
 
 288           if ('Generated Template' === this.selectedUploadType) {
 
 289             this.configMappingEditorContent = result
 
 290             this.artifactRequest.templateContent = this.configMappingEditorContent;
 
 291             this.notificationService.notifySuccessMessage('Configuration Template file successfully uploaded..');
 
 292             if (this.artifactRequest.templateContent) {
 
 293               this.mappingEditorService.initialise(this.templateeditor.getEditor(), this.artifactRequest.templateContent, this.modal);
 
 296           this.tempretrieveFlag = true;
 
 297           this.fileNameForTempSave = fileName;
 
 298           this.enableDownloadButtons = true;
 
 299           this.initialData = result;
 
 303           this.nService.info("Information", "There is no template saved in APPC for the selected action!");
 
 305         this.ngProgress.done();
 
 307       error => this.nService.error("Error", "Error in connecting to APPC Server"));
 
 309         this.ngProgress.done();
 
 313   //========================== End of retrieveTemplateFromAppc() Method============================================
 
 315     let refObj = this.refObj;
 
 316     if (refObj && refObj != undefined) {
 
 317       let paramsKeyValueFromEditor: JSON;
 
 319         paramsKeyValueFromEditor = JSON.parse(localStorage["paramsContent"]);
 
 322         console.log("Could not parse name value pairs==" + error);
 
 324       if (paramsKeyValueFromEditor) {
 
 325         this.showTemplateVersionDiv = true;
 
 326         let action = this.item.action;
 
 327         var scopeName = this.scopeName.replace(/ /g, '').replace(new RegExp('/', "g"), '_').replace(/ /g, '');
 
 328         let fileName = this.updateParamFileName(refObj.action, scopeName, this.templateVersionNo);
 
 329         let vnfType = this.vnfType;
 
 330         let Json = [paramsKeyValueFromEditor];
 
 331         let slashedPayload = this.appendSlashes(JSON.stringify(Json));
 
 334             "userID": this.userId,
 
 335             "vnf-type": this.vnfType,
 
 337             "artifact-name": fileName,
 
 338             "artifact-type": "APPC-CONFIG",
 
 339             "artifact-version": this.templateVersionNo,
 
 340             "artifact-contents": slashedPayload
 
 346                 "request-id": this.apiToken,
 
 347                 "action": "uploadArtifact",
 
 348                 "payload": JSON.stringify(newPayload)
 
 353          this.appDataObject.template.nameValueData = data;
 
 355       if (this.configMappingEditorContent) {
 
 356         let actualContent = this.configMappingEditorContent;
 
 357         this.mappingEditorService.generateTemplate(this.templateEditor);
 
 358         this.showTemplateVersionDiv = true;
 
 359         let action = this.item.action;
 
 360         let versionandFileType: any;
 
 361         if (this.fileType === "text/xml") {
 
 363           versionandFileType = this.templateVersionNo + 'V.xml'
 
 366           versionandFileType = this.templateVersionNo + 'V.json'
 
 369         if (this.tempretrieveFlag) {
 
 370           fileName = this.fileNameForTempSave;
 
 373           fileName = this.artifactName;
 
 375         let vnfType = this.vnfType;
 
 378             "userID": this.userId,
 
 379             "vnf-type": this.vnfType,
 
 381             "artifact-name": fileName,
 
 382             "artifact-type": "APPC-CONFIG",
 
 383             "artifact-version": this.templateVersionNo,
 
 384             "artifact-contents": this.configMappingEditorContent.replace(/\(([^()]|(R))*\)=\(/g, '').replace(/\)}/g, '}')
 
 391                 "request-id": this.apiToken,
 
 392                 "action": "uploadArtifact",
 
 393                 "payload": JSON.stringify(newPayload)
 
 398         this.appDataObject.template.templateData = data;
 
 399         this.mappingEditorService.initialise(this.templateeditor.getEditor(), actualContent, this.modal);
 
 403   //========================== End of prepareAppData() Method============================================
 
 404   prepareFileName(): any {
 
 405     let fileNameObject: any = this.mappingEditorService.latestAction;
 
 406     this.appDataObject = this.mappingEditorService.appDataObject;
 
 407     this.downloadDataObject = this.mappingEditorService.downloadDataObject;
 
 408     this.referenceData = fileNameObject;
 
 409     return fileNameObject;
 
 411   //========================== End of prepareFileName() Method============================================
 
 412   onDownloadParameter() {
 
 413     let refObj = this.refObj;
 
 415       let paramsKeyValueFromEditor: JSON;
 
 417         paramsKeyValueFromEditor = JSON.parse(localStorage["paramsContent"]);
 
 420         console.log("Could not parse name value pairs==" + error);
 
 422       let theJSON = JSON.stringify(paramsKeyValueFromEditor, null, "\t")
 
 423       var blob = new Blob([theJSON], {
 
 426       this.showTemplateVersionDiv = true;
 
 428       var scopeName = this.scopeName.replace(/ /g, '').replace(new RegExp('/', "g"), '_').replace(/ /g, '');
 
 429       fileName = this.updateParamFileName(refObj.action, scopeName, this.templateVersionNo);
 
 430       this.downloadDataObject.template.nameValueData = theJSON;
 
 431       this.downloadDataObject.template.nameValueFileName = fileName;
 
 434       this.nService.error("Error", "Please enter Action and VNF type in Reference Data screen");
 
 438   //========================== End of onDownloadParameter() Method============================================
 
 439   updateParamFileName(action: any, scopeName: any, versionNo: any) {
 
 440     let fileName = 'param_' + action + '_' + scopeName + '_' + versionNo + 'V.json';
 
 441     this.downloadedParamFileName = fileName;
 
 444   //========================== End of updateParamFileName() Method============================================
 
 445   public onDownloadTemplate(artifact: string) {
 
 446     let actualContent = this.configMappingEditorContent;
 
 447     var textToSaveAsBlob: any;
 
 448     var config_template_fileName: any
 
 449     let refObj = this.refObj;
 
 450     let versionandFileType: string;
 
 451    if (artifact == 'Template' && this.artifactRequest && this.configMappingEditorContent && refObj) {
 
 452       this.showTemplateVersionDiv = true;
 
 453       if (this.fileType === "text/xml") {
 
 454         textToSaveAsBlob = new Blob([this.configMappingEditorContent], {
 
 457         versionandFileType = this.templateVersionNo + 'V.xml'
 
 459       if (this.fileType === "text/plain") {
 
 460         textToSaveAsBlob = new Blob([this.configMappingEditorContent], {
 
 463         versionandFileType = this.templateVersionNo + 'V.txt'
 
 465       if (this.fileType === "text/json") {
 
 466         textToSaveAsBlob = new Blob([this.configMappingEditorContent], {
 
 469         versionandFileType = this.templateVersionNo + 'V.json'
 
 471       if (this.tempretrieveFlag) {
 
 472         config_template_fileName = this.fileNameForTempSave;
 
 473         var filextension = config_template_fileName.substring(config_template_fileName.indexOf("V") + 2, config_template_fileName.length);
 
 475         textToSaveAsBlob = new Blob([this.configMappingEditorContent], {
 
 476           type: "text/" + filextension
 
 480         config_template_fileName = this.artifactName;
 
 482       this.mappingEditorService.initialise(this.templateeditor.getEditor(), actualContent, this.modal);
 
 483       this.downloadDataObject.template.templateData = this.configMappingEditorContent.replace(/\(([^()]|(R))*\)=\(/g, '').replace(/\)}/g, '}');
 
 484       this.downloadDataObject.template.templateFileName = config_template_fileName;
 
 488   //========================== End of onDownloadTemplate() Method============================================
 
 492     let refObj = this.refObj;
 
 493     this.enableValidateTemplate = true;
 
 495     if (refObj && refObj != undefined) {
 
 496       if (input.files && input.files[0]) {
 
 497         this.myfileName = input.files[0].name;
 
 498         this.fileName = input.files[0].name;
 
 499         this.fileType = input.files[0].type;
 
 500         let reader = new FileReader();
 
 501         this.readFile(input.files[0], reader, (result) => {
 
 502           if (this.fileType === 'text/xml') {
 
 503             sessionStorage.setItem('fileType', 'text/xml');
 
 505           if (this.fileName.endsWith(".json")) {
 
 506             this.fileType = "text/json";
 
 507             sessionStorage.setItem('fileType', 'text/json');
 
 509           if (this.fileType === '') {
 
 510             sessionStorage.setItem('fileType', '');
 
 514           if ('Generated Template' === this.selectedUploadType) {
 
 515             this.configMappingEditorContent = result
 
 516             this.artifactRequest.templateContent = this.configMappingEditorContent;
 
 517             this.notificationService.notifySuccessMessage('Configuration Template file successfully uploaded..');
 
 518             if (this.artifactRequest.templateContent) {
 
 519               this.mappingEditorService.initialise(this.templateeditor.getEditor(), this.artifactRequest.templateContent, this.modal);
 
 522           this.enableDownloadButtons = true;
 
 523           this.initialData = result;
 
 529         this.nService.error("Error", "Failed to read file");
 
 531       this.myInputVariable.nativeElement.value = "";
 
 534       this.nService.error("Error", "Please enter Action and VNF type in Reference Data screen");
 
 538   //========================== End of fileChange() Method============================================
 
 539   public readFile(file, reader, callback) {
 
 540     // Set a callback funtion to fire after the file is fully loaded
 
 541     reader.onload = () => {
 
 542       // callback with the results
 
 543       callback(reader.result);
 
 545     this.notificationService.notifySuccessMessage('Uploading File ' + file.name + ':' + file.type + ':' + file.size);
 
 547     reader.readAsText(file, "UTF-8");
 
 549   //========================== End of readFile() Method============================================
 
 550   validateUploadedFile(fileExtension) {
 
 552     if (fileExtension.toUpperCase() === 'json'.toUpperCase() || fileExtension.toUpperCase() === 'xml'.toUpperCase()) {
 
 560   //========================== End of validateUploadedFile() Method============================================
 
 561   appendSlashes(artifactData) {
 
 562     let x = artifactData.replace(new RegExp(',"', "g"), ',\"');
 
 563     let y = x.replace(new RegExp('":', 'g'), '\":');
 
 564     let z = y.replace(new RegExp('{"', 'g'), '{\"')
 
 565     let t = z.replace(new RegExp(':"', 'g'), ':\"')
 
 566     let m = t.replace(new RegExp('",', 'g'), '\",');
 
 567     let n = y.replace(new RegExp('"}', 'g'), '\"}')
 
 568     let nw = n.replace(new RegExp('{"', 'g'), '{\"');
 
 569     let nw1 = nw.replace(new RegExp(':"', 'g'), ':\"');
 
 570     let nw2 = nw1.replace(new RegExp('",', 'g'), '\",');
 
 573   //========================== End of appendSlashes() Method============================================
 
 574   prepareDownloadData() {
 
 575     this.onDownloadParameter();
 
 576     this.onDownloadTemplate('Template');
 
 578   //========================== End of prepareDownloadData() Method============================================
 
 580     this.mappingEditorService.replaceNamesWithBlankValues();
 
 583     var templateData = this.mappingEditorService.paramData; //template data array
 
 584     var pdData = this.paramShareService.getSessionParamData(); //PD data array
 
 585     var paramsContent = localStorage["paramsContent"];
 
 587     if (paramsContent && paramsContent != undefined) {
 
 589         var paramTabData = JSON.parse(paramsContent);
 
 592         console.log("error is : " + error)
 
 597     var resultParamObj = {};
 
 598     let checkNamesOnlyCondition: boolean = true;
 
 600     if (templateData && templateData != undefined) {
 
 601       templateData.forEach(function (item) {
 
 602         if (item.paramValue !== "" && item.paramValue != undefined && item.paramValue != null) {
 
 603           checkNamesOnlyCondition = false;
 
 608       templateData.forEach(function (item) {
 
 609         resultParamObj[item.paramName] = item.paramValue;
 
 611       if (paramTabData && paramTabData != undefined) {
 
 612         templateData.forEach(function (item) {
 
 613           for (var index in paramTabData) {
 
 614             if (item.paramName === index) {
 
 615               if (checkNamesOnlyCondition) {
 
 616                 resultParamObj[index] = paramTabData[index];
 
 619                 if (item.paramValue === "") {
 
 620                   resultParamObj[index] = paramTabData[index];
 
 623                   resultParamObj[index] = item.paramValue;
 
 633       localStorage["paramsContent"] = JSON.stringify(resultParamObj);
 
 634       templateData = Array.from(new Set(templateData.map((itemInArray) => itemInArray.paramName)))
 
 636       //reformatting arr1 to match with PD
 
 637       templateData.forEach(function (item) {
 
 673           "ruleTypeValues": [null]
 
 678     if (pdData && pdData != undefined) {
 
 679       for (var i = 0; i < resultArr.length; i++) {
 
 681         pdData.forEach(function (arr2item) {
 
 682           if (resultArr[i].name === arr2item.name) {
 
 685               "name": arr2item.name,
 
 686               "type": arr2item.type,
 
 687               "description": arr2item.description,
 
 688               "required": arr2item.required,
 
 689               "default": arr2item.default,
 
 690               "source": arr2item.source,
 
 691               "rule-type": arr2item["rule-type"],
 
 692               "request-keys": arr2item["request-keys"],
 
 693               "response-keys": arr2item["response-keys"],
 
 694               "ruleTypeValues": arr2item.ruleTypeValues
 
 696             resultArr.splice(i, 1, json)
 
 704     this.paramShareService.setSessionParamData(resultArr);
 
 705     this.mappingEditorService.paramData = [];
 
 706     //navigate to PD page after sync
 
 709       .navigate(['../../../vnfs/design/parameterDefinitions/create']);
 
 712   //========================== End of syncTemplate() Method============================================
 
 714     this.mergeStatus = this.mappingEditorService.autoAnnotateDataForParams();
 
 715     if (this.mergeStatus) {
 
 716       this.nService.success("Success", "Merge Successful");
 
 719       this.nService.error("Error", "Merge Unsuccessful");
 
 723   //========================== End of mergeParams() Method============================================  
 
 724   public handleAnnotation(modal) {
 
 726     this.selectedWord = this.templateeditor.getEditor().session.getTextRange(this.templateeditor.getEditor().selectionRange);
 
 729   //========================== End of handleAnnotations() Method============================================ 
 
 730   public submitNameValues() {
 
 732       this.checkNameEntered = true;
 
 734       if (this.selectedWord) {
 
 735         if (this.selectedWord.startsWith('${(')) {
 
 736           var replaceWord: any =this.replaceWord = this.selectedWord.substring(3, this.selectedWord.indexOf(')=(')) + this.tempName;
 
 737           this.templateeditor.getEditor().session.replace(this.templateeditor.getEditor().session.selection.getRange(), replaceWord);
 
 740           let mappingKey = this.mappingEditorService.getKeysForValues(this.selectedWord);
 
 741           var replaceWord: any = this.replaceWord='${(' + this.selectedWord + ')=(' + this.tempName + ')}';
 
 742           this.templateeditor.getEditor().session.replace(this.templateeditor.getEditor().session.selection.getRange(), replaceWord);
 
 746       this.mappingEditorService.refreshEditor();
 
 752       this.checkNameEntered = false;
 
 756   //========================== End of submitNameValues() Method============================================