+ /** Getting vdu-id & count-index from API */
+ public getVdu(id: string): void {
+ const vnfInstanceData: {}[] = [];
+ this.getFormControl('vduId').setValue(null);
+ this.getFormControl('countIndex').setValue(null);
+ if (!isNullOrUndefined(id)) {
+ this.restService.getResource(environment.VNFINSTANCES_URL + '/' + id).
+ subscribe((vnfInstanceDetail: VNFInstanceDetails): void => {
+ this.instanceId = id;
+ this.selectedvnfId = vnfInstanceDetail['vnfd-ref'];
+ if (!isNullOrUndefined(vnfInstanceDetail.vdur)) {
+ vnfInstanceDetail.vdur.forEach((vdu: VDUR): void => {
+ const vnfInstanceDataObj: {} =
+ {
+ 'count-index': vdu['count-index'],
+ VDU: vdu['vdu-id-ref']
+
+ };
+ vnfInstanceData.push(vnfInstanceDataObj);
+ });
+ this.vdu = vnfInstanceData;
+ this.vduId = this.vdu.filter((vdu: VDUDETAIL, index: number, self: {}[]): {} =>
+ index === self.findIndex((t: VDUDETAIL): {} => (
+ t.VDU === vdu.VDU
+ ))
+ );
+ }
+ }, (error: ERRORDATA): void => {
+ this.restService.handleError(error, 'get');
+ this.isLoadingResults = false;
+ });
+ }
+ }
+