diff options
Diffstat (limited to 'src/app/vnfs')
-rw-r--r-- | src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts | 49 |
1 files changed, 5 insertions, 44 deletions
diff --git a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts index dc40704..a3d55ba 100644 --- a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts +++ b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts @@ -40,7 +40,8 @@ import { NgProgress } from 'ngx-progressbar'; import { NgxSpinnerService } from 'ngx-spinner'; import { UtilityService } from '../../../../shared/services/utilityService/utility.service'; declare var $: any - +const PARAM_DATA:string="param_data"; +const TEMPLATE_DATA:string="template_data"; @Component({ selector: 'app-golden-configuration', templateUrl: './template-configuration.component.html', styleUrls: ['./template-configuration.component.css'] }) export class GoldenConfigurationComponent implements OnInit { @ViewChild('templateeditor') templateeditor; @@ -99,6 +100,7 @@ export class GoldenConfigurationComponent implements OnInit { } public replaceWord; public enableDownloadButtons: boolean = false; + constructor( private buildDesignComponent: BuildDesignComponent, private paramShareService: ParamShareService, @@ -354,27 +356,7 @@ export class GoldenConfigurationComponent implements OnInit { let vnfType = this.vnfType; let Json = [paramsKeyValueFromEditor]; let slashedPayload = this.appendSlashes(JSON.stringify(Json)); - let newPayload = - { - "userID": this.userId, - "vnf-type": this.vnfType, - "action": action, - "artifact-name": fileName, - "artifact-type": "APPC-CONFIG", - "artifact-version": this.templateVersionNo, - "artifact-contents": slashedPayload - } - let data = - { - "input": { - "design-request": { - "request-id": this.apiToken, - "action": "uploadArtifact", - "payload": JSON.stringify(newPayload) - - } - } - } + let data = this.utilityService.createPayLoadForSave(PARAM_DATA, this.vnfType, action, fileName, this.templateVersionNo, slashedPayload); this.appDataObject.template.nameValueData = data; } if (this.configMappingEditorContent) { @@ -398,28 +380,7 @@ export class GoldenConfigurationComponent implements OnInit { fileName = this.artifactName; } let vnfType = this.vnfType; - let newPayload = - { - "userID": this.userId, - "vnf-type": this.vnfType, - "action": action, - "artifact-name": fileName, - "artifact-type": "APPC-CONFIG", - "artifact-version": this.templateVersionNo, - "artifact-contents": this.configMappingEditorContent.replace(/\(([^()]|(R))*\)=\(/g, '').replace(/\)}/g, '}') - - } - let data = - { - "input": { - "design-request": { - "request-id": this.apiToken, - "action": "uploadArtifact", - "payload": JSON.stringify(newPayload) - - } - } - } + let data = this.utilityService.createPayLoadForSave(TEMPLATE_DATA, this.vnfType, action, fileName, this.templateVersionNo, this.configMappingEditorContent.replace(/\(([^()]|(R))*\)=\(/g, '').replace(/\)}/g, '}')); this.appDataObject.template.templateData = data; this.mappingEditorService.initialise(this.templateeditor.getEditor(), actualContent, this.modal); } |