diff options
author | Sandeep J <sandeejh@in.ibm.com> | 2018-07-19 17:37:09 +0530 |
---|---|---|
committer | Takamune Cho <tc012c@att.com> | 2018-07-19 20:59:30 +0000 |
commit | 81cd65e098a82293158803d27a19bb0ba2c1fd18 (patch) | |
tree | 6c92c59891ce555947bcdcfe100e5414f8b5e554 /src/app/vnfs/build-artifacts | |
parent | 3b3b7117db19bf4d0086ee7eced0432380f55782 (diff) |
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 <sandeejh@in.ibm.com>
Diffstat (limited to 'src/app/vnfs/build-artifacts')
-rw-r--r-- | src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts | 32 |
1 files 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<Array<any>>; @@ -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(); }); |