aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src
diff options
context:
space:
mode:
authorEinat Vinouze <einat.vinouze@intl.att.com>2020-02-24 12:58:39 +0200
committerEinat Vinouze <einat.vinouze@intl.att.com>2020-02-24 15:30:04 +0200
commit94cd52bc1fe7b997802dd71952c18d67cb2cd12a (patch)
tree4465b41a9c82f6983f90e520ffd95dd93db095e8 /vid-webpack-master/src
parentbf58511a20b396e97ab0a88dfe6fce3d7a54395f (diff)
Show "retain VG" for vfModule that is allowed or that is an "alien"
Issue-ID: Issue-ID: VID-771 Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com> Change-Id: Ie52fa194a92e0b9e21df723b708b4db877712068 Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src')
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts6
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts27
2 files changed, 24 insertions, 9 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 5181318dc..eddfee074 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
@@ -16,7 +16,6 @@ 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";
import {SharedControllersService} from "../../../genericForm/formControlsServices/sharedControlles/shared.controllers.service";
@@ -49,7 +48,10 @@ export class VfModuleUpgradePopupService extends VfModulePopupServiceBase {
this._sharedControllersService.getSDNCControl(null)
];
const vfModuleInstance :VfModuleInstance = this._vfModuleControlGenerator.getVfModuleInstance(serviceId, vnfStoreKey, this.uuidData, isUpdateMode);
- if(this._store.getState().service.serviceHierarchy[serviceId].vfModules[this.uuidData['modelName']].volumeGroupAllowed){
+
+ let volumeGroupAllowed = this._store.getState().service.serviceHierarchy[serviceId].vfModules[this.uuidData['modelName']].volumeGroupAllowed;
+ let vfModuleNotExistsOnModel = this._sharedTreeService.isVfModuleCustomizationIdNotExistsOnModel(this.uuidData['vfModule'], serviceId);
+ if(volumeGroupAllowed|| vfModuleNotExistsOnModel){
result.push(this.getRetainVolumeGroupsControl());
}
result = this._basicControlGenerator.concatSupplementaryFile(result, vfModuleInstance);
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 578c37ef0..2123d6a9f 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 {ControlGeneratorUtil, SDN_C_PRE_LOAD, SUPPLEMENTARY_FILE} from "../../../genericForm/formControlsServices/control.generator.util.service";
+import {
+ ControlGeneratorUtil,
+ SDN_C_PRE_LOAD,
+ SUPPLEMENTARY_FILE
+} from "../../../genericForm/formControlsServices/control.generator.util.service";
import {AaiService} from "../../../../services/aaiService/aai.service";
import {HttpClient} from "@angular/common/http";
import {GenericFormService} from "../../../genericForm/generic-form.service";
@@ -9,7 +13,6 @@ import {IframeService} from "../../../../utils/iframe.service";
import {DefaultDataGeneratorService} from "../../../../services/defaultDataServiceGenerator/default.data.generator.service";
import {BasicPopupService} from "../basic.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";
import {getTestBed, TestBed} from "@angular/core/testing";
import {UpgradeFormControlNames, VfModuleUpgradePopupService} from "./vfModule.upgrade.popuop.service";
@@ -65,6 +68,7 @@ describe('VFModule popup service', () => {
let fb: FormBuilder;
let iframeService: IframeService;
let store : NgRedux<AppState>;
+ let _sharedTreeService : SharedTreeService;
beforeAll(done => (async () => {
TestBed.configureTestingModule({
@@ -95,8 +99,12 @@ describe('VFModule popup service', () => {
defaultDataGeneratorService = injector.get(DefaultDataGeneratorService);
fb = injector.get(FormBuilder);
iframeService = injector.get(IframeService);
+ _sharedTreeService = injector.get(SharedTreeService);
store = injector.get(NgRedux);
service.uuidData = {
+ vfModule: {
+ data: {}
+ },
modelName: 'vfModuleName',
vFModuleStoreKey: 'vfModuleId'
};
@@ -133,11 +141,16 @@ describe('VFModule popup service', () => {
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);
+ [true, false].forEach(notExistsOnModel => {
+ test(`retainVolumeGroup control is shown when vfModule not from model (notExistsOnModel=${notExistsOnModel})`, () => {
+ let stateCopy = _.cloneDeep(store.getState());
+ stateCopy.service.serviceHierarchy['serviceId'].vfModules['vfModuleName'].volumeGroupAllowed = false;
+ jest.spyOn(store, 'getState').mockReturnValue(stateCopy);
+
+ jest.spyOn(_sharedTreeService, 'isVfModuleCustomizationIdNotExistsOnModel').mockReturnValue(notExistsOnModel);
+
+ getControlByNameAndCheckValue(UpgradeFormControlNames.RETAIN_VOLUME_GROUPS, true, notExistsOnModel);
+ });
});
test('get controls should contain SUPPLEMENTARY_FILE controller', ()=> {