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/utilities/compose-packages/ComposePackages.ts b/src/app/utilities/compose-packages/ComposePackages.ts
index a8114d0..d294f7f 100644
--- a/src/app/utilities/compose-packages/ComposePackages.ts
+++ b/src/app/utilities/compose-packages/ComposePackages.ts
@@ -30,7 +30,6 @@
 import { environment } from 'environment';
 import * as jsyaml from 'js-yaml';
 import { NSConfigData } from 'NSCONFIGTEMPLATEMODEL';
-import { NSDDetails } from 'NSDModel';
 import * as pako from 'pako';
 import { RestService } from 'RestService';
 import { SharedService, isNullOrUndefined } from 'SharedService';
@@ -204,6 +203,7 @@
       this.getNsdPackageDetails();
       this.getFormControl('profile_type').disable();
       this.getFormControl('description').disable();
+      this.getFormControl('package').disable();
     } else if (this.params.page === 'ns-config-template-edit') {
       this.template = true;
       this.oka = false;
@@ -211,6 +211,7 @@
       this.getFormControl('profile_type').disable();
       this.getFormControl('nsdId').disable();
       this.getFormControl('description').disable();
+      this.getFormControl('package').disable();
     } else if (this.params.page === 'oka-packages') {
       this.oka = true;
       this.template = false;
@@ -241,7 +242,7 @@
     this.packagesForm = this.formBuilder.group({
       name: ['', [Validators.required]],
       nsdId: [null, [Validators.required]],
-      config: [null],
+      config: [null, [Validators.required]],
       profile_type: [null],
       description: ['', [Validators.required]],
       package: ['']
@@ -269,7 +270,7 @@
 
   /** Get NSD Package details @public */
   public getNsdPackageDetails(): void {
-    this.restService.getResource(environment.OKAPACKAGES_URL)
+    this.restService.getResource(environment.NSDESCRIPTORSCONTENT_URL)
       .subscribe((nsdPackageData: []): void => {
         nsdPackageData.forEach((nsData: VNFD): void => {
           const names: {} = {
@@ -336,6 +337,12 @@
     };
     this.addNullValueForInvalidFiles();
     this.sharedService.cleanForm(this.packagesForm);
+    if (this.params.page === 'ns-config-template-edit' || this.params.page === 'ns-config-template') {
+      if (this.packagesForm.value.config.trim() === '' || isNullOrUndefined(this.packagesForm.value.config)) {
+        this.packagesForm.controls.config.setErrors({ configIsEmpty: true });
+        this.packagesForm.get('config').setValue(this.packagesForm.get('config').value.trim());
+      }
+    }
     if (!this.packagesForm.invalid) {
       this.isLoadingResults = true;
       if (this.params.page === 'ns-package' || this.params.page === 'vnf-package') {
@@ -443,16 +450,12 @@
       url: urlHeader,
       httpOptions: { headers: this.headers }
     };
-    if (isNullOrUndefined(this.packagesForm.value.config) || this.packagesForm.value.config === '') {
-      delete this.packagesForm.value.config;
+    const validJSON: boolean = this.sharedService.checkJson(this.packagesForm.value.config);
+    if (validJSON) {
+      this.packagesForm.value.config = JSON.parse(this.packagesForm.value.config);
     } else {
-      const validJSON: boolean = this.sharedService.checkJson(this.packagesForm.value.config);
-      if (validJSON) {
-        this.packagesForm.value.config = JSON.parse(this.packagesForm.value.config);
-      } else {
-        const getConfigJson: string = jsyaml.load(this.packagesForm.value.config, { json: true });
-        this.packagesForm.value.config = getConfigJson;
-      }
+      const getConfigJson: string = jsyaml.load(this.packagesForm.value.config, { json: true });
+      this.packagesForm.value.config = getConfigJson;
     }
     this.restService.putResource(apiURLHeader, (this.packagesForm.value)).subscribe((result: {}): void => {
       this.activeModal.close(this.modalData);