/** Generate smart table row title and filters @public */
public generateTableColumn(): void {
this.columnList = {
- name: { title: this.translateService.instant('NAME'), width: '15%', sortDirection: 'asc' },
+ name: { title: this.translateService.instant('NAME'), width: '15%' },
identifier: { title: this.translateService.instant('IDENTIFIER'), width: '20%' },
NsdName: { title: this.translateService.instant('NSDNAME'), width: '15%' },
+ 'create-time': {
+ title: this.translateService.instant('DATE'), width: '15%', sortDirection: 'desc',
+ compareFunction: this.sharedService.compareFunction
+ },
OperationalStatus: {
title: this.translateService.instant('OPERATIONALSTATUS'), width: '10%', type: 'html',
filter: {
nsd: nsdInstanceData.nsd,
'nsd-id': nsdInstanceData['nsd-id'],
vcaStatus: nsdInstanceData.vcaStatus,
- constituent: nsdInstanceData['constituent-vnfr-ref']
+ constituent: nsdInstanceData['constituent-vnfr-ref'],
+ 'create-time': this.sharedService.convertEpochTime(Number(nsdInstanceData['create-time']))
};
this.nsInstanceData.push(nsDataObj);
});
</tr>
<tr>
<td>Vnfd Id</td>
- <td>{{(vnfr.vnfdID)?vnfr.vnfdID:'-'}}</td>
+ <td>{{(vnfr.vnfdId)?vnfr.vnfdId:'-'}}</td>
</tr>
<tr>
<td>Member index</td>
public generateTableColumn(): void {
this.columnList = {
identifier: { title: this.translateService.instant('IDENTIFIER'), width: '25%' },
- name: { title: this.translateService.instant('NAME'), width: '20%', sortDirection: 'asc' },
+ name: { title: this.translateService.instant('NAME'), width: '20%' },
type: { title: this.translateService.instant('TYPE'), width: '15%' },
usageState: { title: this.translateService.instant('USAGESTATE'), width: '15%' },
- CreatedAt: { title: this.translateService.instant('CREATEDAT'), width: '15%' },
+ CreatedAt: {
+ title: this.translateService.instant('CREATEDAT'), width: '15%', sortDirection: 'desc',
+ compareFunction: this.sharedService.compareFunction
+ },
Actions: {
name: 'Action', width: '10%', filter: false, sort: false, type: 'custom',
title: this.translateService.instant('ACTIONS'),
/** Generate smart table row title and filters @public */
public generateTableColumn(): void {
this.columnList = {
- identifier: { title: this.translateService.instant('IDENTIFIER'), width: '25%', sortDirection: 'asc' },
+ identifier: { title: this.translateService.instant('IDENTIFIER'), width: '25%' },
VNFD: {
title: this.translateService.instant('VNFD'), width: '20%', type: 'custom',
valuePrepareFunction: (cell: VNFInstanceData, row: VNFInstanceData): VNFInstanceData => row,
},
MemberIndex: { title: this.translateService.instant('MEMBERINDEX'), width: '15%' },
NS: { title: this.translateService.instant('NS'), width: '20%' },
- CreatedAt: { title: this.translateService.instant('CREATEDAT'), width: '15%' },
+ CreatedAt: {
+ title: this.translateService.instant('CREATEDAT'), width: '15%', sortDirection: 'desc',
+ compareFunction: this.sharedService.compareFunction
+ },
Actions: {
name: 'Action', width: '5%', filter: false, sort: false, type: 'custom',
title: this.translateService.instant('ACTIONS'),
projects: userData.projectListName,
identifier: userData._id,
user_status: userData._admin.user_status,
- account_expire_time: this.sharedService.convertEpochTime(!isNullOrUndefined(userData._admin) ?
- userData._admin.account_expire_time : null)
+ account_expire_time: (!isNullOrUndefined(userData._admin) && !isNullOrUndefined(userData._admin.account_expire_time)) ? this.sharedService.convertEpochTime(
+ userData._admin.account_expire_time) : 'N/A'
};
this.userData.push(userDataObj);
}
@Input() public resourcesData: VimAccountDetails;
/** Resources data for generating chart @public */
public chartData: RESOURCESDATA[] = [];
+ /** Count of decimalPoints @private */
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
+ private decimalPoints: number = 2;
constructor(injector: Injector) {
this.injector = injector;
this.translateService = this.injector.get(TranslateService);
let usedColor: string = RANGECOLOR.used;
// eslint-disable-next-line security/detect-object-injection
const getValuesUsedFree: number[] = Object.values(compute[key]);
- const total: number = key === keyValidate ? getValuesUsedFree[0] / CONSTANTNUMBER.oneGB : getValuesUsedFree[0];
- const used: number = key === keyValidate ? getValuesUsedFree[1] / CONSTANTNUMBER.oneGB : getValuesUsedFree[1];
- const remaining: number = total - used;
+ const total: number = key === keyValidate ? Number((getValuesUsedFree[0] / CONSTANTNUMBER.oneGB).toFixed(this.decimalPoints)) : Number((getValuesUsedFree[0]).toFixed(this.decimalPoints));
+ const used: number = key === keyValidate ? Number((getValuesUsedFree[1] / CONSTANTNUMBER.oneGB).toFixed(this.decimalPoints)) : Number((getValuesUsedFree[1]).toFixed(this.decimalPoints));
+ const remaining: number = Number((total - used).toFixed(this.decimalPoints));
const usedPercentage: number = (used / total) * range.percentage;
if (usedPercentage >= range.nearlyFull && usedPercentage < range.full) {
usedColor = RANGECOLOR.nearlyfull;
if (usedPercentage === range.full) {
usedColor = RANGECOLOR.full;
}
- getData.push(this.generateChartData(key, { total, used, remaining }, [usedColor, '#b9bcc3'] ));
+ getData.push(this.generateChartData(key, { total, used, remaining }, [usedColor, '#b9bcc3']));
});
return getData;
}
// eslint-disable-next-line security/detect-object-injection
title: CONFIGRESOURCESTITLE[setTitle],
values: this.generateChartDataValues(setValues.total, setValues.used, setValues.remaining),
- data: [{data: [setValues.used, setValues.remaining], backgroundColor: setColor,
- hoverBackgroundColor: setColor, hoverBorderColor: setColor}]
+ data: [{
+ data: [setValues.used, setValues.remaining], backgroundColor: setColor,
+ hoverBackgroundColor: setColor, hoverBorderColor: setColor
+ }]
};
}
/**
additionalParamsForNs: AdditionalParamForN;
_id?: string;
vcaStatus?: object;
+ startTime?: string;
+ 'create-time'?: string;
}
/** Interface for Admin */
operationParams?: OPERATIONPARAMS;
'nsd-id': string;
constituent: string[];
+ 'create-time'?: string;
}
/** Interface for the operationparams */
}));
}
+ /** Sorting the list based on date @public */
+ public compareFunction = (dir: number, a: string, b: string): number => {
+ const first: number = new Date(a).getTime();
+ const second: number = new Date(b).getTime();
+ if (first < second) {
+ return -1 * dir;
+ }
+ if (first > second) {
+ return dir;
+ }
+ return 0;
+ };
+
/** Method to validate file extension and size @private */
private vaildataFileInfo(fileInfo: File, fileType: string): boolean {
const extension: string = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);