aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/vnfs/build-artifacts/template-holder
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-07-23 16:12:26 +0530
committerTakamune Cho <tc012c@att.com>2018-07-25 14:01:23 +0000
commit0b5c8497e0d706fca68601276a44e4bab033e945 (patch)
tree9a1ee8a0dbd2f47fcd3ee1837c746af4414514a5 /src/app/vnfs/build-artifacts/template-holder
parenta6dbf8ac1f0e907d3a6b8f4d5bdd6a4217a057fb (diff)
refactord payload creatn for template & param save
refactored payload creation for saving template and param artifacts to APPC using createPayloadForSave method in utility.service.ts Issue-ID: APPC-1105 Change-Id: I2dd446aebdbcbc1ffc070993ee53d09e25eeae6b Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'src/app/vnfs/build-artifacts/template-holder')
-rw-r--r--src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts49
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);
}