summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSara Weiss <sara.weiss@intl.att.com>2019-11-26 11:46:42 +0200
committerEylon Malin <eylon.malin@intl.att.com>2019-11-26 12:39:34 +0200
commitd21551443281955928db9b72e2b14debc301912a (patch)
treefcc43ec59852ce8651d657fd43b1beb89762da8d
parenta6b33add4f81a2c70aaf6172dd7184eeb8fb323d (diff)
Replace vfmodule: add retainVolumeGroup to new upgrade modal
Issue-ID: VID-603 Change-Id: I1994d4464172613294198e21a77f31b752211888 Signed-off-by: Sara Weiss <sara.weiss@intl.att.com> Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json1
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json1
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts1
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts55
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts13
5 files changed, 57 insertions, 14 deletions
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json
index 46c99e77c..743e5a0c1 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json
@@ -34,6 +34,7 @@
"b0732bed-3ddf-43cc-b193-7f18db84e476": {
"action": "None_Upgrade",
"retainAssignments" : false,
+ "retainVolumeGroups" : false,
"instanceName": "PST-VfMod-Replace-5-Vfmod",
"instanceId": "b0732bed-3ddf-43cc-b193-7f18db84e476",
"orchStatus": "Active",
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json
index 98ba26c18..55f22ca3b 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json
@@ -34,6 +34,7 @@
],
"requestParameters": {
"retainAssignments": false,
+ "rebuildVolumeGroups":true,
"userParams": [],
"testApi": "VNF_API"
},
diff --git a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
index 46e5fad44..97eadabcb 100644
--- a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
@@ -219,6 +219,7 @@ describe('View Edit Page: Upgrade VFModule', function () {
// The following is needed when enabling FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS
cy.getElementByDataTestsId('retainAssignments').click();
+ cy.getElementByDataTestsId('retainVolumeGroups').click();
cy.screenshot();
cy.getElementByDataTestsId('form-set').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 ff3f23ff4..c49081608 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
@@ -19,8 +19,14 @@ import {
import {CheckboxFormControl} from "../../../../models/formControlModels/checkboxFormControl.model";
import {FormControlType} from "../../../../models/formControlModels/formControlTypes.enum";
+export enum UpgradeFormControlNames {
+ RETAIN_VOLUME_GROUPS = 'retainVolumeGroups',
+ RETAIN_ASSIGNMENTS = 'retainAssignments',
+}
+
@Injectable()
export class VfModuleUpgradePopupService extends VfModulePopuopService {
+
constructor(protected _basicControlGenerator: BasicControlGenerator,
protected _vfModuleControlGenerator: VfModuleControlGenerator,
protected _iframeService: IframeService,
@@ -40,19 +46,9 @@ export class VfModuleUpgradePopupService extends VfModulePopuopService {
getDynamicInputs = () => [];
getControls = () : FormControlModel[] => {
- return [
- new CheckboxFormControl({
- type: FormControlType.CHECKBOX,
- controlName: 'retainAssignments',
- displayName: 'Retain Assignments',
- dataTestId: 'retainAssignments',
- value: true,
- validations: []
- })
- ];
+ return this.getUpgradeFormControls()
};
-
getTitle = (): string => 'Upgrade Module';
onSubmit(that, form: FormGroup) {
@@ -61,10 +57,45 @@ export class VfModuleUpgradePopupService extends VfModulePopuopService {
this._store.dispatch(upgradeVFModule(node.data.modelName, node.parent.data.vnfStoreKey, serviceInstanceId ,node.data.dynamicModelName));
this._sharedTreeService.upgradeBottomUp(node, serviceInstanceId);
- this._store.dispatch(updateVFModuleField(node.data.modelName, node.parent.data.vnfStoreKey, serviceInstanceId ,node.data.dynamicModelName, 'retainAssignments', form.controls['retainAssignments'].value));
+
+ this.updateVFModuleField(UpgradeFormControlNames.RETAIN_VOLUME_GROUPS,node, serviceInstanceId, form);
+ this.updateVFModuleField(UpgradeFormControlNames.RETAIN_ASSIGNMENTS,node, serviceInstanceId, form);
this.postSubmitIframeMessage(that);
this.onCancel(that, form);
}
+ private updateVFModuleField(fieldName: string, node, serviceInstanceId: string, form: FormGroup) {
+ this._store.dispatch(updateVFModuleField(node.data.modelName, node.parent.data.vnfStoreKey, serviceInstanceId, node.data.dynamicModelName, fieldName, form.controls[fieldName].value));
+ }
+
+
+ getRetainVolumeGroupsControl = (): CheckboxFormControl => {
+ return new CheckboxFormControl({
+ type: FormControlType.CHECKBOX,
+ controlName: UpgradeFormControlNames.RETAIN_VOLUME_GROUPS,
+ displayName: 'Retain Volume Groups',
+ dataTestId: UpgradeFormControlNames.RETAIN_VOLUME_GROUPS,
+ value: true,
+ validations: []
+ })
+ };
+
+ getRetainAssignmentsControl = (): CheckboxFormControl => {
+ return new CheckboxFormControl({
+ type: FormControlType.CHECKBOX,
+ controlName: UpgradeFormControlNames.RETAIN_ASSIGNMENTS,
+ displayName: 'Retain Assignments',
+ dataTestId: UpgradeFormControlNames.RETAIN_ASSIGNMENTS,
+ value: true,
+ validations: []
+ })
+ };
+
+ getUpgradeFormControls = (): FormControlModel[] => {
+ let result: FormControlModel[] = [];
+ result.push(this.getRetainVolumeGroupsControl());
+ result.push(this.getRetainAssignmentsControl());
+ 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 5850d25f0..a7c8214b4 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
@@ -12,7 +12,7 @@ import {VfModuleControlGenerator} from "../../../genericForm/formControlsService
import {SdcUiServices} from "onap-ui-angular";
import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service";
import {getTestBed, TestBed} from "@angular/core/testing";
-import {VfModuleUpgradePopupService} from "./vfModule.upgrade.popuop.service";
+import {UpgradeFormControlNames, VfModuleUpgradePopupService} from "./vfModule.upgrade.popuop.service";
import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
class MockModalService<T> {
@@ -78,12 +78,21 @@ describe('VFModule popup service', () => {
test('get controls should return retainAssignments control with false i', ()=> {
const controls = service.getControls();
+ expect(controls.length).toEqual(2);
const retainAssignmentsControl = controls.find((control)=>{
- return control.controlName === 'retainAssignments';
+ return control.controlName === UpgradeFormControlNames.RETAIN_ASSIGNMENTS;
});
expect(retainAssignmentsControl).toBeDefined();
expect(retainAssignmentsControl.value).toBeTruthy();
+
+
+ const retainVolumeGroup = controls.find((control)=>{
+ return control.controlName === UpgradeFormControlNames.RETAIN_VOLUME_GROUPS;
+ });
+
+ expect(retainVolumeGroup).toBeDefined();
+ expect(retainVolumeGroup.value).toBeTruthy();
});
});