From 81cd65e098a82293158803d27a19bb0ba2c1fd18 Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Thu, 19 Jul 2018 17:37:09 +0530 Subject: refactored payload creation in getArtifacts method refactored payload creation in getArtifacts method of reference-dataform.component.ts. The payload is created now using createPayloadForRetrieve method of utility.service.ts Issue-ID: APPC-1095 Change-Id: I303a67d67b9764ada2d1d37adc9281442f44649e Signed-off-by: Sandeep J --- .../reference-dataform.component.ts | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) 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 e625ebd..65876e0 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 @@ -36,6 +36,7 @@ import { NotificationsService } from 'angular2-notifications'; import { ParamShareService } from '../../..//shared/services/paramShare.service'; import { environment } from '../../../../environments/environment'; import { saveAs } from 'file-saver'; +import { UtilityService } from '../../../shared/services/utilityService/utility.service'; declare var $: any; type AOA = Array>; @@ -153,8 +154,20 @@ export class ReferenceDataformComponent implements OnInit { public remUploadedDataArray = []; isConfigScaleOut = false configScaleOutExist: boolean - constructor(private buildDesignComponent: BuildDesignComponent, private httpUtils: HttpUtilService, private route: Router, private location: Location, private activeRoutes: ActivatedRoute, private notificationService: NotificationService, - private paramShareService: ParamShareService, private mappingEditorService: MappingEditorService, private modalService: NgbModal, private nService: NotificationsService, private ngProgress: NgProgress) { + public versionNoForApiCall: any= "0.0.1" + constructor( + private buildDesignComponent: BuildDesignComponent, + private httpUtils: HttpUtilService, + private route: Router, + private location: Location, + private activeRoutes: ActivatedRoute, + private notificationService: NotificationService, + private paramShareService: ParamShareService, + private mappingEditorService: MappingEditorService, + private modalService: NgbModal, + private nService: NotificationsService, + private ngProgress: NgProgress, + private utilityService: UtilityService) { } ngOnInit() { @@ -219,18 +232,7 @@ export class ReferenceDataformComponent implements OnInit { //to retrive the data from appc and assign it to the vaiables, if no data display the message reterived from the API getArtifact() { try { - let payload = JSON.parse(sessionStorage.getItem('updateParams')); - payload['userID'] = localStorage['userId']; - payload = JSON.stringify(payload); - let data = { - 'input': { - 'design-request': { - 'request-id': localStorage['apiToken'], - 'action': 'getArtifact', - 'payload': payload - } - } - }; + let data = this.utilityService.createPayloadForRetrieve(true, '', '', ''); this.ngProgress.start(); this.httpUtils.post({ url: environment.getDesigns, @@ -280,7 +282,7 @@ export class ReferenceDataformComponent implements OnInit { } this.getArtifactsOpenStack(); } else { - this.nService.success('Status', 'Sorry !!! I dont have any artifact Named : ' + (JSON.parse(payload))['artifact-name']); + this.nService.success('Status', 'Sorry !!! I dont have any artifact Named : ' + (JSON.parse(sessionStorage.getItem('updateParams')))['artifact-name']); } this.ngProgress.done(); }); -- cgit 1.2.3-korg