2 ============LICENSE_START==========================================
3 ===================================================================
4 Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
5 ===================================================================
6 Copyright (C) 2018 IBM.
7 ===================================================================
9 Unless otherwise specified, all software contained herein is licensed
10 under the Apache License, Version 2.0 (the License);
11 you may not use this software except in compliance with the License.
12 You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
22 ============LICENSE_END============================================
25 import { Component, Input, OnInit, ViewChild } from '@angular/core';
26 import { Subscription } from 'rxjs/Subscription';
27 import { HttpUtilService } from '../../../../shared/services/httpUtil/http-util.service';
28 import { MappingEditorService } from '../../../../shared/services/mapping-editor.service';
29 import { ArtifactRequest } from '../../../../shared/models/index';
30 import { ActivatedRoute, Router } from '@angular/router';
31 import { saveAs } from 'file-saver';
32 import { NotificationService } from '../../../../shared/services/notification.service';
33 import { NotificationsService } from 'angular2-notifications';
34 import { ParamShareService } from '../../../../shared/services/paramShare.service';
35 import { DialogService } from 'ng2-bootstrap-modal';
36 import { ConfirmComponent } from '../../../../shared/confirmModal/confirm.component';
37 import { BuildDesignComponent } from '../../build-artifacts.component';
38 import { environment } from '../../../../../environments/environment';
39 import { ModalComponent } from 'ng2-bs3-modal/ng2-bs3-modal';
40 import { NgProgress } from 'ngx-progressbar';
41 import { NgxSpinnerService } from 'ngx-spinner';
42 import { UtilityService } from '../../../../shared/services/utilityService/utility.service';
44 const PARAM_DATA:string="param_data";
45 const TEMPLATE_DATA:string="template_data";
46 @Component({ selector: 'app-golden-configuration', templateUrl: './template-configuration.component.html', styleUrls: ['./template-configuration.component.css'] })
47 export class GoldenConfigurationComponent implements OnInit {
48 clName= "TemplateConfigCompon";
49 @ViewChild('templateeditor') templateeditor;
50 @Input() configMappingEditorContent: string;
51 @Input() isMappingComp: boolean;
52 @ViewChild('myInput') myInputVariable: any;
53 @ViewChild('myModal') modal: ModalComponent;
56 showTemplateVersionDiv: any;
57 downloadedTemplateFileName: any;
58 downloadedParamFileName: any;
59 templateVersionNo: any = '0.0.1';
60 saveToGuiCacheFlag = 'false';
62 public referenceData: Array<Object> = [];
63 public scopeName: any;
64 public subscription: Subscription;
65 public templateSubscription : Subscription;
66 public item: any = {};
67 public goldenActions: Array<string> = [];
68 public refNameObj = {};
70 public artifactName = '';
72 public showError: boolean = false;
73 public tempretrieveFlag: boolean = false;
74 public fileNameForTempSave;
76 showDownloadDiv: boolean = false;
78 enableBrowse: boolean = true;
79 enableMerge: boolean = false;
80 uploadValidationSuccess: boolean = false;
81 fileExtension: any = "xml";
82 apiToken = localStorage['apiToken'];
83 public appDataObject: any;
84 public downloadDataObject: any;
85 public checkNameEntered: boolean = true;
86 public selectedWord: any = this.mappingEditorService.getSelectedWord();
88 { action: "ConfigBackup", value: "ConfigBackup" },
89 { action: "ConfigModify", value: "ConfigModify" },
90 { action: "ConfigRestore", value: "ConfigRestore" },
91 { action: "Configure", value: "Configure" },
92 { action: "GetRunningConfig", value: "GetRunningConfig" },
93 { action: "HealthCheck", value: "HealthCheck" },
94 { action: "StartApplication", value: "StartApplication" },
95 { action: "StopApplication", value: "StopApplication" }
99 showProgressBar: true,
105 public enableDownloadButtons: boolean = false;
108 private buildDesignComponent: BuildDesignComponent,
109 private paramShareService: ParamShareService,
110 private dialogService: DialogService,
111 private notificationService: NotificationService,
112 private httpUtil: HttpUtilService,
113 private mappingEditorService: MappingEditorService,
114 private activeRoutes: ActivatedRoute,
115 private router: Router,
116 private nService: NotificationsService,
117 private ngProgress: NgProgress,
118 private spinner: NgxSpinnerService,
119 private utilityService: UtilityService) {
120 this.artifactRequest.action = '';
121 this.artifactRequest.version = '';
122 this.artifactRequest.paramsContent = '{}';
123 this.artifactRequest.paramKeysContent = '';
125 public templateEditor: any;
126 public fileType: any = '';
127 public actionType: any;
128 public myfileName: any;
129 userId = localStorage['userId'];
130 public artifactRequest: ArtifactRequest = new ArtifactRequest();
131 public showUploadStatus: boolean = false;
132 public uploadStatus: boolean = false;
133 public uploadTypes = [
135 value: 'Generated Template',
136 display: 'Sample Json Param File'
139 value: 'Mapping Data',
140 display: 'Sample Json Param File'
150 enableValidateTemplate: boolean = false;;
151 public selectedUploadType: string = this.uploadTypes[0].value;
153 public tempRetrievalResponse: any;
154 public mergeStatus: boolean = false;
156 //======================================Start of ngOnInit() Method============================================
158 var methName= "ngOnInit";
159 if( this.utilityService.getTracelvl() > 0 )
160 console.log( this.clName+": "+methName+": start.");
161 var refObj = this.refObj = this.prepareFileName();
162 if( this.utilityService.getTracelvl() > 0 )
163 console.log( this.clName+": "+methName+
164 ": refObj:["+JSON.stringify(refObj)+"]");
165 if (refObj && refObj != undefined) {
168 this.vnfType = this.item.scope["vnf-type"];
169 this.vnfcType = this.item.scope["vnfc-type"];
170 this.protocol = this.item['device-protocol'];
171 this.action = this.item.action;
172 if( this.utilityService.getTracelvl() > 0 )
173 console.log( this.clName+": "+methName+": vnfType:["+this.vnfType+
174 "] vnfcType:["+this.vnfcType+"] protocol:["+this.protocol+"] action:["+
176 this.artifactRequest.action = this.item.action;
177 this.artifactRequest.vnfType = this.vnfType;
178 if (this.vnfcType != undefined && this.vnfcType.length != 0) {
179 this.scopeName = this.vnfcType;
182 this.scopeName = this.vnfType;
186 this.item = { "action": "", "scope": { "vnf-type": "", "vnfc-type": "" }, "vm": [], "protocol": "", "download-dg-reference": "", "user-name": "", "port-number": "", "artifact-list": [], "deviceTemplate": "", "scopeType": "" };
188 this.initialAction = this.item.action;
189 this.subscription = this.activeRoutes.url.subscribe(UrlSegment => {
190 this.actionType = UrlSegment[0].path
192 this.mappingEditorService.fromScreen = 'MappingScreen';
193 this.identifier = this.mappingEditorService.identifier;
195 //========================== End of ngOnInit() Method============================================
197 if (this.refObj && this.refObj != undefined) {
198 if (this.configMappingEditorContent && this.configMappingEditorContent != undefined) {
200 this.prepareAppData();
201 this.prepareDownloadData();
202 this.mappingEditorService.changeNavAppData(this.appDataObject);
203 this.mappingEditorService.changeNavDownloadData(this.downloadDataObject);
207 if(this.subscription) { this.subscription.unsubscribe(); }
208 if(this.templateSubscription) { this.templateSubscription.unsubscribe(); }
210 //========================== End of ngOnDestroy() Method============================================
212 if (this.mappingEditorService.latestAction) {
213 this.refNameObj = this.mappingEditorService.latestAction;
214 if (this.vnfcType !== 'null') {
215 this.type = this.vnfcType;
218 this.type = this.vnfType;
220 for (let i = 0; i < this.refNameObj['artifact-list'].length; i++) {
221 let artifactList = this.refNameObj['artifact-list'];
222 if (artifactList[i]['artifact-type'] === 'config_template') {
223 var artifactName = artifactList[i]['artifact-name'];
224 var artifactNameWithoutExtension = '';
226 artifactNameWithoutExtension = artifactName.substring(0, artifactName.lastIndexOf("."));
228 if(this.mappingEditorService.identifier) {
229 if(artifactNameWithoutExtension.endsWith(this.mappingEditorService.identifier)) {
230 this.artifactName = artifactName;
234 this.artifactName = artifactName;
241 this.templateEditor = self.templateeditor.getEditor();
242 this.templateeditor.getEditor().commands.addCommand({
243 name: 'annotateCommandAlternate',
244 bindKey: { win: 'CTRL-4', mac: 'Command-4' },
245 exec: (editor: any) => {
246 this.handleAnnotation(this.modal);
249 this.templateeditor.getEditor().$enableBlockSelect = false;
250 this.templateeditor.getEditor().$enableMultiselect = false;
251 if (this.mappingEditorService.fromScreen === 'MappingScreen') {
252 this.configMappingEditorContent = this.mappingEditorService.getTemplateMappingDataFromStore();
253 this.fileType = sessionStorage.getItem('fileType');
255 if (this.configMappingEditorContent) {
256 this.artifactRequest.templateContent = this.configMappingEditorContent;
257 this.mappingEditorService.initialise(this.templateeditor.getEditor(), this.artifactRequest.templateContent, this.modal);
260 if (this.mappingEditorService.getTemplateMappingDataFromStore() && this.mappingEditorService.getTemplateMappingDataFromStore() != undefined) {
261 this.configMappingEditorContent = this.mappingEditorService.getTemplateMappingDataFromStore();
264 if (this.artifactName) this.retrieveTemplateFromAppc();
269 this.enableBrowse = false;
270 this.nService.error("Error", "Please enter Action and VNF type in Reference Data screen");
274 //========================== End of ngAfterViewInit() Method============================================
276 $("#inputFile").trigger('click');
278 //========================== End of browseOption() Method============================================
280 public saveTemplate() {
281 this.saveToGuiCacheFlag = 'true';
282 this.mappingEditorService.paramData = [];
283 if (this.configMappingEditorContent) {
284 this.initialData = this.configMappingEditorContent;
285 this.mappingEditorService.refreshEditor();
286 let paramArr: any = []
287 if (this.mappingEditorService.paramData && this.mappingEditorService.paramData != undefined) {
288 if (this.mappingEditorService.paramData.length === 0 && this.mappingEditorService.hasErrorCode === true) {
289 this.nService.error("Error", 'Special characters error', 'Error')
293 this.showError = false;
296 this.showTemplateVersionDiv = true;
298 if (this.mappingEditorService.fromScreen === 'MappingScreen') {
299 this.mappingEditorService.setTemplateMappingDataFromStore(this.configMappingEditorContent);
301 if (this.fileType === 'text/xml') {
302 sessionStorage.setItem('fileType', 'text/xml');
304 if (this.fileType === '') {
305 sessionStorage.setItem('fileType', '');
309 //========================== End of saveTemplate() Method============================================
310 retrieveTemplateFromAppc() {
311 let refObj = this.refObj;
312 if (refObj && refObj != undefined) {
314 let fileName = this.artifactName;
315 let input = this.utilityService.createPayloadForRetrieve(false, this.item.action, this.vnfType, fileName);
316 let artifactContent: any;
317 this.ngProgress.start();
318 this.templateSubscription = this.httpUtil.post({
319 url: environment.getDesigns,
321 }).subscribe(resp => {
322 if (resp.output.status.code === '400' && resp.output.status.message === "success") {
323 this.nService.success("Success", "Template retrieved successfully from APPC");
324 this.tempRetrievalResponse = resp;
325 let result = JSON.parse(resp.output.data.block).artifactInfo[0];
326 result = result['artifact-content'];
327 if ('Generated Template' === this.selectedUploadType) {
328 this.configMappingEditorContent = result
329 this.artifactRequest.templateContent = this.configMappingEditorContent;
330 this.notificationService.notifySuccessMessage('Configuration Template file successfully uploaded..');
331 if (this.artifactRequest.templateContent) {
332 this.mappingEditorService.initialise(this.templateeditor.getEditor(), this.artifactRequest.templateContent, this.modal);
335 this.tempretrieveFlag = true;
336 this.fileNameForTempSave = fileName;
337 this.enableDownloadButtons = true;
338 this.initialData = result;
342 this.nService.info("Information", "There is no template saved in APPC for the selected action!");
344 this.ngProgress.done();
346 error => this.nService.error("Error", "Error in connecting to APPC Server"));
348 this.ngProgress.done();
352 //========================== End of retrieveTemplateFromAppc() Method============================================
354 let refObj = this.refObj;
355 if (refObj && refObj != undefined) {
356 let paramsKeyValueFromEditor: JSON;
358 paramsKeyValueFromEditor = JSON.parse(localStorage["paramsContent"]);
361 console.log("Could not parse name value pairs==" + error);
363 if (paramsKeyValueFromEditor) {
364 this.showTemplateVersionDiv = true;
365 let action = this.item.action;
366 var scopeName = this.scopeName.replace(/ /g, '').replace(new RegExp('/', "g"), '_').replace(/ /g, '');
368 let id = this.mappingEditorService.identifier;
369 if (id) fileName = this.updateFileNameForConfigScaleOut(this.item.action, scopeName, this.templateVersionNo, id);
370 else fileName = this.updateParamFileName(this.item.action, scopeName, this.templateVersionNo);
372 let vnfType = this.vnfType;
373 let Json = [paramsKeyValueFromEditor];
374 let slashedPayload = this.appendSlashes(JSON.stringify(Json));
375 let data = this.utilityService.createPayLoadForSave(PARAM_DATA, this.vnfType, action, fileName, this.templateVersionNo, slashedPayload);
376 this.appDataObject.template.nameValueData = data;
378 if (this.configMappingEditorContent) {
379 let actualContent = this.configMappingEditorContent;
380 this.mappingEditorService.generateTemplate(this.templateEditor);
381 this.showTemplateVersionDiv = true;
382 let action = this.item.action;
383 let versionandFileType: any;
384 if (this.fileType === "text/xml") {
386 versionandFileType = this.templateVersionNo + 'V.xml'
389 versionandFileType = this.templateVersionNo + 'V.json'
392 if (this.tempretrieveFlag) {
393 fileName = this.fileNameForTempSave;
396 fileName = this.artifactName;
398 let vnfType = this.vnfType;
399 let data = this.utilityService.createPayLoadForSave(TEMPLATE_DATA, this.vnfType, action, fileName, this.templateVersionNo, this.configMappingEditorContent.replace(/\(([^()]|(R))*\)=\(/g, '').replace(/\)}/g, '}'));
400 this.appDataObject.template.templateData = data;
401 this.mappingEditorService.initialise(this.templateeditor.getEditor(), actualContent, this.modal);
405 //========================== End of prepareAppData() Method============================================
406 prepareFileName(): any {
407 let fileNameObject: any = this.mappingEditorService.latestAction;
408 this.appDataObject = this.mappingEditorService.appDataObject;
409 this.downloadDataObject = this.mappingEditorService.downloadDataObject;
410 this.referenceData = fileNameObject;
411 return fileNameObject;
413 //========================== End of prepareFileName() Method============================================
414 onDownloadParameter() {
415 let refObj = this.refObj;
417 let paramsKeyValueFromEditor: JSON;
419 paramsKeyValueFromEditor = JSON.parse(localStorage["paramsContent"]);
422 console.log("Could not parse name value pairs==" + error);
424 let theJSON = JSON.stringify(paramsKeyValueFromEditor, null, "\t")
425 var blob = new Blob([theJSON], {
428 this.showTemplateVersionDiv = true;
430 var scopeName = this.scopeName.replace(/ /g, '').replace(new RegExp('/', "g"), '_').replace(/ /g, '');
431 let id = this.mappingEditorService.identifier;
432 if (id) fileName = this.updateFileNameForConfigScaleOut(this.item.action, scopeName, this.templateVersionNo, id);
433 else fileName = this.updateParamFileName(this.item.action, scopeName, this.templateVersionNo);
435 this.downloadDataObject.template.nameValueData = theJSON;
436 this.downloadDataObject.template.nameValueFileName = fileName;
439 this.nService.error("Error", "Please enter Action and VNF type in Reference Data screen");
443 //========================== End of onDownloadParameter() Method============================================
444 updateParamFileName(action: any, scopeName: any, versionNo: any) {
445 let fileName = 'param_' + action + '_' + scopeName + '_' + versionNo + 'V.json';
446 this.downloadedParamFileName = fileName;
449 //========================== End of updateParamFileName() Method============================================
450 updateFileNameForConfigScaleOut(action: any, scopeName: any, versionNo: any, id: any) {
451 let fileName = 'param_' + action + '_' + scopeName + '_' + versionNo + 'V_' + id + '.json';
452 this.downloadedParamFileName = fileName;
455 //========================== End of updateFileNameForConfigScaleOut() Method============================================
456 public onDownloadTemplate(artifact: string) {
457 let actualContent = this.configMappingEditorContent;
458 var textToSaveAsBlob: any;
459 var config_template_fileName: any
460 let refObj = this.refObj;
461 let versionandFileType: string;
462 if (artifact == 'Template' && this.artifactRequest && this.configMappingEditorContent && refObj) {
463 this.showTemplateVersionDiv = true;
464 if (this.fileType === "text/xml") {
465 textToSaveAsBlob = new Blob([this.configMappingEditorContent], {
468 versionandFileType = this.templateVersionNo + 'V.xml'
470 if (this.fileType === "text/plain") {
471 textToSaveAsBlob = new Blob([this.configMappingEditorContent], {
474 versionandFileType = this.templateVersionNo + 'V.txt'
476 if (this.fileType === "text/json") {
477 textToSaveAsBlob = new Blob([this.configMappingEditorContent], {
480 versionandFileType = this.templateVersionNo + 'V.json'
482 if (this.tempretrieveFlag) {
483 config_template_fileName = this.fileNameForTempSave;
484 var filextension = config_template_fileName.substring(config_template_fileName.indexOf("V") + 2, config_template_fileName.length);
486 textToSaveAsBlob = new Blob([this.configMappingEditorContent], {
487 type: "text/" + filextension
491 config_template_fileName = this.artifactName;
493 this.mappingEditorService.initialise(this.templateeditor.getEditor(), actualContent, this.modal);
494 this.downloadDataObject.template.templateData = this.configMappingEditorContent.replace(/\(([^()]|(R))*\)=\(/g, '').replace(/\)}/g, '}');
495 this.downloadDataObject.template.templateFileName = config_template_fileName;
499 //========================== End of onDownloadTemplate() Method============================================
503 let refObj = this.refObj;
504 this.enableValidateTemplate = true;
506 if (refObj && refObj != undefined) {
507 if (input.files && input.files[0]) {
509 this.myfileName = input.files[0].name;
510 this.fileName = input.files[0].name;
511 this.fileType = input.files[0].type;
512 let reader = new FileReader();
513 this.readFile(input.files[0], reader, (result) => {
514 if (this.fileType === 'text/xml') {
515 sessionStorage.setItem('fileType', 'text/xml');
517 if (this.fileName.endsWith(".json")) {
518 this.fileType = "text/json";
519 sessionStorage.setItem('fileType', 'text/json');
521 if (this.fileType === '') {
522 sessionStorage.setItem('fileType', '');
526 if ('Generated Template' === this.selectedUploadType) {
527 this.configMappingEditorContent = result
528 this.artifactRequest.templateContent = this.configMappingEditorContent;
529 this.notificationService.notifySuccessMessage('Configuration Template file successfully uploaded..');
530 if (this.artifactRequest.templateContent) {
531 this.mappingEditorService.initialise(this.templateeditor.getEditor(), this.artifactRequest.templateContent, this.modal);
534 this.enableDownloadButtons = true;
535 this.initialData = result;
537 this.templateeditor.getEditor().$enableBlockSelect = false;
538 this.templateeditor.getEditor().$enableMultiselect = false;
540 /** spinner ends after 3.5 seconds */
546 this.nService.error("Error", "Failed to read file");
548 this.myInputVariable.nativeElement.value = "";
551 this.nService.error("Error", "Please enter Action and VNF type in Reference Data screen");
555 //========================== End of fileChange() Method============================================
556 public readFile(file, reader, callback) {
557 // Set a callback funtion to fire after the file is fully loaded
558 reader.onload = () => {
559 // callback with the results
560 callback(reader.result);
562 this.notificationService.notifySuccessMessage('Uploading File ' + file.name + ':' + file.type + ':' + file.size);
564 reader.readAsText(file, "UTF-8");
566 //========================== End of readFile() Method============================================
567 validateUploadedFile(fileExtension) {
569 if (fileExtension.toUpperCase() === 'json'.toUpperCase() || fileExtension.toUpperCase() === 'xml'.toUpperCase()) {
577 //========================== End of validateUploadedFile() Method============================================
578 appendSlashes(artifactData) {
579 let x = artifactData.replace(new RegExp(',"', "g"), ',\"');
580 let y = x.replace(new RegExp('":', 'g'), '\":');
581 let z = y.replace(new RegExp('{"', 'g'), '{\"')
582 let t = z.replace(new RegExp(':"', 'g'), ':\"')
583 let m = t.replace(new RegExp('",', 'g'), '\",');
584 let n = y.replace(new RegExp('"}', 'g'), '\"}')
585 let nw = n.replace(new RegExp('{"', 'g'), '{\"');
586 let nw1 = nw.replace(new RegExp(':"', 'g'), ':\"');
587 let nw2 = nw1.replace(new RegExp('",', 'g'), '\",');
590 //========================== End of appendSlashes() Method============================================
591 prepareDownloadData() {
592 this.onDownloadParameter();
593 this.onDownloadTemplate('Template');
595 //========================== End of prepareDownloadData() Method============================================
597 this.mappingEditorService.replaceNamesWithBlankValues();
600 var templateData = this.mappingEditorService.paramData; //template data array
601 var pdData = this.paramShareService.getSessionParamData(); //PD data array
602 var paramsContent = localStorage["paramsContent"];
604 if (paramsContent && paramsContent != undefined) {
606 var paramTabData = JSON.parse(paramsContent);
609 console.log("error is : " + error)
614 var resultParamObj = {};
615 let checkNamesOnlyCondition: boolean = true;
617 if (templateData && templateData != undefined) {
618 templateData.forEach(function (item) {
619 if (item.paramValue !== "" && item.paramValue != undefined && item.paramValue != null) {
620 checkNamesOnlyCondition = false;
625 templateData.forEach(function (item) {
626 resultParamObj[item.paramName] = item.paramValue;
628 if (paramTabData && paramTabData != undefined) {
629 templateData.forEach(function (item) {
630 for (var index in paramTabData) {
631 if (item.paramName === index) {
632 if (checkNamesOnlyCondition) {
633 resultParamObj[index] = paramTabData[index];
636 if (item.paramValue === "") {
637 resultParamObj[index] = paramTabData[index];
640 resultParamObj[index] = item.paramValue;
650 localStorage["paramsContent"] = JSON.stringify(resultParamObj);
651 templateData = Array.from(new Set(templateData.map((itemInArray) => itemInArray.paramName)))
653 //reformatting arr1 to match with PD
654 templateData.forEach(function (item) {
690 "ruleTypeValues": [null]
695 if (pdData && pdData != undefined) {
696 for (var i = 0; i < resultArr.length; i++) {
698 pdData.forEach(function (arr2item) {
699 if (resultArr[i].name === arr2item.name) {
702 "name": arr2item.name,
703 "type": arr2item.type,
704 "description": arr2item.description,
705 "required": arr2item.required,
706 "default": arr2item.default,
707 "source": arr2item.source,
708 "rule-type": arr2item["rule-type"],
709 "request-keys": arr2item["request-keys"],
710 "response-keys": arr2item["response-keys"],
711 "ruleTypeValues": arr2item.ruleTypeValues
713 resultArr.splice(i, 1, json)
721 this.paramShareService.setSessionParamData(resultArr);
722 this.mappingEditorService.paramData = [];
723 //navigate to PD page after sync
726 .navigate(['../../../vnfs/design/parameterDefinitions/create']);
729 //========================== End of syncTemplate() Method============================================
731 this.mergeStatus = this.mappingEditorService.autoAnnotateDataForParams();
732 if (this.mergeStatus) {
733 this.nService.success("Success", "Merge Successful");
736 this.nService.error("Error", "Merge Unsuccessful");
740 //========================== End of mergeParams() Method============================================
741 public handleAnnotation(modal) {
743 this.selectedWord = this.templateeditor.getEditor().session.getTextRange(this.templateeditor.getEditor().selectionRange);
744 if (this.selectedWord && this.selectedWord != undefined) modal.open();
746 //========================== End of handleAnnotations() Method============================================
747 public submitNameValues() {
749 this.checkNameEntered = true;
751 if (this.selectedWord) {
752 if (this.selectedWord.startsWith('${(')) {
753 var replaceWord: any = this.replaceWord = this.selectedWord.substring(3, this.selectedWord.indexOf(')=(')) + this.tempName;
754 this.templateeditor.getEditor().session.replace(this.templateeditor.getEditor().session.selection.getRange(), replaceWord);
757 let mappingKey = this.mappingEditorService.getKeysForValues(this.selectedWord);
758 var replaceWord: any = this.replaceWord = '${(' + this.selectedWord + ')=(' + this.tempName + ')}';
759 this.templateeditor.getEditor().session.replace(this.templateeditor.getEditor().session.selection.getRange(), replaceWord);
763 this.mappingEditorService.refreshEditor();
769 this.checkNameEntered = false;
773 //========================== End of submitNameValues() Method============================================