Feature: 11055 Support of several node groups in clusters created by OSM

	- Added control plane support in managed post
	- When aws vim account is selected paylaod will get differed
	- Added details page in clusters to view node and ksu for
	  specified cluster
	- Fixed Bug 2402 - Unable to create Ns Config template from Ui
	  bug by chnaging api

Change-Id: I4eb327fd86b0c4a706b05a8ed10524e4d2c5bc95
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
diff --git a/src/app/k8s/k8s-action/K8sActionComponent.ts b/src/app/k8s/k8s-action/K8sActionComponent.ts
index 919dda1..0728381 100644
--- a/src/app/k8s/k8s-action/K8sActionComponent.ts
+++ b/src/app/k8s/k8s-action/K8sActionComponent.ts
@@ -20,6 +20,7 @@
  */
 import { HttpHeaders } from '@angular/common/http';
 import { ChangeDetectorRef, Component, Injector } from '@angular/core';
+import { Router } from '@angular/router';
 import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
 import { TranslateService } from '@ngx-translate/core';
 import { NotifierService } from 'angular-notifier';
@@ -31,6 +32,7 @@
 import { K8sInfraConfigAddComponent } from 'K8sInfraConfigAddComponent';
 import { INFRACONFIGPAYLOAD, K8SCLUSTERDATADISPLAY, K8SPayload, K8SREPODATADISPLAY } from 'K8sModel';
 import { KSUAddComponent } from 'KSUAddComponent';
+import { NodeAddComponent } from 'NodeAddComponent';
 import { RestService } from 'RestService';
 import { isNullOrUndefined, SharedService } from 'SharedService';
 import { ShowInfoComponent } from 'ShowInfoComponent';
@@ -72,6 +74,9 @@
   /** Check cluster or not @public */
   public isCluster = false;
 
+  /** Check node group or not @public */
+  public isNode = false;
+
   /** Check the loading results for loader status @public */
   public isLoadingDownloadResult: boolean = false;
 
@@ -82,7 +87,10 @@
   private sharedService: SharedService;
 
   /** Contains instance ID @private */
-  private instanceID: string;
+  private k8sID: string;
+
+  /** Contains instance name @private */
+  private k8sName: string;
 
   /** Utilizes rest service for any CRUD operations @private */
   private restService: RestService;
@@ -100,6 +108,9 @@
   /** Controls the header form @private */
   private headers: HttpHeaders;
 
+  /** Holds teh instance of AuthService class of type AuthService @private */
+  private router: Router;
+
   constructor(injector: Injector) {
     this.injector = injector;
     this.modalService = this.injector.get(NgbModal);
@@ -108,6 +119,7 @@
     this.translateService = this.injector.get(TranslateService);
     this.restService = this.injector.get(RestService);
     this.cd = this.injector.get(ChangeDetectorRef);
+    this.router = this.injector.get(Router);
   }
 
   /**
@@ -118,7 +130,8 @@
       Accept: 'application/zip, application/json',
       'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0'
     });
-    this.instanceID = this.value.identifier;
+    this.k8sID = this.value.identifier;
+    this.k8sName = this.value.name;
     this.getK8sType = this.value.pageType;
     this.state = this.value.state;
     if ((this.value.createdbyosm) === 'true') {
@@ -137,6 +150,12 @@
     } else {
       this.isProfile = false;
     }
+
+    if (this.value.pageType === 'node') {
+      this.isNode = true;
+    } else {
+      this.isNode = false;
+    }
   }
 
   /** Delete User Account @public */
@@ -155,6 +174,13 @@
     });
   }
 
+  /** Details page @public */
+  public nodeK8s(): void {
+    this.router.navigate(['/k8s/details/' + this.k8sID]).catch((): void => {
+      // Catch Navigation Error
+    });
+  }
+
   /** Shows information using modalservice @public */
   public infoK8s(pageType: string): void {
     let pageName: string = '';
@@ -162,18 +188,26 @@
     if (pageType === 'repo') {
       pageName = 'k8s-repo';
       title = 'PAGE.K8S.K8SREPODETAILS';
+    } else if (pageType === 'node') {
+      pageName = 'k8s-node';
+      title = 'Node Details';
+    } else if (pageType === 'k8-ksu') {
+      pageName = 'k8s-ksu';
+      title = 'KSU Details';
     } else {
       pageName = 'k8s-cluster';
       title = 'PAGE.K8S.K8SCLUSTERDETAILS';
     }
     // eslint-disable-next-line security/detect-non-literal-fs-filename
     this.modalService.open(ShowInfoComponent, { backdrop: 'static' }).componentInstance.params = {
-      id: this.instanceID,
+      id: this.k8sID,
       page: pageName,
       titleName: title,
       createdbyosm: this.value.createdbyosm,
       bootstrap: this.value.bootstrap,
-      key: this.value.key
+      key: this.value.key,
+      cluster_mode: this.value.cluster_mode,
+      cluster_id: this.value.cluster_id
     };
   }
   /** Edit profile @public */
@@ -208,6 +242,22 @@
     });
   }
 
+  /** Handle Scaling @public */
+  public scaling(editType: string): void {
+    // eslint-disable-next-line security/detect-non-literal-fs-filename
+    const modalRef: NgbModalRef = this.modalService.open(NodeAddComponent, { backdrop: 'static' });
+    modalRef.componentInstance.profileID = this.value.identifier;
+    modalRef.componentInstance.clusterId = this.value.cluster_id;
+    modalRef.componentInstance.profileType = editType;
+    modalRef.result.then((result: MODALCLOSERESPONSEDATA) => {
+      if (result) {
+        this.sharedService.callData();
+      }
+    }).catch((): void => {
+      // Catch Navigation Error
+    });
+  }
+
 
   /** Edit profile under cluster @public */
   public editClusterProfile(editType: string): void {
@@ -261,10 +311,10 @@
       headers: this.headers,
       responseType: 'blob'
     };
-    this.restService.getResource(environment.K8SCREATECLUSTER_URL + '/' + this.instanceID + '/get_creds')
+    this.restService.getResource(environment.K8SCREATECLUSTER_URL + '/' + this.k8sID + '/get_creds')
       .subscribe((res: { op_id: string }) => {
         if (!isNullOrUndefined(res.op_id)) {
-          this.restService.getResource(environment.K8SCREATECLUSTER_URL + '/' + this.instanceID + '/get_creds_file' + '/' + res.op_id, httpOptions)
+          this.restService.getResource(environment.K8SCREATECLUSTER_URL + '/' + this.k8sID + '/get_creds_file' + '/' + res.op_id, httpOptions)
             .subscribe((response: Blob) => {
               this.isLoadingDownloadResult = true;
               if (!isNullOrUndefined(response)) {