diff options
author | 2020-03-26 17:22:01 +0200 | |
---|---|---|
committer | 2020-04-01 11:45:20 +0300 | |
commit | fae75696a03ab5b45bf2ddb329344ab52b2265c5 (patch) | |
tree | 0b75b1ddc3a19910e5b6fae51ef689a6ff5b426e /vid-webpack-master/src/app/shared | |
parent | 51abe8acdd924bb3ad260966723210b6d5b8e870 (diff) |
allow LOB multi-selection for vnf - fix cypress
Issue-ID: VID-785
Change-Id: I3a11bad5b6da532b23049ce09ea439849143e941
Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared')
5 files changed, 18 insertions, 36 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/networkGenerator/network.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/networkGenerator/network.control.generator.ts index fe6a2580d..08d689d77 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/networkGenerator/network.control.generator.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/networkGenerator/network.control.generator.ts @@ -64,7 +64,7 @@ export class NetworkControlGenerator { result.push(this._sharedControllersService.getLegacyRegion(networkInstance)); result.push(this._sharedControllersService.getTenantControl(serviceId, networkInstance)); result.push(this._sharedControllersService.getPlatformMultiselectControl(networkInstance, result, flags['FLAG_2006_NETWORK_PLATFORM_MULTI_SELECT'])); - result.push(this._sharedControllersService.getMultiSelectLineOfBusinessControl(networkInstance, flags['FLAG_2006_NETWORK_LOB_MULTI_SELECT'])); + result.push(this._sharedControllersService.getLobMultiselectControl(networkInstance, flags['FLAG_2006_NETWORK_LOB_MULTI_SELECT'])); } return result; @@ -89,7 +89,7 @@ export class NetworkControlGenerator { result.push(this._sharedControllersService.getLegacyRegion(networkInstance)); result.push(this._sharedControllersService.getTenantControl(serviceId, networkInstance)); result.push(this._sharedControllersService.getPlatformMultiselectControl(networkInstance, result, flags['FLAG_2006_NETWORK_PLATFORM_MULTI_SELECT'])); - result.push(this._sharedControllersService.getMultiSelectLineOfBusinessControl(networkInstance, flags['FLAG_2006_NETWORK_LOB_MULTI_SELECT'])); + result.push(this._sharedControllersService.getLobMultiselectControl(networkInstance, flags['FLAG_2006_NETWORK_LOB_MULTI_SELECT'])); result.push(this._sharedControllersService.getRollbackOnFailureControl(networkInstance)); } return result; diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.spec.ts index b141a1e79..6ee318644 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.spec.ts @@ -9,6 +9,7 @@ import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flag import {DropdownFormControl} from "../../../../models/formControlModels/dropdownFormControl.model"; import {FormControlModel, ValidatorOptions} from "../../../../models/formControlModels/formControl.model"; import {ControlGeneratorUtil} from "../control.generator.util.service"; +import {MultiselectFormControl} from "../../../../models/formControlModels/multiselectFormControl.model"; import each from "jest-each"; @@ -38,20 +39,15 @@ describe('Shared Controllers Service', () => { })().then(done).catch(done.fail)); - - - - test('getLineOfBusinessControl', ()=> { - const lineOfBusinessControl :DropdownFormControl = service.getLineOfBusinessControl(); - expect(lineOfBusinessControl.name).toEqual('lineOfBusiness'); + const lineOfBusinessControl :MultiselectFormControl = service.getLobMultiselectControl(undefined, true); expect(lineOfBusinessControl.controlName).toEqual('lineOfBusiness'); expect(lineOfBusinessControl.displayName).toEqual('Line of business'); - expect(lineOfBusinessControl.dataTestId).toEqual('lineOfBusiness'); + expect(lineOfBusinessControl.dataTestId).toEqual('multi-lineOfBusiness'); expect(lineOfBusinessControl.placeHolder).toEqual('Select Line Of Business'); expect(lineOfBusinessControl.onInitSelectedField).toEqual(['lineOfBusinessList']); expect(lineOfBusinessControl.onInit).toBeDefined(); - expect(lineOfBusinessControl.value).toBeNull(); + expect(lineOfBusinessControl.value).toBe(""); expect(lineOfBusinessControl.validations.find((validation)=> validation.validatorName === ValidatorOptions.required)).toBeDefined(); expect(lineOfBusinessControl.isDisabled).toBeFalsy(); }); diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts index d589efa14..b10ed9a75 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts @@ -25,27 +25,6 @@ export class SharedControllersService { private _aaiService : AaiService, private _basicControlGenerator : ControlGeneratorUtil){} - - getLineOfBusinessControl = (instance?: any): DropdownFormControl => { - return new DropdownFormControl({ - type: FormControlType.DROPDOWN, - controlName: 'lineOfBusiness', - displayName: 'Line of business', - dataTestId: 'lineOfBusiness', - placeHolder: 'Select Line Of Business', - isDisabled: false, - name: "lineOfBusiness", - value: instance ? instance.lineOfBusiness : null, - validations: [new ValidatorModel(ValidatorOptions.required, 'is required')], - onInitSelectedField: ['lineOfBusinessList'], - onInit: this._basicControlGenerator.getSubscribeInitResult.bind(null, this._aaiService.getCategoryParameters) - }) - }; - - getMultiSelectLineOfBusinessControl = (instance: any, isMultiSelected: boolean): MultiselectFormControl => { - return this.getLobMultiselectControl(instance, isMultiSelected); - }; - getTenantControl = (serviceId: string, instance?: any): DropdownFormControl => { const service = this._store.getState().service.serviceInstance[serviceId]; const globalCustomerId: string = service.globalSubscriberId; 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 488df9a2f..b1f72a5f8 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 @@ -45,13 +45,16 @@ export class VnfControlGenerator { const flags = this.store.getState().global.flags; if (!_.isNil(vnfModel)) { + const isPlatformMultiSelected = flags['FLAG_2002_VNF_PLATFORM_MULTI_SELECT']; + const isLobMultiSelected = flags['FLAG_2006_VNF_LOB_MULTI_SELECT']; + result.push(this.getInstanceName(vnfInstance, serviceId, vnfName, vnfModel.isEcompGeneratedNaming)); result.push(this._sharedControllersService.getProductFamilyControl(vnfInstance, result, true)); result.push(this._sharedControllersService.getLcpRegionControl(serviceId, vnfInstance, result)); result.push(this._sharedControllersService.getLegacyRegion(vnfInstance)); result.push(this._sharedControllersService.getTenantControl(serviceId, vnfInstance)); - result.push(this._sharedControllersService.getPlatformMultiselectControl(vnfInstance, result, flags['FLAG_2002_VNF_PLATFORM_MULTI_SELECT'])); - result.push(this._sharedControllersService.getLineOfBusinessControl(vnfInstance)); + result.push(this._sharedControllersService.getPlatformMultiselectControl(vnfInstance, result, isPlatformMultiSelected)); + result.push(this._sharedControllersService.getLobMultiselectControl(vnfInstance, isLobMultiSelected)); } return result; } @@ -66,16 +69,18 @@ export class VnfControlGenerator { let result: FormControlModel[] = []; const vnfInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store,this.getVnfInstance(serviceId, vnfStoreKey)); const vnfModel = new VNFModel(this.store.getState().service.serviceHierarchy[serviceId].vnfs[vnfName]); + const flags = this.store.getState().global.flags; if (!_.isNil(vnfModel)) { - const flags = this.store.getState().global.flags; + const isPlatformMultiSelected = flags['FLAG_2002_VNF_PLATFORM_MULTI_SELECT']; + const isLobMultiSelected = flags['FLAG_2006_VNF_LOB_MULTI_SELECT']; result.push(this.getInstanceName(vnfInstance, serviceId, vnfName, vnfModel.isEcompGeneratedNaming)); result.push(this._sharedControllersService.getProductFamilyControl(vnfInstance, result, true)); result.push(this._sharedControllersService.getLcpRegionControl(serviceId, vnfInstance, result)); result.push(this._sharedControllersService.getLegacyRegion(vnfInstance)); result.push(this._sharedControllersService.getTenantControl(serviceId, vnfInstance)); - result.push(this._sharedControllersService.getPlatformMultiselectControl(vnfInstance, result, flags['FLAG_2002_VNF_PLATFORM_MULTI_SELECT'])); - result.push(this._sharedControllersService.getLineOfBusinessControl(vnfInstance)); + result.push(this._sharedControllersService.getPlatformMultiselectControl(vnfInstance, result, isPlatformMultiSelected)); + result.push(this._sharedControllersService.getLobMultiselectControl(vnfInstance,isLobMultiSelected)); result.push(this._sharedControllersService.getRollbackOnFailureControl(vnfInstance)); } return result; diff --git a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts index 5842662fb..78a2b1e67 100644 --- a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts +++ b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts @@ -20,6 +20,8 @@ export enum Features { FLAG_2004_INSTANTIATION_TEMPLATES_POPUP = 'FLAG_2004_INSTANTIATION_TEMPLATES_POPUP', FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY= 'FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY', FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF = 'FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF', + FLAG_2006_VNF_LOB_MULTI_SELECT= 'FLAG_2006_VNF_LOB_MULTI_SELECT', + } @Injectable() |