From 9095da958110edbe88704ee39648d48277f1b9f4 Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Fri, 20 Jul 2018 14:39:04 +0530 Subject: refactored payload in uploadArtifact of reference refactored payload in uploadArtifact method of reference dataform using createPayloadForSave method of utlity service Issue-ID: APPC-1100 Change-Id: I9f91725371da96e6d2384b2348e288ebc0af238d Signed-off-by: Sandeep J --- .../reference-dataform/reference-dataform.component.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/app') diff --git a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts index 65876e0..11013b7 100644 --- a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts +++ b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts @@ -39,7 +39,7 @@ import { saveAs } from 'file-saver'; import { UtilityService } from '../../../shared/services/utilityService/utility.service'; declare var $: any; type AOA = Array>; - +const REFERENCE_DATA:string= "reference_data"; @Component({ selector: 'reference-dataform', templateUrl: './reference-dataform.component.html', @@ -648,16 +648,7 @@ export class ReferenceDataformComponent implements OnInit { uploadArtifact(artifactData, dataJson, fileName) { let data = []; let slashedPayload = this.appendSlashes(artifactData); - let newPyaload = '{"userID": "' + localStorage['userId'] + '","vnf-type" : "' + dataJson['scope']['vnf-type'] + '","action" : "AllAction","artifact-name" : "' + fileName + '","artifact-type" : "APPC-CONFIG","artifact-version" : "0.1","artifact-contents" :" ' + slashedPayload + '"}'; - let payload = { - 'input': { - 'design-request': { - 'request-id': localStorage['apiToken'], - 'action': 'uploadArtifact', - 'payload': newPyaload, - } - } - }; + let payload = this.utilityService.createPayLoadForSave(REFERENCE_DATA, dataJson['scope']['vnf-type'], "AllAction", fileName, this.versionNoForApiCall, slashedPayload); this.ngProgress.start(); this.httpUtils.post({ url: environment.getDesigns, -- cgit 1.2.3-korg