aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master')
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts29
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts143
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts4
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts28
-rw-r--r--vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts39
-rw-r--r--vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts2
6 files changed, 31 insertions, 214 deletions
diff --git a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts
index 4fa3ae600..8f5341c26 100644
--- a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts
@@ -215,35 +215,6 @@ describe('A la carte', function () {
});
});
- it(`Add ALaCarte vnf where FLAG_2006_LCP_REGIONS_BY_LINE_OF_BUSINESS`, () => {
- cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
- cy.setTestApiParamToGR();
- res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
- res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
- res.global['flags'] = {'FLAG_2006_LCP_REGIONS_BY_LINE_OF_BUSINESS': true};
- cy.setReduxState(<any>res);
- cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
-
- cy.getElementByDataTestsId('node-2017-488_PASQUALE-vPE 0-add-btn').click({force: true}).then(() => {
- cy.selectDropdownOptionByText('productFamily', 'Emanuel');
- cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1');
- cy.selectDropdownOptionByText('lcpRegion', 'foo-name');
- cy.selectDropdownOptionByText('tenant', 'tenantID');
- cy.selectPlatformValue(`xxx1`);
- cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
- const vnfMenuBtnDataTestId = 'node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0-menu-btn';
-
- cy.getElementByDataTestsId(vnfMenuBtnDataTestId).click({force: true}).then(() => {
- cy.getElementByDataTestsId('context-menu-edit').click({force: true})
- .getElementByDataTestsId("lineOfBusiness").should('contain', 'zzz1')
- .getElementByDataTestsId("lcpRegion").should('contain', 'foo-name')
- .getElementByDataTestsId("tenant").should('contain', 'tenantName')
- });
- });
- })
- });
- });
-
it(`Add ALaCarte VfModule Without LcpRegion Tenant Id And Legacy`, () => {
addAlacarteVfmoduleByFlag(true, 'redux-a-la-carte-no-lcp-tenant.json');
});
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 d82ba36a9..d589efa14 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
@@ -16,8 +16,6 @@ import {Constants} from "../../../../utils/constants";
import {CheckboxFormControl} from "../../../../models/formControlModels/checkboxFormControl.model";
import {InputFormControl} from "../../../../models/formControlModels/inputFormControl.model";
import {NodeModel} from "../../../../models/nodeModel";
-import {LcpRegion} from "../../../../models/lcpRegion";
-import {Tenant} from "../../../../models/tenant";
import {MultiselectFormControl} from "../../../../models/formControlModels/multiselectFormControl.model";
import {MultiSelectItem} from "../../../formControls/component/multiselect/multiselect.model";
@@ -29,30 +27,6 @@ export class SharedControllersService {
getLineOfBusinessControl = (instance?: any): DropdownFormControl => {
- return this.getLineOfBusinessControlInternal(undefined, instance);
- };
-
- getMultiSelectLineOfBusinessControl = (instance: any, isMultiSelected: boolean): MultiselectFormControl => {
- return this.getLobMultiselectControl(instance, isMultiSelected);
- };
-
- getLineOfBusinessByOwningEntityControl = (instance?: any, serviceId?: string, controls?: FormControlModel[]): DropdownFormControl => {
- const service = this._store.getState().service.serviceInstance[serviceId];
- const owningEntityName: string = service.owningEntityName;
-
- const changeLcpRegionOptionsOnChange = (lineOfBusinessNameParam: string, form: FormGroup) => {
- form.controls['lcpCloudRegionId'].enable();
- form.controls['lcpCloudRegionId'].reset();
- this._basicControlGenerator.getSubscribeInitResult(
- this._aaiService.getLcpRegionsByOwningEntityAndLineOfBusiness.bind(this, owningEntityName, lineOfBusinessNameParam),
- controls.find(item => item.controlName === 'lcpCloudRegionId') as DropdownFormControl, form
- ).subscribe()
- };
-
- return this.getLineOfBusinessControlInternal(changeLcpRegionOptionsOnChange, instance);
- };
-
- private getLineOfBusinessControlInternal = (onChange: Function, instance?: any): DropdownFormControl => {
return new DropdownFormControl({
type: FormControlType.DROPDOWN,
controlName: 'lineOfBusiness',
@@ -64,29 +38,18 @@ export class SharedControllersService {
value: instance ? instance.lineOfBusiness : null,
validations: [new ValidatorModel(ValidatorOptions.required, 'is required')],
onInitSelectedField: ['lineOfBusinessList'],
- onChange,
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;
const serviceType: string = service.subscriptionServiceType;
-
- const onInit = instance
- ? this._basicControlGenerator.getSubscribeInitResult.bind(
- this._aaiService,
- this._aaiService.getLcpRegionsAndTenants.bind(this, globalCustomerId, serviceType))
- : () => {};
- return this.getTenantControlInternal(onInit, instance);
- };
-
- getTenantByLcpRegionControl = (serviceId: string, instance?: any): DropdownFormControl => {
- return this.getTenantControlInternal(() => {}, instance);
- };
-
- private getTenantControlInternal = (onInit: Function, instance?: any): DropdownFormControl => {
return new DropdownFormControl({
type: FormControlType.DROPDOWN,
controlName: 'tenantId',
@@ -98,7 +61,10 @@ export class SharedControllersService {
onInitSelectedField: instance ? ['lcpRegionsTenantsMap', instance.lcpCloudRegionId] : null,
value: instance ? instance.tenantId : null,
validations: [new ValidatorModel(ValidatorOptions.required, 'is required')],
- onInit,
+ onInit: instance ? this._basicControlGenerator.getSubscribeInitResult.bind(
+ this._aaiService,
+ this._aaiService.getLcpRegionsAndTenants.bind(this, globalCustomerId, serviceType)) : () => {
+ }
})
};
@@ -133,70 +99,6 @@ export class SharedControllersService {
const service = this._store.getState().service.serviceInstance[serviceId];
const globalCustomerId: string = service.globalSubscriberId;
const serviceType: string = service.subscriptionServiceType;
-
- const onInit = this._basicControlGenerator.getSubscribeInitResult.bind(
- this._aaiService,
- this._aaiService.getLcpRegionsAndTenants.bind(this, globalCustomerId, serviceType)
- );
-
- const changeTenantsOptionsByServiceTypeOnChange = (
- (globalCustomerId, serviceType, lcpCloudRegionIdParam) => {
- if (!_.isNil(globalCustomerId) && !_.isNil(serviceType)) {
- this._basicControlGenerator.getSubscribeResult.bind(this,
- this._aaiService.getLcpRegionsAndTenants(globalCustomerId, serviceType)
- .subscribe(res => this.setTenantsOptions(controls, res.lcpRegionsTenantsMap[lcpCloudRegionIdParam])));
- }
-
- }
- ).bind(this, globalCustomerId, serviceType);
-
- return this.getLcpRegionControlInternal(instance, controls,
- false, onInit, ['lcpRegionList'], changeTenantsOptionsByServiceTypeOnChange)
- };
-
- getLcpRegionByLineOfBusinessControl = (serviceId: string, instance: any, controls: FormControlModel[]): DropdownFormControl => {
- const service = this._store.getState().service.serviceInstance[serviceId];
- const owningEntityName: string = service.owningEntityName;
-
- const changeTenantsOptions = (controls: FormControlModel[], cloudRegionId, lcpRegionList: LcpRegion[]) => {
- const lcpRegionOption = (_.isNil(lcpRegionList) || _.isNil(cloudRegionId))
- ? null : lcpRegionList.find(({id}) => id === cloudRegionId);
-
- if (!_.isNil(lcpRegionOption)) {
- this._aaiService.getTenantsByCloudOwnerAndCloudRegionId(lcpRegionOption.cloudOwner, lcpRegionOption.id)
- .subscribe(res => this.setTenantsOptions(controls, res));
- }
- };
-
- const lcpRegionOptionsList = (controls: FormControlModel[]): LcpRegion[] => {
- const lcpCloudRegionIdControl = _.isNil(controls)
- ? null : controls.find(({controlName}) => controlName === 'lcpCloudRegionId');
-
- return _.isNil(lcpCloudRegionIdControl) ? null : lcpCloudRegionIdControl['options$'];
- };
-
- const loadLcpRegionOptionsOnInit = (_.isNil(instance) || _.isNil(instance.lineOfBusiness))
- ? () => {}
- : this._basicControlGenerator.getSubscribeInitResult.bind(
- this, () => {
- return this._aaiService.getLcpRegionsByOwningEntityAndLineOfBusiness(owningEntityName, instance.lineOfBusiness)
- .do(res => changeTenantsOptions(controls, instance.lcpCloudRegionId, res));
- }
- );
-
- const changeTenantsOptionsByCloudRegionIdOnChange = (
- (controls, lcpCloudRegionIdParam) => changeTenantsOptions(controls, lcpCloudRegionIdParam, lcpRegionOptionsList(controls))
- ).bind(this, controls);
-
- return this.getLcpRegionControlInternal(instance, controls,
- _.isNil(instance) || _.isNil(instance.lineOfBusiness),
- loadLcpRegionOptionsOnInit, null, changeTenantsOptionsByCloudRegionIdOnChange
- )
- };
-
- private getLcpRegionControlInternal = (instance: any, controls: FormControlModel[], isDisabled: boolean,
- onInit: Function, onInitSelectedField: string[], changeTenantsOptionsOnChange: Function
- ): DropdownFormControl => {
return new DropdownFormControl({
type: FormControlType.DROPDOWN,
controlName: 'lcpCloudRegionId',
@@ -204,19 +106,26 @@ export class SharedControllersService {
dataTestId: 'lcpRegion',
placeHolder: 'Select LCP Region',
name: "lcpRegion",
- isDisabled,
+ isDisabled: false,
value: instance ? instance.lcpCloudRegionId : null,
validations: [new ValidatorModel(ValidatorOptions.required, 'is required')],
- onInitSelectedField,
- onInit,
-
- onChange: (lcpCloudRegionIdParam: string, form: FormGroup) => {
+ onInitSelectedField: ['lcpRegionList'],
+ onInit: this._basicControlGenerator.getSubscribeInitResult.bind(
+ this._aaiService,
+ this._aaiService.getLcpRegionsAndTenants.bind(this, globalCustomerId, serviceType)),
+ onChange: (param: string, form: FormGroup) => {
form.controls['tenantId'].enable();
form.controls['tenantId'].reset();
+ if (!_.isNil(globalCustomerId) && !_.isNil(serviceType)) {
+ this._basicControlGenerator.getSubscribeResult.bind(this, this._aaiService.getLcpRegionsAndTenants(globalCustomerId, serviceType).subscribe(res => {
+ controls.find(item => item.controlName === 'tenantId')['options$'] = res.lcpRegionsTenantsMap[param];
+ if (res.lcpRegionsTenantsMap[param]) {
+ controls.find(item => item.controlName === 'tenantId')['hasEmptyOptions'] = res.lcpRegionsTenantsMap[param].length === 0;
+ }
+ }));
+ }
- changeTenantsOptionsOnChange(lcpCloudRegionIdParam);
-
- if (Constants.LegacyRegion.MEGA_REGION.indexOf(lcpCloudRegionIdParam) !== -1) {
+ if (Constants.LegacyRegion.MEGA_REGION.indexOf(param) !== -1) {
form.controls['legacyRegion'].enable();
controls.find(item => item.controlName === 'legacyRegion').isVisible = true;
@@ -230,11 +139,7 @@ export class SharedControllersService {
})
};
- private setTenantsOptions = (controls: FormControlModel[], tenants: Tenant[]) => {
- const tenantsControl = controls.find(item => item.controlName === 'tenantId');
- tenantsControl['options$'] = tenants;
- tenantsControl['hasEmptyOptions'] = tenants && tenants.length === 0;
- };
+
getSDNCControl = (instance: any, checkedByDefault: boolean, extraContents? : object[]): FormControlModel => {
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 08afb417e..a7fce1def 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
@@ -907,9 +907,7 @@ class MockAppStore<T> {
}
}
-class MockFeatureFlagsService {
- getFlagState = () => false;
-}
+class MockFeatureFlagsService {}
describe('VNF Control Generator', () => {
let injector;
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 4b325b286..488df9a2f 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
@@ -10,7 +10,6 @@ import {VNFModel} from "../../../../models/vnfModel";
import {AppState} from "../../../../store/reducers";
import * as _ from 'lodash';
import {SharedControllersService} from "../sharedControlles/shared.controllers.service";
-import {FeatureFlagsService, Features} from "../../../../services/featureFlag/feature-flags.service";
@Injectable()
export class VnfControlGenerator {
@@ -18,7 +17,6 @@ export class VnfControlGenerator {
constructor(private genericFormService: GenericFormService,
private _basicControlGenerator: ControlGeneratorUtil,
private _sharedControllersService : SharedControllersService,
- private _featureFlagsService: FeatureFlagsService,
private store: NgRedux<AppState>,
private http: HttpClient,
private _aaiService: AaiService,
@@ -70,28 +68,14 @@ export class VnfControlGenerator {
const vnfModel = new VNFModel(this.store.getState().service.serviceHierarchy[serviceId].vnfs[vnfName]);
if (!_.isNil(vnfModel)) {
- const isMultiSelected =
- this._featureFlagsService.getFlagState(Features.FLAG_2002_VNF_PLATFORM_MULTI_SELECT);
- const lcpRegionsByLineOFBusiness =
- this._featureFlagsService.getFlagState(Features.FLAG_2006_LCP_REGIONS_BY_LINE_OF_BUSINESS);
-
+ const flags = this.store.getState().global.flags;
result.push(this.getInstanceName(vnfInstance, serviceId, vnfName, vnfModel.isEcompGeneratedNaming));
result.push(this._sharedControllersService.getProductFamilyControl(vnfInstance, result, true));
-
- if (lcpRegionsByLineOFBusiness) {
- result.push(this._sharedControllersService.getLineOfBusinessByOwningEntityControl(vnfInstance, serviceId, result));
- result.push(this._sharedControllersService.getLcpRegionByLineOfBusinessControl(serviceId, vnfInstance, result));
- result.push(this._sharedControllersService.getLegacyRegion(vnfInstance));
- result.push(this._sharedControllersService.getTenantByLcpRegionControl(serviceId, vnfInstance));
- result.push(this._sharedControllersService.getPlatformMultiselectControl(vnfInstance, result, isMultiSelected));
- } else {
- 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, isMultiSelected));
- result.push(this._sharedControllersService.getLineOfBusinessControl(vnfInstance));
- }
-
+ 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.getRollbackOnFailureControl(vnfInstance));
}
return result;
diff --git a/vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts b/vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts
index 603ba814d..adb7017be 100644
--- a/vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts
+++ b/vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts
@@ -228,45 +228,6 @@ export class AaiService {
cloudRegionId+AaiService.formatCloudOwnerTrailer(cloudOwner) : cloudRegionId;
};
-
-
-
-
- getLcpRegionsByOwningEntityAndLineOfBusiness = (owningEntityName, lineOfBusinessName): Observable<LcpRegion[]> => {
- // let pathQuery: string = Constants.Path.AAI_GET_LCP_REGIONS_BY____
- // + "?"
- // + "owningEntityName=" + owningEntityName
- // + "lineOfBusinessName=" + lineOfBusinessName;
-
- return of([
- new LcpRegion("foo-id", "foo-name", true, "foo-cloud-owner"),
- new LcpRegion("foo2-id", "foo2-name", true, "foo2-cloud-owner"),
- ]);
- };
-
-
- getTenantsByCloudOwnerAndCloudRegionId = (cloudOwner, cloudRegionId): Observable<Tenant[]> => {
- // let pathQuery: string = Constants.Path.AAI_GET_TENANTS_BY____
- // + "?"
- // + "cloudOwner=" + cloudOwner
- // + "&cloudRegionId=" + cloudRegionId;
-
- return of([
- new Tenant({
- tenantID: "tenantID", tenantName: "tenantName",
- cloudOwner: "cloudOwner", ['is-permitted']: true,
- }),
- new Tenant({
- tenantID: "tenant2ID", tenantName: "tenant2Name",
- cloudOwner: "cloudOwner", ['is-permitted']: true,
- }),
- ])
- };
-
-
-
-
-
public static formatCloudOwnerTrailer(cloudOwner: string):string {
return " ("+ cloudOwner.trim().toLowerCase().replace(/^[^-]*-/, "").toUpperCase() + ")";
}
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 2c30d9385..5842662fb 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
@@ -13,14 +13,12 @@ export enum Features {
FLAG_FLASH_REPLACE_VF_MODULE ='FLAG_FLASH_REPLACE_VF_MODULE',
FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT ='FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT',
FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS ='FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS',
- FLAG_2002_VNF_PLATFORM_MULTI_SELECT= 'FLAG_2002_VNF_PLATFORM_MULTI_SELECT',
FLAG_2004_INSTANTIATION_STATUS_FILTER ='FLAG_2004_INSTANTIATION_STATUS_FILTER',
FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE = 'FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE',
FLAG_2006_VFM_SDNC_PRELOAD_FILES = 'FLAG_2006_VFM_SDNC_PRELOAD_FILES',
FLAG_MORE_AUDIT_INFO_LINK_ON_AUDIT_INFO = 'FLAG_MORE_AUDIT_INFO_LINK_ON_AUDIT_INFO',
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_LCP_REGIONS_BY_LINE_OF_BUSINESS = 'FLAG_2006_LCP_REGIONS_BY_LINE_OF_BUSINESS',
FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF = 'FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF',
}