aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2019-11-26 21:44:18 +0200
committerAlexey Sandler <alexey.sandler@intl.att.com>2019-11-27 15:09:51 +0200
commitabb5985d156fcf7d7cd0a838ca760651223a7a2c (patch)
tree649808f21df6ab02350baac472d92bd0c87106b2 /vid-webpack-master/src/app/shared
parent7313c143ac5b3954732ec4cb98c0a899a4b99267 (diff)
add sdnc checkbox to vfm upgrade modal
Issue-ID: VID-603 Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com> Change-Id: Ic297486bc343419415bf3736ebb56944e72bf8b8 Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared')
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts24
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts37
2 files changed, 31 insertions, 30 deletions
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 5de2da112..576e63df5 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
@@ -20,6 +20,7 @@ import {mergeObjectByPathAction} from "../../../../storeUtil/utils/general/gener
export enum UpgradeFormControlNames {
RETAIN_VOLUME_GROUPS = 'retainVolumeGroups',
RETAIN_ASSIGNMENTS = 'retainAssignments',
+ SDN_C_PRE_LOAD = 'sdncPreLoad',
}
@Injectable()
@@ -29,20 +30,22 @@ export class VfModuleUpgradePopupService extends VfModulePopupServiceBase {
protected _iframeService: IframeService,
protected _defaultDataGeneratorService: DefaultDataGeneratorService,
protected _aaiService: AaiService,
- protected _basicPopupService : BasicPopupService,
+ protected _basicPopupService: BasicPopupService,
protected _store: NgRedux<AppState>,
- private _sharedTreeService : SharedTreeService){
- super(_basicControlGenerator, _vfModuleControlGenerator, _iframeService, _defaultDataGeneratorService, _aaiService, _basicPopupService,_store);
+ private _sharedTreeService: SharedTreeService) {
+ super(_basicControlGenerator, _vfModuleControlGenerator, _iframeService, _defaultDataGeneratorService, _aaiService, _basicPopupService, _store);
}
+
node: ITreeNode;
getDynamicInputs = () => null;
- getControls(serviceId: string, vnfStoreKey: string, vfModuleStoreKey: string, isUpdateMode: boolean) {
- let result: FormControlModel[] = [];
- result.push(this.getRetainVolumeGroupsControl());
- result.push(this.getRetainAssignmentsControl());
- return result;
+ getControls = (): FormControlModel[] => {
+ return [
+ this.getRetainAssignmentsControl(),
+ this.getRetainVolumeGroupsControl(),
+ this._basicControlGenerator.getSDNCControl(null)
+ ]
};
getTitle = (): string => 'Upgrade Module';
@@ -54,8 +57,8 @@ export class VfModuleUpgradePopupService extends VfModulePopupServiceBase {
const modelName = node.data.modelName;
const dynamicModelName = node.data.dynamicModelName;
- this._store.dispatch(upgradeVFModule(modelName, vnfStoreKey, serviceInstanceId ,dynamicModelName));
- this._store.dispatch(mergeObjectByPathAction(['serviceInstance',serviceInstanceId, 'vnfs', vnfStoreKey, 'vfModules', modelName, dynamicModelName], form.value));
+ this._store.dispatch(upgradeVFModule(modelName, vnfStoreKey, serviceInstanceId, dynamicModelName));
+ this._store.dispatch(mergeObjectByPathAction(['serviceInstance', serviceInstanceId, 'vnfs', vnfStoreKey, 'vfModules', modelName, dynamicModelName], form.value));
this._sharedTreeService.upgradeBottomUp(node, serviceInstanceId);
this.postSubmitIframeMessage(that);
@@ -83,5 +86,4 @@ export class VfModuleUpgradePopupService extends VfModulePopupServiceBase {
validations: []
})
};
-
}
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 5feadeb8a..8d11caf5d 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
@@ -20,24 +20,18 @@ import {GeneralActions} from "../../../../storeUtil/utils/general/general.action
import {VfModuleActions} from "../../../../storeUtil/utils/vfModule/vfModule.actions";
import {ServiceActions} from "../../../../storeUtil/utils/service/service.actions";
-class MockModalService<T> {
-}
-
-class MockAppStore<T> {
-}
+class MockModalService<T> {}
-let uuidData = {};
+class MockAppStore<T> {}
class MockReduxStore<T> {
getState() {
return {};
}
-
dispatch() {}
}
-class MockFeatureFlagsService {
-}
+class MockFeatureFlagsService {}
describe('VFModule popup service', () => {
let injector;
@@ -77,17 +71,16 @@ describe('VFModule popup service', () => {
fb = injector.get(FormBuilder);
iframeService = injector.get(IframeService);
store = injector.get(NgRedux);
-
})().then(done).catch(done.fail));
test('getTitle should return the correct title', () => {
expect(service.getTitle()).toBe("Upgrade Module")
});
- test('get controls should return retainAssignments control with false i', ()=> {
+ test('get controls should return retainAssignments control with true i', ()=> {
- const controls = service.getControls('a', 'b', 'c', true);
- expect(controls.length).toEqual(2);
+ const controls = service.getControls();
+ expect(controls.length).toEqual(3);
const retainAssignmentsControl = controls.find((control)=>{
return control.controlName === UpgradeFormControlNames.RETAIN_ASSIGNMENTS;
@@ -96,7 +89,6 @@ describe('VFModule popup service', () => {
expect(retainAssignmentsControl).toBeDefined();
expect(retainAssignmentsControl.value).toBeTruthy();
-
const retainVolumeGroup = controls.find((control)=>{
return control.controlName === UpgradeFormControlNames.RETAIN_VOLUME_GROUPS;
});
@@ -106,9 +98,6 @@ describe('VFModule popup service', () => {
});
test('on submit should call merge action of form value to vfModule', () => {
-
- //given
-
const serviceId = "serviceId5";
const vnfStoreKey = 'vnfStoreKey3';
const modelName = 'modelA';
@@ -136,10 +125,10 @@ describe('VFModule popup service', () => {
let mockFrom: FormGroup = mock(FormGroup);
let form = instance(mockFrom);
- form.value = {
+ form.setValue({
a: "value",
b: "another"
- };
+ });
spyOn(store, 'dispatch');
@@ -154,4 +143,14 @@ describe('VFModule popup service', () => {
expect(store.dispatch).toBeCalledWith({type: ServiceActions.UPGRADE_SERVICE_ACTION, serviceUuid: "serviceId5"});
});
+
+
+ test( 'get controls should return usePreload with false value', () => {
+ const controls = service.getControls();
+ const usePreloadControl = controls.find((control)=>{
+ return control.controlName === 'sdncPreLoad';
+ });
+ expect(usePreloadControl).toBeDefined();
+ expect(usePreloadControl.value).toBeFalsy();
+ });
});