Fix Bug 2336: Manual Healing option in Ui
[osm/NG-UI.git] / src / app / instances / ns-instances / NSInstancesComponent.ts
index 41bb384..14d6349 100644 (file)
@@ -81,6 +81,12 @@ export class NSInstancesComponent implements OnInit {
     /** operational State failed data @public */
     public operationalStateThirdStep: string = CONFIGCONSTANT.operationalStateThirdStep;
 
+    /** operational State scaling data @public */
+    public operationalStateFourthStep: string = CONFIGCONSTANT.operationalStateFourthStep;
+
+    /** operational State healing data @public */
+    public operationalStateFifthStep: string = CONFIGCONSTANT.operationalStateFifthStep;
+
     /** Config State init data @public */
     public configStateFirstStep: string = CONFIGCONSTANT.configStateFirstStep;
 
@@ -141,9 +147,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: {
@@ -153,23 +163,34 @@ export class NSInstancesComponent implements OnInit {
                         list: [
                             { value: this.operationalStateFirstStep, title: this.operationalStateFirstStep },
                             { value: this.operationalStateSecondStep, title: this.operationalStateSecondStep },
-                            { value: this.operationalStateThirdStep, title: this.operationalStateThirdStep }
+                            { value: this.operationalStateThirdStep, title: this.operationalStateThirdStep },
+                            { value: this.operationalStateFourthStep, title: this.operationalStateFourthStep },
+                            { value: this.operationalStateFifthStep, title: this.operationalStateFifthStep }
                         ]
                     }
                 },
                 valuePrepareFunction: (cell: NSDInstanceData, row: NSDInstanceData): string => {
                     if (row.OperationalStatus === this.operationalStateFirstStep) {
                         return `<span class="icon-label" title="${row.OperationalStatus}">
-                        <i class="fas fa-clock text-warning"></i>
-                        </span>`;
+                         <i class="fas fa-clock text-warning"></i>
+                         </span>`;
                     } else if (row.OperationalStatus === this.operationalStateSecondStep) {
                         return `<span class="icon-label" title="${row.OperationalStatus}">
-                        <i class="fas fa-check-circle text-success"></i>
-                        </span>`;
+                         <i class="fas fa-check-circle text-success"></i>
+                         </span>`;
                     } else if (row.OperationalStatus === this.operationalStateThirdStep) {
                         return `<span class="icon-label" title="${row.OperationalStatus}">
-                        <i class="fas fa-times-circle text-danger"></i>
-                        </span>`;
+                         <i class="fas fa-times-circle text-danger"></i>
+                         </span>`;
+                    } else if (row.OperationalStatus === this.operationalStateFourthStep) {
+                        return `<span class="icon-label" title="${row.OperationalStatus}">
+                         <i class="fas fa-compress-alt text-success"></i>
+                         </span>`;
+                    }
+                    else if (row.OperationalStatus === this.operationalStateFifthStep) {
+                        return `<span class="icon-label" title="${row.OperationalStatus}">
+                         <i class="fas fa-briefcase-medical text-success"></i>
+                         </span>`;
                     } else {
                         return `<span>${row.OperationalStatus}</span>`;
                     }
@@ -191,16 +212,16 @@ export class NSInstancesComponent implements OnInit {
                 valuePrepareFunction: (cell: NSDInstanceData, row: NSDInstanceData): string => {
                     if (row.ConfigStatus === this.configStateFirstStep) {
                         return `<span class="icon-label" title="${row.ConfigStatus}">
-                        <i class="fas fa-clock text-warning"></i>
-                        </span>`;
+                         <i class="fas fa-clock text-warning"></i>
+                         </span>`;
                     } else if (row.ConfigStatus === this.configStateSecondStep) {
                         return `<span class="icon-label" title="${row.ConfigStatus}">
-                        <i class="fas fa-check-circle text-success"></i>
-                        </span>`;
+                         <i class="fas fa-check-circle text-success"></i>
+                         </span>`;
                     } else if (row.ConfigStatus === this.configStateThirdStep) {
                         return `<span class="icon-label" title="${row.ConfigStatus}">
-                        <i class="fas fa-times-circle text-danger"></i>
-                        </span>`;
+                         <i class="fas fa-times-circle text-danger"></i>
+                         </span>`;
                     } else {
                         return `<span>${row.ConfigStatus}</span>`;
                     }
@@ -230,7 +251,14 @@ export class NSInstancesComponent implements OnInit {
                     ConfigStatus: nsdInstanceData['config-status'],
                     DetailedStatus: nsdInstanceData['detailed-status'],
                     memberIndex: nsdInstanceData.nsd.df,
-                    nsConfig: nsdInstanceData.nsd['ns-configuration']
+                    nsConfig: nsdInstanceData.nsd['ns-configuration'],
+                    adminDetails: nsdInstanceData._admin,
+                    vnfID: nsdInstanceData['vnfd-id'],
+                    nsd: nsdInstanceData.nsd,
+                    'nsd-id': nsdInstanceData['nsd-id'],
+                    vcaStatus: nsdInstanceData.vcaStatus,
+                    constituent: nsdInstanceData['constituent-vnfr-ref'],
+                    'create-time': this.sharedService.convertEpochTime(Number(nsdInstanceData['create-time']))
                 };
                 this.nsInstanceData.push(nsDataObj);
             });
@@ -241,7 +269,9 @@ export class NSInstancesComponent implements OnInit {
             }
             this.dataSource.load(this.nsInstanceData).then((data: {}): void => {
                 this.isLoadingResults = false;
-            }).catch();
+            }).catch((): void => {
+                // Catch Navigation Error
+            });
         }, (error: ERRORDATA): void => {
             this.restService.handleError(error, 'get');
             this.isLoadingResults = false;
@@ -261,12 +291,15 @@ export class NSInstancesComponent implements OnInit {
 
     /** Instantiate NS using modalservice @public */
     public instantiateNS(): void {
+        // eslint-disable-next-line security/detect-non-literal-fs-filename
         const modalRef: NgbModalRef = this.modalService.open(InstantiateNsComponent, { backdrop: 'static' });
         modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => {
             if (result) {
                 this.generateData();
             }
-        }).catch();
+        }).catch((): void => {
+            // Catch Navigation Error
+        });
     }
 
     /**