import { environment } from 'environment';
import { StartStopRebuild } from 'NSInstanceModel';
import { RestService } from 'RestService';
-import { SharedService } from 'SharedService';
-import { isNullOrUndefined } from 'util';
+import { SharedService, isNullOrUndefined } from 'SharedService';
import { DF, VNFD } from 'VNFDModel';
-import { VDUR, VNFInstanceDetails } from 'VNFInstanceModel';
+import { InstanceData, VDUR, VNFInstanceDetails } from 'VNFInstanceModel';
/**
* Creating component
/** Getting MemberVnfIndex using VNFInstances API @public */
public getMemberVnfIndex(): void {
+ this.isLoadingResults = true;
const vnfInstanceData: {}[] = [];
this.restService.getResource(environment.VNFINSTANCES_URL).subscribe((vnfInstancesData: VNFInstanceDetails[]): void => {
vnfInstancesData.forEach((vnfData: VNFInstanceDetails): void => {
+ const vnfdRef: string = 'vnfd-ref';
+ const memberIndex: string = 'member-vnf-index-ref';
+ const nsrId: string = 'nsr-id-ref';
+ const vnfId: string = 'vnfd-id';
const vnfDataObj: {} =
{
- VNFD: vnfData['vnfd-ref'],
+ // eslint-disable-next-line security/detect-object-injection
+ VNFD: vnfData[vnfdRef],
VNFInstanceId: vnfData._id,
- MemberIndex: vnfData['member-vnf-index-ref'],
- NS: vnfData['nsr-id-ref'],
- VNFID: vnfData['vnfd-id']
+ // eslint-disable-next-line security/detect-object-injection
+ MemberIndex: vnfData[memberIndex],
+ // eslint-disable-next-line security/detect-object-injection
+ NS: vnfData[nsrId],
+ // eslint-disable-next-line security/detect-object-injection
+ VNFID: vnfData[vnfId]
};
vnfInstanceData.push(vnfDataObj);
});
const nsId: string = 'NS';
+ // eslint-disable-next-line security/detect-object-injection
this.nsIdFilteredData = vnfInstanceData.filter((vnfdData: {}[]): boolean => vnfdData[nsId] === this.params.id);
- this.nsIdFilteredData.forEach((resVNF: {}[]): void => {
- const memberIndex: string = 'MemberIndex';
- const vnfinstanceID: string = 'VNFInstanceId';
+ this.nsIdFilteredData.forEach((resVNF: InstanceData): void => {
const assignMemberIndex: {} = {
- id: resVNF[memberIndex],
- vnfinstanceId: resVNF[vnfinstanceID]
+ id: resVNF.MemberIndex,
+ vnfinstanceId: resVNF.VNFInstanceId
};
this.memberVnfIndex.push(assignMemberIndex);
});
this.instanceId = id;
this.selectedvnfId = vnfInstanceDetail['vnfd-ref'];
const VDU: string = 'vdur';
+ // eslint-disable-next-line security/detect-object-injection
if (vnfInstanceDetail[VDU] !== undefined) {
+ // eslint-disable-next-line security/detect-object-injection
vnfInstanceDetail[VDU].forEach((vdu: VDUR): void => {
const vnfInstanceDataObj: {} =
{
'count-index': vdu['count-index'],
VDU: vdu['vdu-id-ref']
-
};
vnfInstanceData.push(vnfInstanceDataObj);
});
const vduName: string = 'VDU';
this.vduId = this.vdu.filter((vdu: {}, index: number, self: {}[]): {} =>
index === self.findIndex((t: {}): {} => (
+ // eslint-disable-next-line security/detect-object-injection
t[vduName] === vdu[vduName]
))
);
/** Getting count-index by filtering id */
public getCountIndex(id: string): void {
const VDU: string = 'VDU';
+ // eslint-disable-next-line security/detect-object-injection
this.countIndex = this.vdu.filter((vnfdData: {}[]): boolean => vnfdData[VDU] === id);
}
};
this.restService.postResource(apiURLHeader, startPayload).subscribe((result: {}): void => {
this.activeModal.close(modalData);
- this.router.navigate(['/instances/ns/history-operations/' + this.params.id]).catch();
+ this.router.navigate(['/instances/ns/history-operations/' + this.params.id]).catch((): void => {
+ // Catch Navigation Error
+ });
}, (error: ERRORDATA): void => {
this.restService.handleError(error, 'post');
this.isLoadingResults = false;
/** Used to get the AbstractControl of controlName passed @private */
private getFormControl(controlName: string): AbstractControl {
+ // eslint-disable-next-line security/detect-object-injection
return this.startForm.controls[controlName];
}
}