From: SANDHYA.JS Date: Fri, 13 Oct 2023 06:15:25 +0000 (+0530) Subject: Fix Bug 2296: Newly Created Ns should come first in NG-UI X-Git-Tag: release-v15.0-start~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F63%2F13963%2F2;p=osm%2FNG-UI.git Fix Bug 2296: Newly Created Ns should come first in NG-UI - Sorted the list using created Date in descending order - Incorrect Information in "Expires in " section of Admin user : Changed it to N/A - VIM Resource Overview: RAM Value should be rounded off : Rounded off the value to 2 decimal points - Fixed the key issue in topology Change-Id: I634aee0b4e4540386c5108232746f56959bcc838 Signed-off-by: SANDHYA.JS --- diff --git a/src/app/instances/ns-instances/NSInstancesComponent.ts b/src/app/instances/ns-instances/NSInstancesComponent.ts index 5cc5519..e7de4a7 100644 --- a/src/app/instances/ns-instances/NSInstancesComponent.ts +++ b/src/app/instances/ns-instances/NSInstancesComponent.ts @@ -144,9 +144,13 @@ export class NSInstancesComponent implements OnInit { /** 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: { @@ -244,7 +248,8 @@ export class NSInstancesComponent implements OnInit { 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); }); diff --git a/src/app/instances/ns-topology/NSTopologyComponent.html b/src/app/instances/ns-topology/NSTopologyComponent.html index d500535..084f90e 100644 --- a/src/app/instances/ns-topology/NSTopologyComponent.html +++ b/src/app/instances/ns-topology/NSTopologyComponent.html @@ -113,7 +113,7 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i Vnfd Id - {{(vnfr.vnfdID)?vnfr.vnfdID:'-'}} + {{(vnfr.vnfdId)?vnfr.vnfdId:'-'}} Member index diff --git a/src/app/instances/pdu-instances/PDUInstancesComponent.ts b/src/app/instances/pdu-instances/PDUInstancesComponent.ts index 5c25279..6a2ca34 100644 --- a/src/app/instances/pdu-instances/PDUInstancesComponent.ts +++ b/src/app/instances/pdu-instances/PDUInstancesComponent.ts @@ -124,10 +124,13 @@ export class PDUInstancesComponent implements OnInit, OnDestroy { 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'), diff --git a/src/app/instances/vnf-instances/VNFInstancesComponent.ts b/src/app/instances/vnf-instances/VNFInstancesComponent.ts index 90bb6fe..c27384d 100644 --- a/src/app/instances/vnf-instances/VNFInstancesComponent.ts +++ b/src/app/instances/vnf-instances/VNFInstancesComponent.ts @@ -118,7 +118,7 @@ export class VNFInstancesComponent implements OnInit { /** 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, @@ -126,7 +126,10 @@ export class VNFInstancesComponent implements OnInit { }, 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'), diff --git a/src/app/users/user-details/UserDetailsComponent.ts b/src/app/users/user-details/UserDetailsComponent.ts index 12c37fe..c56f43a 100644 --- a/src/app/users/user-details/UserDetailsComponent.ts +++ b/src/app/users/user-details/UserDetailsComponent.ts @@ -252,8 +252,8 @@ export class UserDetailsComponent implements OnInit, OnDestroy { 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); } diff --git a/src/app/vim-accounts/Resources-Overview/ResourcesOverviewComponent.ts b/src/app/vim-accounts/Resources-Overview/ResourcesOverviewComponent.ts index 11d48d7..eb7c8bc 100644 --- a/src/app/vim-accounts/Resources-Overview/ResourcesOverviewComponent.ts +++ b/src/app/vim-accounts/Resources-Overview/ResourcesOverviewComponent.ts @@ -62,6 +62,9 @@ export class ResourcesOverviewComponent implements OnChanges { @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); @@ -115,9 +118,9 @@ export class ResourcesOverviewComponent implements OnChanges { 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; @@ -125,7 +128,7 @@ export class ResourcesOverviewComponent implements OnChanges { 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; } @@ -140,8 +143,10 @@ export class ResourcesOverviewComponent implements OnChanges { // 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 + }] }; } /** diff --git a/src/models/NSInstanceModel.ts b/src/models/NSInstanceModel.ts index 12ce977..5039cc5 100644 --- a/src/models/NSInstanceModel.ts +++ b/src/models/NSInstanceModel.ts @@ -49,6 +49,8 @@ export interface NSInstanceDetails { additionalParamsForNs: AdditionalParamForN; _id?: string; vcaStatus?: object; + startTime?: string; + 'create-time'?: string; } /** Interface for Admin */ @@ -266,6 +268,7 @@ export interface NSDInstanceData { operationParams?: OPERATIONPARAMS; 'nsd-id': string; constituent: string[]; + 'create-time'?: string; } /** Interface for the operationparams */ diff --git a/src/services/SharedService.ts b/src/services/SharedService.ts index ba805e6..e8eac94 100644 --- a/src/services/SharedService.ts +++ b/src/services/SharedService.ts @@ -468,6 +468,19 @@ export class SharedService { })); } + /** 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);