From 1c55c3023fb2d4108d17ae02577e74665dcae9ff Mon Sep 17 00:00:00 2001 From: Einat Vinouze Date: Thu, 12 Mar 2020 10:46:51 +0200 Subject: [PATCH] allow LOB multi-selection for network - add FF Issue-ID: VID-788 Signed-off-by: Einat Vinouze Change-Id: I5358252a336730697bca3486c461f23354c823c0 Signed-off-by: Einat Vinouze --- features.properties.md | 4 ++ .../java/org/onap/vid/properties/Features.java | 1 + .../java/vid/automation/test/infra/Features.java | 1 + .../sharedControlles/shared.controllers.service.ts | 46 +++++++++++++++++----- 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/features.properties.md b/features.properties.md index 23d92829e..dedb0e371 100644 --- a/features.properties.md +++ b/features.properties.md @@ -225,6 +225,10 @@ * FLAG_2006_NETWORK_PLATFORM_MULTI_SELECT When flag is true the platform will appear as a multi select field, if false the platform will be dropdown list. + +* FLAG_2006_NETWORK_LOB_MULTI_SELECT + When flag is true the LOB will appear as a multi select field, if false the platform will be dropdown list. + * FLAG_EXP_USE_FORMAT_PARAMETER_FOR_CM_DASHBOARD diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java index e52571906..35f18aafe 100644 --- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java +++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java @@ -91,6 +91,7 @@ public enum Features implements Feature { FLAG_EXP_TOPOLOGY_TREE_VFMODULE_NAMES_FROM_OTHER_TOSCA_VERSIONS, FLAG_2006_NETWORK_PLATFORM_MULTI_SELECT, FLAG_EXP_USE_FORMAT_PARAMETER_FOR_CM_DASHBOARD, + FLAG_2006_NETWORK_LOB_MULTI_SELECT, ; diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Features.java b/vid-automation/src/main/java/vid/automation/test/infra/Features.java index f0065869f..361ccd70e 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Features.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Features.java @@ -62,6 +62,7 @@ public enum Features implements Feature { FLAG_2006_LIMIT_OWNING_ENTITY_SELECTION_BY_ROLES, FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF, FLAG_2006_NETWORK_PLATFORM_MULTI_SELECT, + FLAG_2006_NETWORK_LOB_MULTI_SELECT, ; 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 c41c6c282..97c5516db 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 @@ -48,7 +48,7 @@ export class SharedControllersService { return this.getLineOfBusinessControlInternal(changeLcpRegionOptionsOnChange, instance); }; - private getLineOfBusinessControlInternal = (onChange: Function, instance?: any): DropdownFormControl => { + private getLineOfBusinessControlInternal = (onChange: Function, instance?: any): DropdownFormControl => { return new DropdownFormControl({ type: FormControlType.DROPDOWN, controlName: 'lineOfBusiness', @@ -288,23 +288,51 @@ export class SharedControllersService { } getPlatformMultiselectControl = (instance: any, controls: FormControlModel[], isMultiSelected: boolean) : MultiselectFormControl => { + return this.getMultiSelectFormControl( + 'platformName', + 'Platform', + 'multi-selectPlatform', + 'Select Platform', + "platform", + instance, + instance ? instance.platformName : null, + isMultiSelected, + 'platformList' + ); + }; + + getLobMultiselectControl = (instance: any, controls: FormControlModel[], isMultiSelected: boolean) : MultiselectFormControl => { + return this.getMultiSelectFormControl( + 'lineOfBusiness', + 'Line of business', + 'multi-lineOfBusiness', + 'Select Line Of Business', + "lineOfBusiness", + instance, + instance ? instance.lineOfBusiness : null, + isMultiSelected, + 'lineOfBusinessList'); + }; + + private getMultiSelectFormControl(controlName: string, displayName: string, dataTestId: string, placeholder: string, + name: string, instance: any, defaultValue, isMultiSelected: boolean, catagoryParamResponseFieldName: string) { return new MultiselectFormControl({ type: FormControlType.MULTI_SELECT, - controlName: 'platformName', - displayName: 'Platform', - dataTestId: 'multi-selectPlatform', + controlName, + displayName, + dataTestId, selectedFieldName: 'name', ngValue: 'name', - placeHolder: 'Select Platform', + placeHolder: placeholder, isDisabled: false, - name: "platform", - value: instance ? instance.platformName : '', + name: name, + value: instance ? defaultValue : '', limitSelection: isMultiSelected ? 1000 : 1, validations: [new ValidatorModel(ValidatorOptions.required, 'is required')], - onInitSelectedField: ['platformList'], + onInitSelectedField: [catagoryParamResponseFieldName], onInit: this._basicControlGenerator.getSubscribeInitResult.bind(null, this._aaiService.getCategoryParameters), onChange: (param: MultiSelectItem[], form: FormGroup) => { - form.controls['platformName'].setValue(param.map((multiSelectItem: MultiSelectItem) => { + form.controls[controlName].setValue(param.map((multiSelectItem: MultiSelectItem) => { return multiSelectItem.itemName }).join(',')); }, -- 2.16.6