aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/genericFormPopup
diff options
context:
space:
mode:
authorYoav Schneiderman <yoav.schneiderman@intl.att.com>2019-11-21 16:17:55 +0200
committerYoav Schneiderman <yoav.schneiderman@intl.att.com>2019-11-25 12:42:52 +0200
commitbda996b9faf9d5d443d2256c0626620bd8104269 (patch)
tree41d86b08efdc5291404f0c672cc98328c6a2aaf3 /vid-webpack-master/src/app/shared/components/genericFormPopup
parentd8f8033a6e6f5a8d724d4b94c4056d2660cc34f1 (diff)
VfModule upgrade: popup with retain-assignments checkbox
Also: - undo upgrade -> remove field - cancel on popup works Issue-ID: VID-603 Change-Id: I47106ce4d042c777b56699d8c5c5e1e99f856a5e Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/genericFormPopup')
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts49
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts13
2 files changed, 60 insertions, 2 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 a7f6d5515..251a14720 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
@@ -3,9 +3,34 @@ import {ITreeNode} from "angular-tree-component/dist/defs/api";
import {FormGroup} from "@angular/forms";
import {VfModulePopuopService} from "../vfModule/vfModule.popuop.service";
import {FormPopupDetails} from "../../../../models/formControlModels/formPopupDetails.model";
+import {updateVFModuleField, upgradeVFModule} from "../../../../storeUtil/utils/vfModule/vfModule.actions";
+import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
+import {NgRedux} from "@angular-redux/store";
+import {AppState} from "../../../../store/reducers";
+import {BasicControlGenerator} from "../../../genericForm/formControlsServices/basic.control.generator";
+import {VfModuleControlGenerator} from "../../../genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator";
+import {IframeService} from "../../../../utils/iframe.service";
+import {DefaultDataGeneratorService} from "../../../../services/defaultDataServiceGenerator/default.data.generator.service";
+import {AaiService} from "../../../../services/aaiService/aai.service";
+import {BasicPopupService} from "../basic.popup.service";
+import {
+ FormControlModel
+} from "../../../../models/formControlModels/formControl.model";
+import {CheckboxFormControl} from "../../../../models/formControlModels/checkboxFormControl.model";
+import {FormControlType} from "../../../../models/formControlModels/formControlTypes.enum";
@Injectable()
export class VfModuleUpgradePopupService extends VfModulePopuopService {
+ constructor(protected _basicControlGenerator: BasicControlGenerator,
+ protected _vfModuleControlGenerator: VfModuleControlGenerator,
+ protected _iframeService: IframeService,
+ protected _defaultDataGeneratorService: DefaultDataGeneratorService,
+ protected _aaiService: AaiService,
+ protected _basicPopupService : BasicPopupService,
+ protected _store: NgRedux<AppState>,
+ private _sharedTreeService : SharedTreeService){
+ super(_basicControlGenerator, _vfModuleControlGenerator, _iframeService, _defaultDataGeneratorService, _aaiService, _basicPopupService,_store);
+ }
node: ITreeNode;
getGenericFormPopupDetails(serviceId: string, vnfStoreKey: string, vfModuleStoreKey: string, node: ITreeNode, uuidData: Object, isUpdateMode: boolean): FormPopupDetails {
@@ -13,11 +38,31 @@ export class VfModuleUpgradePopupService extends VfModulePopuopService {
}
getDynamicInputs = () => [];
- getControls = () => [];
+
+ getControls = () : FormControlModel[] => {
+ return [
+ new CheckboxFormControl({
+ type: FormControlType.CHECKBOX,
+ controlName: 'retainAssignments',
+ displayName: 'Retain Assignments',
+ dataTestId: 'retainAssignments',
+ value: false,
+ validations: []
+ })
+ ];
+ };
+
+
getTitle = (): string => 'Upgrade Module';
onSubmit(that, form: FormGroup) {
- //that.storeVFModule(that, form.value);
+ const node = that.uuidData.vfModule;
+ const serviceInstanceId: string = that.uuidData.serviceId;
+
+ 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.postSubmitIframeMessage(that);
this.onCancel(that, form);
}
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 17054c78b..50b0d36c1 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
@@ -13,6 +13,7 @@ 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 {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
class MockModalService<T> {
}
@@ -52,6 +53,7 @@ describe('VFModule popup service', () => {
AaiService,
LogService,
BasicPopupService,
+ SharedTreeService,
{provide: FeatureFlagsService, useClass: MockFeatureFlagsService},
{provide: NgRedux, useClass: MockReduxStore},
{provide: HttpClient, useClass: MockAppStore},
@@ -73,4 +75,15 @@ describe('VFModule popup service', () => {
expect(service.getTitle()).toBe("Upgrade Module")
});
+ test('get controls should return retainAssignments control with false i', ()=> {
+
+ const controls = service.getControls();
+
+ const retainAssignmentsControl = controls.find((control)=>{
+ return control.controlName === 'retainAssignments';
+ });
+
+ expect(retainAssignmentsControl).toBeDefined();
+ expect(retainAssignmentsControl.value).toBeFalsy();
+ });
});