Fix Bug 2121: NG-UI uses unmaintained Chokidar version
[osm/NG-UI.git] / src / app / instances / ns-history-operations / HistoryOperationsComponent.ts
index a0cac86..afbefdb 100644 (file)
@@ -18,6 +18,7 @@
 /**
  * @file NS History Of Operations Component
  */
+import { isNullOrUndefined } from 'util';
 import { Component, Injector, OnInit } from '@angular/core';
 import { ActivatedRoute } from '@angular/router';
 import { Router } from '@angular/router';
@@ -129,9 +130,7 @@ export class HistoryOperationsComponent implements OnInit {
 
   /** Lifecyle Hooks the trigger before component is instantiate @public */
   public ngOnInit(): void {
-    // tslint:disable-next-line:no-backbone-get-set-outside-model
     this.paramsID = this.activatedRoute.snapshot.paramMap.get('id');
-    // tslint:disable-next-line:no-backbone-get-set-outside-model
     this.paramsType = this.activatedRoute.snapshot.paramMap.get('type');
     if (this.paramsType === 'ns') {
       this.historyURL = environment.NSHISTORYOPERATIONS_URL + '/?nsInstanceId=' + this.paramsID;
@@ -214,6 +213,7 @@ export class HistoryOperationsComponent implements OnInit {
   }
   /** show information methods modal with ns history info */
   public showInformation(event: MessageEvent): void {
+    // eslint-disable-next-line security/detect-non-literal-fs-filename
     this.modalService.open(ShowInfoComponent, { backdrop: 'static' }).componentInstance.params = {
       id: event.data.id,
       page: this.page,
@@ -231,12 +231,16 @@ export class HistoryOperationsComponent implements OnInit {
   /** generateData initiate the ns-instance list @private */
   private generateData(): void {
     this.isLoadingResults = true;
-    this.restService.getResource(this.historyURL).subscribe((nsdInstancesData: {}[]) => {
+    this.restService.getResource(this.historyURL).subscribe((nsdInstancesData: {}[]): void => {
       this.nsAndnstInstanceData = [];
-      nsdInstancesData.forEach((nsdAndnstInstanceData: NSDInstanceData) => {
+      nsdInstancesData.forEach((nsdAndnstInstanceData: NSDInstanceData): void => {
+        let scaleType: string = '';
+        if (!isNullOrUndefined(nsdAndnstInstanceData.operationParams.scaleVnfData)) {
+          scaleType = ' (' + nsdAndnstInstanceData.operationParams.scaleVnfData.scaleVnfType + ')';
+        }
         const nsAndnstDataObj: {} = {
           id: nsdAndnstInstanceData.id,
-          type: nsdAndnstInstanceData.lcmOperationType,
+          type: nsdAndnstInstanceData.lcmOperationType + scaleType,
           state: nsdAndnstInstanceData.operationState,
           startTime: this.sharedService.convertEpochTime(nsdAndnstInstanceData.startTime),
           statusEnteredTime: this.sharedService.convertEpochTime(nsdAndnstInstanceData.statusEnteredTime)
@@ -249,14 +253,18 @@ export class HistoryOperationsComponent implements OnInit {
       } else {
         this.checkDataClass = 'dataTables_empty';
       }
-      this.dataSource.load(this.nsAndnstInstanceData).then((data: {}) => {
+      this.dataSource.load(this.nsAndnstInstanceData).then((data: {}): void => {
         //empty block
-      }).catch();
+      }).catch((): void => {
+        // Catch Navigation Error
+    });
       this.isLoadingResults = false;
-    }, (error: ERRORDATA) => {
+    }, (error: ERRORDATA): void => {
       this.isLoadingResults = false;
       if (error.error.status === HttpStatus.NOT_FOUND || error.error.status === HttpStatus.UNAUTHORIZED) {
-        this.router.navigateByUrl('404', { skipLocationChange: true }).catch();
+        this.router.navigateByUrl('404', { skipLocationChange: true }).catch((): void => {
+          // Catch Navigation Error
+      });
       } else {
         this.restService.handleError(error, 'get');
       }