summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/genericForm
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2019-12-05 17:04:45 +0200
committerYoav Schneiderman <yoav.schneiderman@intl.att.com>2019-12-08 14:20:44 +0200
commit77dd486269bb11f1e206114b87033a7dcc58c012 (patch)
tree8df5710c6f184a2f58837b48df94009f2db39248 /vid-webpack-master/src/app/shared/components/genericForm
parentad530ef6478ed2c8d3d153738ed735130b4019e7 (diff)
Changing VNF platform to multiselect + cypress + API
Issue-ID: VID-724 Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com> Change-Id: Ie8c720974da3419e26ce7e8675622f75780581b9 Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/genericForm')
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts19
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts35
2 files changed, 6 insertions, 48 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts
index 9782f0ee3..28d49d51b 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts
@@ -935,25 +935,8 @@ describe('VNF Control Generator', () => {
})().then(done).catch(done.fail));
-
- test('should call platform dropdown control', ()=>{
- spyOn(service, 'getPlatformDropdownControl');
-
- service.getPlatformControl(null, [], false);
-
- expect(service.getPlatformDropdownControl).toBeCalledWith(null, []);
- });
-
- test('should call platform multi select control', ()=>{
- spyOn(service, 'getPlatformMultiselectControl');
-
- service.getPlatformControl(null, [], true);
-
- expect(service.getPlatformMultiselectControl).toBeCalledWith(null, []);
- });
-
test('should generate platform multi select control', ()=>{
- const control = service.getPlatformMultiselectControl(null, []);
+ const control = service.getPlatformMultiselectControl(null, [],false);
expect(control.type).toEqual(FormControlType.MULTI_SELECT);
expect(control.controlName).toEqual('platformName');
expect(control.displayName).toEqual('Platform');
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts
index 55177aaac..ff0a525b5 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts
@@ -15,7 +15,6 @@ import {AppState} from "../../../../store/reducers";
import {FormGroup} from "@angular/forms";
import {DropdownFormControl} from "../../../../models/formControlModels/dropdownFormControl.model";
import {FormControlType} from "../../../../models/formControlModels/formControlTypes.enum";
-import {InputFormControl} from "../../../../models/formControlModels/inputFormControl.model";
import {Observable, of} from "rxjs";
import {SelectOption} from "../../../../models/selectOption";
import * as _ from 'lodash';
@@ -78,6 +77,7 @@ export class VnfControlGenerator {
const vnfInstance = this.getVnfInstance(serviceId, vnfStoreKey);
const vnfModel = new VNFModel(this.store.getState().service.serviceHierarchy[serviceId].vnfs[vnfName]);
let result: FormControlModel[] = [];
+ const flags = this.store.getState().global.flags;
if (!_.isNil(vnfModel)) {
result.push(this.getInstanceName(vnfInstance, serviceId, vnfName, vnfModel.isEcompGeneratedNaming));
@@ -85,7 +85,7 @@ export class VnfControlGenerator {
result.push(this.getLcpRegionControl(serviceId, vnfInstance, result));
result.push(this._basicControlGenerator.getLegacyRegion(vnfInstance));
result.push(this.getTenantControl(serviceId, vnfInstance, result));
- result.push(this.getPlatformControl(vnfInstance, result));
+ result.push(this.getPlatformMultiselectControl(vnfInstance, result, flags['FLAG_2002_VNF_PLATFORM_MULTI_SELECT']));
result.push(this.getLineOfBusinessControl(vnfInstance, result));
}
return result;
@@ -109,7 +109,7 @@ export class VnfControlGenerator {
result.push(this.getLcpRegionControl(serviceId, vnfInstance, result));
result.push(this._basicControlGenerator.getLegacyRegion(vnfInstance));
result.push(this.getTenantControl(serviceId, vnfInstance, result));
- result.push(this.getPlatformControl(vnfInstance, result, flags['FLAG_2002_VNF_PLATFORM_MULTI_SELECT']));
+ result.push(this.getPlatformMultiselectControl(vnfInstance, result, flags['FLAG_2002_VNF_PLATFORM_MULTI_SELECT']));
result.push(this.getLineOfBusinessControl(vnfInstance, result));
result.push(this.getRollbackOnFailureControl(vnfInstance, result));
}
@@ -144,25 +144,7 @@ export class VnfControlGenerator {
- getPlatformDropdownControl = (instance: any, controls: FormControlModel[]) : DropdownFormControl => {
- return new DropdownFormControl({
- type: FormControlType.DROPDOWN ,
- controlName: 'platformName',
- displayName: 'Platform',
- dataTestId: 'platform',
- selectedFieldName : null ,
- ngValue : null,
- placeHolder: 'Select Platform',
- isDisabled: false,
- name: "platform",
- value: instance ? instance.platformName : null,
- validations: [new ValidatorModel(ValidatorOptions.required, 'is required')],
- onInitSelectedField: ['platformList'],
- onInit: this._basicControlGenerator.getSubscribeInitResult.bind(null, this._aaiService.getCategoryParameters),
- });
- };
-
- getPlatformMultiselectControl = (instance: any, controls: FormControlModel[]) : MultiselectFormControl => {
+ getPlatformMultiselectControl = (instance: any, controls: FormControlModel[], isMultiSelected: boolean) : MultiselectFormControl => {
return new MultiselectFormControl({
type: FormControlType.MULTI_SELECT ,
controlName: 'platformName',
@@ -174,6 +156,7 @@ export class VnfControlGenerator {
isDisabled: false,
name: "platform",
value: instance ? instance.platformName : '',
+ limitSelection : isMultiSelected ? 1000 : 1,
validations: [new ValidatorModel(ValidatorOptions.required, 'is required')],
onInitSelectedField: ['platformList'],
onInit: this._basicControlGenerator.getSubscribeInitResult.bind(null, this._aaiService.getCategoryParameters),
@@ -189,14 +172,6 @@ export class VnfControlGenerator {
});
};
- getPlatformControl = (instance: any, controls: FormControlModel[], isMultiSelect?: boolean): MultiselectFormControl | DropdownFormControl => {
- const shouldGenerateDropdown = isMultiSelect === undefined || isMultiSelect === false;
- if(shouldGenerateDropdown){
- return this.getPlatformDropdownControl(instance, controls);
- }
- return this.getPlatformMultiselectControl(instance, controls);
- };
-
getTenantControl = (serviceId: string, instance: any, controls: FormControlModel[]): DropdownFormControl => {
const service = this.store.getState().service.serviceInstance[serviceId];
const globalCustomerId: string = service.globalSubscriberId;