Advanced Cluster Enhancements
- Added edit cluster, profile type in OKA
- State to Git State in all pages
- Changed mandatory fields of edit profile
- Changed api in cluster page
Change-Id: I8a3239f83eb58a3997e4550fc030694c0a2a6c72
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 17adaa0..a8114d0 100644
--- a/src/app/utilities/compose-packages/ComposePackages.ts
+++ b/src/app/utilities/compose-packages/ComposePackages.ts
@@ -25,7 +25,7 @@
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core';
import { NotifierService } from 'angular-notifier';
-import { APIURLHEADER, ERRORDATA, MODALCLOSERESPONSEDATA, URLPARAMS } from 'CommonModel';
+import { APIURLHEADER, ERRORDATA, MODALCLOSERESPONSEDATA, TYPESECTION, URLPARAMS } from 'CommonModel';
import { DataService } from 'DataService';
import { environment } from 'environment';
import * as jsyaml from 'js-yaml';
@@ -120,6 +120,12 @@
/** Contains selected file name @public */
public selectedFileName: string = 'Choose file...';
+ /** Contains all profile methods */
+ public profileSelect: TYPESECTION[] = [];
+
+ /** Contains all profile methods */
+ public operationType: string;
+
/** Element ref for fileInputConfig @public */
@ViewChild('fileInputConfig') fileInputConfig: ElementRef<HTMLInputElement>;
@@ -166,6 +172,22 @@
this.router = this.injector.get(Router);
this.translateService = this.injector.get(TranslateService);
this.sharedService = this.injector.get(SharedService);
+ this.profileSelect = [
+ {
+ title: 'Infra Config Profile',
+ value: 'infra_config_profiles'
+ },
+ {
+ title: 'Infra Controller Profile',
+ value: 'infra_controller_profiles'
+ }, {
+ title: 'App Profile',
+ value: 'app_profiles'
+ }, {
+ title: 'Resource Profile',
+ value: 'resource_profiles'
+ }
+ ];
}
/** convenience getter for easy access to form fields */
@@ -180,11 +202,13 @@
this.template = true;
this.oka = false;
this.getNsdPackageDetails();
+ this.getFormControl('profile_type').disable();
this.getFormControl('description').disable();
} else if (this.params.page === 'ns-config-template-edit') {
this.template = true;
this.oka = false;
this.getNsdPackageDetails();
+ this.getFormControl('profile_type').disable();
this.getFormControl('nsdId').disable();
this.getFormControl('description').disable();
} else if (this.params.page === 'oka-packages') {
@@ -205,8 +229,11 @@
this.template = false;
this.getFormControl('nsdId').disable();
this.getFormControl('config').disable();
+ this.getFormControl('profile_type').disable();
this.getFormControl('description').disable();
}
+ this.operationType = this.params.operationType;
+ this.setValidatorsForOperation();
}
/** initialize Forms @public */
@@ -215,10 +242,30 @@
name: ['', [Validators.required]],
nsdId: [null, [Validators.required]],
config: [null],
+ profile_type: [null],
description: ['', [Validators.required]],
package: ['']
});
}
+ /** Get NSD Package details @public */
+ public setValidatorsForOperation(): void {
+ if (this.params.page === 'oka-packages') {
+ this.packagesForm.get('name').setValidators([Validators.required]);
+ this.packagesForm.get('description').setValidators([Validators.required]);
+ this.packagesForm.get('package').setValidators([Validators.required]);
+ this.packagesForm.get('profile_type').setValidators([Validators.required]);
+ } else if (this.params.page === 'oka-packages-edit') {
+ this.packagesForm.get('profile_type').clearValidators();
+ this.packagesForm.get('name').clearValidators();
+ this.packagesForm.get('description').clearValidators();
+ this.packagesForm.get('package').clearValidators();
+ }
+ this.packagesForm.get('profile_type').updateValueAndValidity();
+ this.packagesForm.get('name').updateValueAndValidity();
+ this.packagesForm.get('description').updateValueAndValidity();
+ this.packagesForm.get('package').updateValueAndValidity();
+ }
+
/** Get NSD Package details @public */
public getNsdPackageDetails(): void {
@@ -250,7 +297,7 @@
this.package_name = nsdPackageData.name;
const package_file = nsdPackageData._admin.storage.zipfile;
this.selectedFileName = package_file;
- this.packagesForm.patchValue({ name: this.package_name, description: nsdPackageData.description });
+ this.packagesForm.patchValue({ name: this.package_name, description: nsdPackageData.description, profile_type: nsdPackageData.profile_type });
this.fileInput.nativeElement.value = null;
}, (error: ERRORDATA): void => {
this.restService.handleError(error, 'get');