Advanced Cluster Management - NGUI

	- Added new OKA packages module under packages
	- Added Profiless, KSU under k8s section
	- Feature 11020. 11022, 11023, 11024, 11025, 11026

Change-Id: Ibddeb4d5693ce24d80e378277693405c810f6e04
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
diff --git a/src/app/k8s/k8scluster/K8sClusterComponent.ts b/src/app/k8s/k8scluster/K8sClusterComponent.ts
index 88a4fb6..ee98ed5 100644
--- a/src/app/k8s/k8scluster/K8sClusterComponent.ts
+++ b/src/app/k8s/k8scluster/K8sClusterComponent.ts
@@ -26,7 +26,7 @@
 import { environment } from 'environment';
 import { K8sActionComponent } from 'K8sActionComponent';
 import { K8sAddClusterComponent } from 'K8sAddClusterComponent';
-import { K8SCLUSTERDATA, K8SCLUSTERDATADISPLAY } from 'K8sModel';
+import { K8SCLUSTERDATA, K8SCLUSTERDATADISPLAY, K8SCREATEDATADISPLAY } from 'K8sModel';
 import { LocalDataSource } from 'ng2-smart-table';
 import { RestService } from 'RestService';
 import { Subscription } from 'rxjs';
@@ -66,15 +66,27 @@
   /** Class for empty and present data @public */
   public checkDataClass: string;
 
-  /** operational State init data @public */
+  /** operational State created data @public */
   public operationalStateFirstStep: string = CONFIGCONSTANT.k8OperationalStateFirstStep;
 
-  /** operational State running data @public */
+  /** operational State in creation data @public */
   public operationalStateSecondStep: string = CONFIGCONSTANT.k8OperationalStateStateSecondStep;
 
-  /** operational State failed data @public */
+  /** operational State in deletion data @public */
   public operationalStateThirdStep: string = CONFIGCONSTANT.k8OperationalStateThirdStep;
 
+  /** operational State failed deletion data @public */
+  public operationalStateFourthStep: string = CONFIGCONSTANT.k8OperationalStateFourthStep;
+
+  /** operational State failed creation data @public */
+  public operationalStateFifthStep: string = CONFIGCONSTANT.k8OperationalStateFifthStep;
+
+  /** cluster Type @public */
+  public isCluster: string = 'Registered';
+
+  /** cluster  @public */
+  public clusterUrl: string;
+
   /** Instance of the rest service @private */
   private restService: RestService;
 
@@ -107,6 +119,7 @@
     this.generateSettings();
     this.generateData();
     this.generateDataSub = this.sharedService.dataEvent.subscribe(() => { this.generateData(); });
+    sessionStorage.setItem('clusterType', this.isCluster);
   }
 
   /** smart table Header Colums @public */
@@ -115,8 +128,8 @@
       name: { title: this.translateService.instant('NAME'), width: '20%', sortDirection: 'asc' },
       identifier: { title: this.translateService.instant('IDENTIFIER'), width: '20%' },
       version: { title: this.translateService.instant('K8VERSION'), width: '10%' },
-      operationalState: {
-        title: this.translateService.instant('OPERATIONALSTATE'), width: '15%', type: 'html',
+      state: {
+        title: this.translateService.instant('STATE'), width: '15%', type: 'html',
         filter: {
           type: 'list',
           config: {
@@ -124,25 +137,35 @@
             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.operationalStateThirdStep, title: this.operationalStateFourthStep },
+              { value: this.operationalStateThirdStep, title: this.operationalStateFifthStep }
             ]
           }
         },
         valuePrepareFunction: (cell: K8SCLUSTERDATADISPLAY, row: K8SCLUSTERDATADISPLAY): string => {
-          if (row.operationalState === this.operationalStateFirstStep) {
-            return `<span class="icon-label" title="${row.operationalState}">
-                        <i class="fas fa-clock text-warning"></i>
-                        </span>`;
-          } else if (row.operationalState === this.operationalStateSecondStep) {
-            return `<span class="icon-label" title="${row.operationalState}">
-                        <i class="fas fa-check-circle text-success"></i>
-                        </span>`;
-          } else if (row.operationalState === this.operationalStateThirdStep) {
-            return `<span class="icon-label" title="${row.operationalState}">
-                        <i class="fas fa-times-circle text-danger"></i>
-                        </span>`;
+          if (row.state === this.operationalStateFirstStep) {
+            return `<span class="icon-label" title="${row.state}">
+                         <i class="fas fa-clock text-success"></i>
+                         </span>`;
+          } else if (row.state === this.operationalStateSecondStep) {
+            return `<span class="icon-label" title="${row.state}">
+                         <i class="fas fa-spinner text-warning"></i>
+                         </span>`;
+          } else if (row.state === this.operationalStateThirdStep) {
+            return `<span class="icon-label" title="${row.state}">
+                         <i class="fas fa-spinner text-danger"></i>
+                         </span>`;
+          } else if (row.state === this.operationalStateFourthStep) {
+            return `<span class="icon-label" title="${row.state}">
+                         <i class="fas fa-times-circle text-danger"></i>
+                         </span>`;
+          } else if (row.state === this.operationalStateFifthStep) {
+            return `<span class="icon-label" title="${row.state}">
+                         <i class="fas fa-times-circle text-warning"></i>
+                         </span>`;
           } else {
-            return `<span>${row.operationalState}</span>`;
+            return `<span>${row.state}</span>`;
           }
         }
       },
@@ -182,13 +205,19 @@
   public addK8sCluster(): void {
     // eslint-disable-next-line security/detect-non-literal-fs-filename
     const modalRef: NgbModalRef = this.modalService.open(K8sAddClusterComponent, { backdrop: 'static' });
+
+    if (this.isCluster === 'Registered') {
+      modalRef.componentInstance.profileType = 'Register';
+    } else {
+      modalRef.componentInstance.profileType = 'Manage';
+    }
     modalRef.result.then((result: MODALCLOSERESPONSEDATA) => {
       if (result) {
         this.sharedService.callData();
       }
     }).catch((): void => {
       // Catch Navigation Error
-  });
+    });
   }
 
   /**
@@ -202,6 +231,7 @@
   public generateK8sclusterData(k8sClusterdata: K8SCLUSTERDATA): K8SCLUSTERDATADISPLAY {
     return {
       name: k8sClusterdata.name,
+      state: k8sClusterdata.state,
       identifier: k8sClusterdata._id,
       operationalState: k8sClusterdata._admin.operationalState,
       version: k8sClusterdata.k8s_version,
@@ -211,10 +241,28 @@
     };
   }
 
+  /** Change event @public */
+  public onChangeEvent(value: string): void {
+    if (value === 'Managed') {
+      this.isCluster = 'Managed';
+    } else {
+      this.isCluster = 'Registered';
+    }
+    sessionStorage.setItem('clusterType', value);
+    this.generateColumns();
+    this.generateSettings();
+    this.generateData();
+  }
+
   /** Fetching the data from server to Load in the smarttable @protected */
   protected generateData(): void {
     this.isLoadingResults = true;
-    this.restService.getResource(environment.K8SCLUSTER_URL).subscribe((k8sClusterDatas: K8SCLUSTERDATA[]) => {
+    if (this.isCluster === 'Registered') {
+      this.clusterUrl = environment.K8SCREATECLUSTER_URL + '?created=false';
+    } else {
+      this.clusterUrl = environment.K8SCREATECLUSTER_URL + '?created=true';
+    }
+    this.restService.getResource(this.clusterUrl).subscribe((k8sClusterDatas: K8SCLUSTERDATA[]) => {
       this.k8sClusterData = [];
       k8sClusterDatas.forEach((k8sClusterdata: K8SCLUSTERDATA) => {
         const k8sClusterDataObj: K8SCLUSTERDATADISPLAY = this.generateK8sclusterData(k8sClusterdata);