summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components
diff options
context:
space:
mode:
authorSara Weiss <sara.weiss@intl.att.com>2019-11-20 14:50:33 +0200
committerIttay Stern <ittay.stern@att.com>2019-11-20 19:58:29 +0200
commiteed6943814dd8650bcf8499d650374b8b5b8080f (patch)
tree32ac7bcf56babcbf60a793437a66a879af9fe74f /vid-webpack-master/src/app/shared/components
parent6d4ee7843b05ba309d72e3d239cad882e1a9a804 (diff)
Replace vfmodule: opens an popup
Issue-ID: VID-603 Change-Id: I7d7524f75bfb8d6ef949a4f069591c4097d470b4 Signed-off-by: Sara Weiss <sara.weiss@intl.att.com> Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components')
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts1
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts2
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service.ts22
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts25
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts76
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service.spec.ts2
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service.spec.ts2
7 files changed, 121 insertions, 9 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
index 8a95d108f..d0e2d4b85 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
@@ -27,6 +27,7 @@ export enum PopupType{
VNF = 'vnf',
NETWORK = 'network',
VF_MODULE = 'vf_module',
+ VF_MODULE_UPGRADE = 'vf_module_upgrade',
VNF_GROUP = 'vnf_group'
}
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts
index fa77bed5f..ab70ea335 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts
@@ -20,6 +20,7 @@ import {NetworkControlGenerator} from "../genericForm/formControlsServices/netwo
import {VfModulePopuopService} from "./genericFormServices/vfModule/vfModule.popuop.service";
import {VfModuleControlGenerator} from "../genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator";
import {FeatureFlagsService} from "../../services/featureFlag/feature-flags.service";
+import {VfModuleUpgradePopupService} from "./genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service";
class MockAppStore<T>{
getState() {
@@ -970,6 +971,7 @@ describe('Generic Form popup Service', () => {
NetworkPopupService,
NetworkControlGenerator,
VfModulePopuopService,
+ VfModuleUpgradePopupService,
VfModuleControlGenerator,
{provide:FeatureFlagsService, useClass: MockFeatureFlagsService},
{provide: ActivatedRoute, useClass: ActivatedRouteMock},
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service.ts
index c7a71efc0..d0a68675c 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service.ts
@@ -33,13 +33,13 @@ export class VfModulePopuopService implements GenericPopupInterface {
isUpdateMode: boolean;
- constructor(private _basicControlGenerator: BasicControlGenerator,
- private _vfModuleControlGenerator: VfModuleControlGenerator,
- private _iframeService: IframeService,
- private _defaultDataGeneratorService: DefaultDataGeneratorService,
- private _aaiService: AaiService,
- private _basicPopupService : BasicPopupService,
- private _store: NgRedux<AppState>) {
+ constructor(protected _basicControlGenerator: BasicControlGenerator,
+ protected _vfModuleControlGenerator: VfModuleControlGenerator,
+ protected _iframeService: IframeService,
+ protected _defaultDataGeneratorService: DefaultDataGeneratorService,
+ protected _aaiService: AaiService,
+ protected _basicPopupService : BasicPopupService,
+ protected _store: NgRedux<AppState>) {
}
@@ -141,16 +141,20 @@ export class VfModulePopuopService implements GenericPopupInterface {
delete form.value['supplementaryFileName'];
}
that.storeVFModule(that, form.value);
+ this.postSubmitIframeMessage(that);
+ this.onCancel(that, form);
+ }
+
+
+ protected postSubmitIframeMessage(that) {
window.parent.postMessage({
eventId: 'submitIframe',
data: {
serviceModelId: that.serviceModel.uuid
}
}, "*");
- this.onCancel(that, form);
}
-
onCancel(that, form) {
form.reset();
that._iframeService.removeClassCloseModal('content');
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
new file mode 100644
index 000000000..a7f6d5515
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts
@@ -0,0 +1,25 @@
+import {Injectable} from "@angular/core";
+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";
+
+@Injectable()
+export class VfModuleUpgradePopupService extends VfModulePopuopService {
+ node: ITreeNode;
+
+ getGenericFormPopupDetails(serviceId: string, vnfStoreKey: string, vfModuleStoreKey: string, node: ITreeNode, uuidData: Object, isUpdateMode: boolean): FormPopupDetails {
+ return super.getGenericFormPopupDetails(serviceId, vnfStoreKey, vfModuleStoreKey, node, uuidData, isUpdateMode);
+ }
+
+ getDynamicInputs = () => [];
+ getControls = () => [];
+ getTitle = (): string => 'Upgrade Module';
+
+ onSubmit(that, form: FormGroup) {
+ //that.storeVFModule(that, form.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
new file mode 100644
index 000000000..17054c78b
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts
@@ -0,0 +1,76 @@
+import {LogService} from "../../../../utils/log/log.service";
+import {NgRedux} from "@angular-redux/store";
+import {BasicControlGenerator} from "../../../genericForm/formControlsServices/basic.control.generator";
+import {AaiService} from "../../../../services/aaiService/aai.service";
+import {HttpClient} from "@angular/common/http";
+import {GenericFormService} from "../../../genericForm/generic-form.service";
+import {FormBuilder} from "@angular/forms";
+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 {VfModuleUpgradePopupService} from "./vfModule.upgrade.popuop.service";
+
+class MockModalService<T> {
+}
+
+class MockAppStore<T> {
+}
+
+let uuidData = {};
+
+class MockReduxStore<T> {
+ getState() {
+ return {};
+ }
+}
+
+class MockFeatureFlagsService {
+}
+
+describe('VFModule popup service', () => {
+ let injector;
+ let service: VfModuleUpgradePopupService;
+ let genericFormService: GenericFormService;
+ let defaultDataGeneratorService: DefaultDataGeneratorService;
+ let fb: FormBuilder;
+ let iframeService: IframeService;
+
+ beforeAll(done => (async () => {
+ TestBed.configureTestingModule({
+ providers: [
+ VfModuleUpgradePopupService,
+ BasicControlGenerator,
+ VfModuleControlGenerator,
+ DefaultDataGeneratorService,
+ GenericFormService,
+ FormBuilder,
+ IframeService,
+ AaiService,
+ LogService,
+ BasicPopupService,
+ {provide: FeatureFlagsService, useClass: MockFeatureFlagsService},
+ {provide: NgRedux, useClass: MockReduxStore},
+ {provide: HttpClient, useClass: MockAppStore},
+ {provide: SdcUiServices.ModalService, useClass: MockModalService}
+ ]
+ });
+ await TestBed.compileComponents();
+
+ injector = getTestBed();
+ service = injector.get(VfModuleUpgradePopupService);
+ genericFormService = injector.get(GenericFormService);
+ defaultDataGeneratorService = injector.get(DefaultDataGeneratorService);
+ fb = injector.get(FormBuilder);
+ iframeService = injector.get(IframeService);
+
+ })().then(done).catch(done.fail));
+
+ test('getTitle should return the correct title', () => {
+ expect(service.getTitle()).toBe("Upgrade Module")
+ });
+
+});
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service.spec.ts
index 6458e4f97..b1bbc92a8 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service.spec.ts
@@ -14,6 +14,7 @@ import {VnfControlGenerator} from "../../../genericForm/formControlsServices/vnf
import {UUIDData} from "../../generic-form-popup.component";
import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service";
import {getTestBed, TestBed} from "@angular/core/testing";
+import {VfModuleUpgradePopupService} from "../vfModuleUpgrade/vfModule.upgrade.popuop.service";
class MockAppStore<T> {}
@@ -2261,6 +2262,7 @@ describe('vnf new popup service', () => {
LogService,
BasicPopupService,
VfModulePopuopService,
+ VfModuleUpgradePopupService,
BasicControlGenerator,
VnfControlGenerator,
{provide: NgRedux, useClass: MockReduxStore},
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service.spec.ts
index 5397a7233..075c97227 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service.spec.ts
@@ -14,6 +14,7 @@ import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flag
import {VnfGroupPopupService} from "./vnfGroup.popup.service";
import {VnfGroupControlGenerator} from "../../../genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator";
import {getTestBed, TestBed} from "@angular/core/testing";
+import {VfModuleUpgradePopupService} from "../vfModuleUpgrade/vfModule.upgrade.popuop.service";
class MockAppStore<T> {}
@@ -2258,6 +2259,7 @@ describe('vnf group new popup service', () => {
LogService,
BasicPopupService,
VfModulePopuopService,
+ VfModuleUpgradePopupService,
BasicControlGenerator,
VnfGroupControlGenerator,
{provide: NgRedux, useClass: MockReduxStore},