summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/genericFormPopup
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2019-12-17 09:33:35 +0000
committerGerrit Code Review <gerrit@onap.org>2019-12-17 09:33:35 +0000
commit5e3debb8feabc8bf0631344bacfff837629240e4 (patch)
tree61362b7c5719e3c9d51b0cde5604b4b629b94f71 /vid-webpack-master/src/app/shared/components/genericFormPopup
parent5f8ce4adff724009dad903887cd320a0095c1437 (diff)
parent8d17bc384337849ffdf4a8369834c4480c9c5d93 (diff)
Merge "Do not show retain VGs checkbox in VFM Upgrade modal + tests modifications"
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/genericFormPopup')
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts8
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts (renamed from vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service.spec.ts)8
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts (renamed from vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service.ts)3
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts12
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts41
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service.spec.ts4
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service.spec.ts4
7 files changed, 53 insertions, 27 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts
index 63c980cd5..514b9bfef 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts
@@ -17,7 +17,7 @@ import {UUIDData} from "./generic-form-popup.component";
import {ITreeNode} from "angular-tree-component/dist/defs/api";
import {NetworkPopupService} from "./genericFormServices/network/network.popup.service";
import {NetworkControlGenerator} from "../genericForm/formControlsServices/networkGenerator/network.control.generator";
-import {VfModulePopuopService} from "./genericFormServices/vfModule/vfModule.popuop.service";
+import {VfModulePopupService} from "./genericFormServices/vfModule/vfModule.popup.service";
import {VfModuleControlGenerator} from "../genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator";
import {FeatureFlagsService} from "../../services/featureFlag/feature-flags.service";
import {VfModuleUpgradePopupService} from "./genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service";
@@ -946,7 +946,7 @@ describe('Generic Form popup Service', () => {
let form : FormGroup;
let fb : FormBuilder;
let netwokPopupService : NetworkPopupService;
- let vfModulePopupService : VfModulePopuopService;
+ let vfModulePopupService : VfModulePopupService;
let servicePopupService : ServicePopupService;
let _aaiService : AaiService;
let _activatedRoute : ActivatedRoute;
@@ -967,7 +967,7 @@ describe('Generic Form popup Service', () => {
AaiService,
NetworkPopupService,
NetworkControlGenerator,
- VfModulePopuopService,
+ VfModulePopupService,
VfModuleUpgradePopupService,
VfModuleControlGenerator,
{provide:FeatureFlagsService, useClass: MockFeatureFlagsService},
@@ -981,7 +981,7 @@ describe('Generic Form popup Service', () => {
httpMock = injector.get(HttpTestingController);
fb = injector.get(FormBuilder);
netwokPopupService = injector.get(NetworkPopupService);
- vfModulePopupService = injector.get(VfModulePopuopService);
+ vfModulePopupService = injector.get(VfModulePopupService);
servicePopupService = injector.get(ServicePopupService);
_aaiService = injector.get(AaiService);
_activatedRoute = injector.get(ActivatedRoute);
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts
index 6c487102f..935454752 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts
@@ -8,7 +8,7 @@ import {FormBuilder} from "@angular/forms";
import {IframeService} from "../../../../utils/iframe.service";
import {DefaultDataGeneratorService} from "../../../../services/defaultDataServiceGenerator/default.data.generator.service";
import {BasicPopupService} from "../basic.popup.service";
-import {VfModulePopuopService} from "./vfModule.popuop.service";
+import {VfModulePopupService} from "./vfModule.popup.service";
import {VfModuleControlGenerator} from "../../../genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator";
import {SdcUiServices} from "onap-ui-angular";
import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service";
@@ -1972,7 +1972,7 @@ class MockFeatureFlagsService {}
describe('VFModule popup service', () => {
let injector;
- let service: VfModulePopuopService;
+ let service: VfModulePopupService;
let genericFormService: GenericFormService
let defaultDataGeneratorService: DefaultDataGeneratorService;
let fb: FormBuilder;
@@ -1981,7 +1981,7 @@ describe('VFModule popup service', () => {
beforeAll(done => (async () => {
TestBed.configureTestingModule({
providers : [
- VfModulePopuopService,
+ VfModulePopupService,
BasicControlGenerator,
VfModuleControlGenerator,
DefaultDataGeneratorService,
@@ -2000,7 +2000,7 @@ describe('VFModule popup service', () => {
await TestBed.compileComponents();
injector = getTestBed();
- service = injector.get(VfModulePopuopService);
+ service = injector.get(VfModulePopupService);
genericFormService = injector.get(GenericFormService);
defaultDataGeneratorService = injector.get(DefaultDataGeneratorService);
fb = injector.get(FormBuilder);
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts
index 3119cc8f8..6a31bb7ee 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts
@@ -34,7 +34,6 @@ export abstract class VfModulePopupServiceBase {
formValues.modelInfo = new ModelInfo(that.model);
formValues.uuid = formValues.modelInfo.uuid;
formValues.isMissingData = false;
- const vnf = that._store.getState().service.serviceInstance[that.uuidData.serviceId].vnfs[that.uuidData.vnfStoreKey];
if (!that.uuidData.vFModuleStoreKey) {
this._store.dispatch(createVFModuleInstance(formValues, that.uuidData.modelName, that.uuidData.serviceId, 0, that.uuidData.vnfStoreKey));
@@ -154,7 +153,7 @@ export abstract class VfModulePopupServiceBase {
}
@Injectable()
-export class VfModulePopuopService extends VfModulePopupServiceBase implements GenericPopupInterface {
+export class VfModulePopupService extends VfModulePopupServiceBase implements GenericPopupInterface {
constructor(_basicControlGenerator: BasicControlGenerator,
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts
index bbfe8705e..667e79678 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts
@@ -1,7 +1,7 @@
import {Injectable} from "@angular/core";
import {ITreeNode} from "angular-tree-component/dist/defs/api";
import {FormGroup} from "@angular/forms";
-import {VfModulePopupServiceBase} from "../vfModule/vfModule.popuop.service";
+import {VfModulePopupServiceBase} from "../vfModule/vfModule.popup.service";
import {upgradeVFModule} from "../../../../storeUtil/utils/vfModule/vfModule.actions";
import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
import {NgRedux} from "@angular-redux/store";
@@ -16,11 +16,12 @@ import {FormControlModel} from "../../../../models/formControlModels/formControl
import {CheckboxFormControl} from "../../../../models/formControlModels/checkboxFormControl.model";
import {FormControlType} from "../../../../models/formControlModels/formControlTypes.enum";
import {mergeObjectByPathAction} from "../../../../storeUtil/utils/general/general.actions";
+import * as _ from "lodash";
+import {VfModuleInstance} from "../../../../models/vfModuleInstance";
export enum UpgradeFormControlNames {
RETAIN_VOLUME_GROUPS = 'retainVolumeGroups',
RETAIN_ASSIGNMENTS = 'retainAssignments',
- SDN_C_PRE_LOAD = 'sdncPreLoad',
}
@Injectable()
@@ -43,11 +44,12 @@ export class VfModuleUpgradePopupService extends VfModulePopupServiceBase {
getControls(serviceId: string, vnfStoreKey: string, vfModuleStoreKey: string, isUpdateMode: boolean): FormControlModel[] {
let result: FormControlModel[] =[
this.getRetainAssignmentsControl(),
- this.getRetainVolumeGroupsControl(),
this._basicControlGenerator.getSDNCControl(null)
];
-
- const vfModuleInstance = this._vfModuleControlGenerator.getVfModuleInstance(serviceId, vnfStoreKey, this.uuidData, isUpdateMode);
+ const vfModuleInstance :VfModuleInstance = this._vfModuleControlGenerator.getVfModuleInstance(serviceId, vnfStoreKey, this.uuidData, isUpdateMode);
+ if(this._store.getState().service.serviceHierarchy[serviceId].vfModules[this.uuidData['modelName']].volumeGroupAllowed){
+ result.push(this.getRetainVolumeGroupsControl());
+ }
result = this._basicControlGenerator.concatSupplementaryFile(result, vfModuleInstance);
return result;
};
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts
index 7c1cc084a..4003b4dcc 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts
@@ -1,6 +1,10 @@
import {LogService} from "../../../../utils/log/log.service";
import {NgRedux} from "@angular-redux/store";
-import {BasicControlGenerator, SDN_C_PRE_LOAD, SUPPLEMENTARY_FILE} from "../../../genericForm/formControlsServices/basic.control.generator";
+import {
+ BasicControlGenerator,
+ SDN_C_PRE_LOAD,
+ SUPPLEMENTARY_FILE
+} from "../../../genericForm/formControlsServices/basic.control.generator";
import {AaiService} from "../../../../services/aaiService/aai.service";
import {HttpClient} from "@angular/common/http";
import {GenericFormService} from "../../../genericForm/generic-form.service";
@@ -20,6 +24,7 @@ import {GeneralActions} from "../../../../storeUtil/utils/general/general.action
import {VfModuleActions} from "../../../../storeUtil/utils/vfModule/vfModule.actions";
import {ServiceActions} from "../../../../storeUtil/utils/service/service.actions";
import {FormControlModel} from "../../../../models/formControlModels/formControl.model";
+import * as _ from "lodash";
class MockModalService<T> {}
@@ -29,6 +34,15 @@ class MockReduxStore<T> {
getState() {
return {
service: {
+ serviceHierarchy: {
+ serviceId: {
+ vfModules: {
+ vfModuleName: {
+ volumeGroupAllowed: true
+ }
+ }
+ }
+ },
serviceInstance : {
serviceId : {
vnfs : {
@@ -40,7 +54,6 @@ class MockReduxStore<T> {
}}}}}}}}
};
}
-
dispatch() {}
}
@@ -101,19 +114,31 @@ describe('VFModule popup service', () => {
});
}
- function getControlByNameAndCheckValue(controlName: string, expectedValue: any) {
+ function getControlByNameAndCheckValue(controlName: string, expectedValue: any, shouldControllerExist: boolean) {
const controls = service.getControls('serviceId', 'vnfStoreKey', 'vfModuleId', true);
const control = findControlByName(controls, controlName);
- expect(control).toBeDefined();
- expect(control.value).toEqual(expectedValue);
+ if(shouldControllerExist){
+ expect(control).toBeDefined();
+ expect(control.value).toEqual(expectedValue);
+ }
+ else{
+ expect(control).toBeUndefined();
+ }
}
test('get controls should return retainAssignments control with true value', ()=> {
- getControlByNameAndCheckValue(UpgradeFormControlNames.RETAIN_ASSIGNMENTS, true);
+ getControlByNameAndCheckValue(UpgradeFormControlNames.RETAIN_ASSIGNMENTS, true, true);
});
test('get controls should return retainVolumeGroup control with true value', ()=> {
- getControlByNameAndCheckValue(UpgradeFormControlNames.RETAIN_VOLUME_GROUPS, true);
+ getControlByNameAndCheckValue(UpgradeFormControlNames.RETAIN_VOLUME_GROUPS, true, true);
+ });
+
+ test('get controls should NOT return retainVolumeGroup control with true value', ()=> {
+ let stateCopy =_.cloneDeep(store.getState());
+ stateCopy.service.serviceHierarchy['serviceId'].vfModules['vfModuleName'].volumeGroupAllowed = false;
+ jest.spyOn(store, 'getState').mockReturnValue(stateCopy);
+ getControlByNameAndCheckValue(UpgradeFormControlNames.RETAIN_VOLUME_GROUPS, null, false);
});
test('get controls should contain SUPPLEMENTARY_FILE controller', ()=> {
@@ -196,6 +221,6 @@ describe('VFModule popup service', () => {
test( 'get controls should return usePreload with false value', () => {
- getControlByNameAndCheckValue(SDN_C_PRE_LOAD, false);
+ getControlByNameAndCheckValue(SDN_C_PRE_LOAD, false, true);
});
});
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service.spec.ts
index 2f1904468..60f0f361e 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service.spec.ts
@@ -1,7 +1,7 @@
import {DefaultDataGeneratorService} from "../../../../services/defaultDataServiceGenerator/default.data.generator.service";
import {NgRedux} from "@angular-redux/store";
import {IframeService} from "../../../../utils/iframe.service";
-import {VfModulePopuopService} from "../vfModule/vfModule.popuop.service";
+import {VfModulePopupService} from "../vfModule/vfModule.popup.service";
import {FormBuilder} from "@angular/forms";
import {GenericFormService} from "../../../genericForm/generic-form.service";
import {BasicPopupService} from "../basic.popup.service";
@@ -2258,7 +2258,7 @@ describe('vnf new popup service', () => {
AaiService,
LogService,
BasicPopupService,
- VfModulePopuopService,
+ VfModulePopupService,
VfModuleUpgradePopupService,
BasicControlGenerator,
VnfControlGenerator,
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service.spec.ts
index 3a81e5b2b..8ee48e675 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service.spec.ts
@@ -1,7 +1,7 @@
import {DefaultDataGeneratorService} from "../../../../services/defaultDataServiceGenerator/default.data.generator.service";
import {NgRedux} from "@angular-redux/store";
import {IframeService} from "../../../../utils/iframe.service";
-import {VfModulePopuopService} from "../vfModule/vfModule.popuop.service";
+import {VfModulePopupService} from "../vfModule/vfModule.popup.service";
import {FormBuilder} from "@angular/forms";
import {GenericFormService} from "../../../genericForm/generic-form.service";
import {BasicPopupService} from "../basic.popup.service";
@@ -2255,7 +2255,7 @@ describe('vnf group new popup service', () => {
AaiService,
LogService,
BasicPopupService,
- VfModulePopuopService,
+ VfModulePopupService,
VfModuleUpgradePopupService,
BasicControlGenerator,
VnfGroupControlGenerator,