summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-02-24 14:26:52 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-24 14:26:52 +0000
commitd9d76be660584b7eca9d8b916b3974a0ea163905 (patch)
tree0def1c5e31026d1a813ef72474e2583f513c09a2 /vid-webpack-master
parent0f9b9e00ca74495e0beef32b0633bebac662ed61 (diff)
parent94cd52bc1fe7b997802dd71952c18d67cb2cd12a (diff)
Merge "Show "retain VG" for vfModule that is allowed or that is an "alien""
Diffstat (limited to 'vid-webpack-master')
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts2
-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
3 files changed, 25 insertions, 10 deletions
diff --git a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
index 6338a10b5..cde41bee3 100644
--- a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
@@ -219,7 +219,7 @@ describe('View Edit Page: Upgrade VFModule', function () {
cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${serviceModelId}&subscriberId=${subscriberId}&serviceType=${serviceType}&serviceInstanceId=${serviceInstanceId}`);
- upgradeTheVFM('node-3412fe1f-e103-4777-90c0-f66d888f4bed-mdns012220200..Mdns01222020..dns_az_01..module-1', false);
+ upgradeTheVFM('node-3412fe1f-e103-4777-90c0-f66d888f4bed-mdns012220200..Mdns01222020..dns_az_01..module-1', true);
mockAsyncBulkResponse();
cy.getDrawingBoardDeployBtn().click();
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', ()=> {