diff options
author | 2019-12-05 17:04:45 +0200 | |
---|---|---|
committer | 2019-12-08 14:20:44 +0200 | |
commit | 77dd486269bb11f1e206114b87033a7dcc58c012 (patch) | |
tree | 8df5710c6f184a2f58837b48df94009f2db39248 /vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts | |
parent | ad530ef6478ed2c8d3d153738ed735130b4019e7 (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/formControlsServices/vnfGenerator/vnf.control.generator.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts | 35 |
1 files changed, 5 insertions, 30 deletions
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; |