X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Fapp%2Fprojects%2FProjectsComponent.ts;h=982421eef2e51ad495d3ab12208d586657a9743d;hb=0a34dfa32165036b380ec6ac493469b34007df0a;hp=752499459cc066adce9440091a20d3525bec3df0;hpb=3b4814aa2d3dec621dadb52f058ba95a3dc3a86a;p=osm%2FNG-UI.git diff --git a/src/app/projects/ProjectsComponent.ts b/src/app/projects/ProjectsComponent.ts index 7524994..982421e 100644 --- a/src/app/projects/ProjectsComponent.ts +++ b/src/app/projects/ProjectsComponent.ts @@ -18,6 +18,7 @@ /** * @file Project details Component. */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, OnDestroy, OnInit } from '@angular/core'; import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; import { TranslateService } from '@ngx-translate/core'; @@ -145,13 +146,16 @@ export class ProjectsComponent implements OnInit, OnDestroy { /** Modal service to initiate the project add @private */ public projectAdd(): void { - const modalRef: NgbModalRef = this.modalService.open(ProjectCreateUpdateComponent, { backdrop: 'static' }); + // eslint-disable-next-line security/detect-non-literal-fs-filename + const modalRef: NgbModalRef = this.modalService.open(ProjectCreateUpdateComponent, { size: 'lg', backdrop: 'static' }); modalRef.componentInstance.projectType = 'Add'; modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { if (result) { this.generateData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** smart table listing manipulation @private */ @@ -169,10 +173,12 @@ export class ProjectsComponent implements OnInit, OnDestroy { public generateProjectData(projectData: ProjectDetails): ProjectData { return { projectName: projectData.name, - modificationDate: this.sharedService.convertEpochTime(projectData._admin.modified), - creationDate: this.sharedService.convertEpochTime(projectData._admin.created), + modificationDate: this.sharedService.convertEpochTime(!isNullOrUndefined(projectData._admin) + ? projectData._admin.modified : null), + creationDate: this.sharedService.convertEpochTime(!isNullOrUndefined(projectData._admin) ? projectData._admin.created : null), id: projectData._id, - project: projectData._id + project: projectData._id, + quotas: !isNullOrUndefined(projectData.quotas) && Object.keys(projectData.quotas).length !== 0 ? projectData.quotas : null }; } @@ -194,7 +200,9 @@ export class ProjectsComponent implements OnInit, OnDestroy { }); this.dataSource.load(this.projectData).then((data: boolean) => { this.isLoadingResults = false; - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.restService.handleError(error, 'get'); this.isLoadingResults = false;