allow LOB multi-selection for network - add FF 75/103575/4
authorEinat Vinouze <einat.vinouze@intl.att.com>
Thu, 12 Mar 2020 08:46:51 +0000 (10:46 +0200)
committerEinat Vinouze <einat.vinouze@intl.att.com>
Mon, 16 Mar 2020 07:55:42 +0000 (09:55 +0200)
Issue-ID: VID-788
Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Change-Id: I5358252a336730697bca3486c461f23354c823c0
Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
features.properties.md
vid-app-common/src/main/java/org/onap/vid/properties/Features.java
vid-automation/src/main/java/vid/automation/test/infra/Features.java
vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts

index 23d9282..dedb0e3 100644 (file)
   
 * 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
index e525719..35f18aa 100644 (file)
@@ -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,
 
     ;
 
index f006586..361ccd7 100644 (file)
@@ -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,
 
     ;
 
index c41c6c2..97c5516 100644 (file)
@@ -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(','));
       },