diff options
author | Sara Weiss <sara.weiss@intl.att.com> | 2019-11-20 14:50:33 +0200 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-11-20 19:58:29 +0200 |
commit | eed6943814dd8650bcf8499d650374b8b5b8080f (patch) | |
tree | 32ac7bcf56babcbf60a793437a66a879af9fe74f /vid-webpack-master/src/app/drawingBoard/service-planning | |
parent | 6d4ee7843b05ba309d72e3d239cad882e1a9a804 (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/drawingBoard/service-planning')
9 files changed, 60 insertions, 16 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.spec.ts index 840f31dcf..a44c21bf0 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.spec.ts @@ -13,6 +13,7 @@ import {VnfPopupService} from "../../../../../shared/components/genericFormPopup import {DuplicateService} from "../../../duplicate/duplicate.service"; import {IframeService} from "../../../../../shared/utils/iframe.service"; import {RelatedVnfMemberInfoModel} from "./relatedVnfMember.info.model"; +import {VfModuleUpgradePopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; class MockAppStore<T> { @@ -38,6 +39,7 @@ describe('Related Vnf member Model Info', () => { DynamicInputsService, DialogService, VfModulePopuopService, + VfModuleUpgradePopupService, VnfPopupService, DefaultDataGeneratorService, SharedTreeService, diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts index b596d0b48..eb9902f7c 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts @@ -16,6 +16,7 @@ import {ModelInformationItem} from "../../../../../shared/components/model-infor import {AaiService} from "../../../../../shared/services/aaiService/aai.service"; import {HttpClient, HttpHandler} from "@angular/common/http"; import {FeatureFlagsService} from "../../../../../shared/services/featureFlag/feature-flags.service"; +import {VfModuleUpgradePopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; class MockAppStore<T> { getState() { @@ -34,6 +35,7 @@ describe('VFModule Model Info', () => { let vfModuleModel: VFModuleModelInfo; let _dialogService : DialogService; let _vfModulePopupService : VfModulePopuopService; + let _vfModuleUpgradePopupService : VfModuleUpgradePopupService; let _iframeService : IframeService; let _componentInfoService : ComponentInfoService; @@ -44,6 +46,7 @@ describe('VFModule Model Info', () => { DynamicInputsService, DialogService, VfModulePopuopService, + VfModuleUpgradePopupService, SharedTreeService, IframeService, {provide: NgRedux, useClass: MockAppStore}, @@ -60,7 +63,7 @@ describe('VFModule Model Info', () => { injector = getTestBed(); _sharedTreeService = injector.get(SharedTreeService); _componentInfoService = injector.get(ComponentInfoService) - vfModuleModel = new VFModuleModelInfo(_dynamicInputsService, _sharedTreeService, _dialogService, _vfModulePopupService, _iframeService, MockNgRedux.getInstance(),_componentInfoService); + vfModuleModel = new VFModuleModelInfo(_dynamicInputsService, _sharedTreeService, _dialogService, _vfModulePopupService, _vfModuleUpgradePopupService, _iframeService, MockNgRedux.getInstance(),_componentInfoService); })().then(done).catch(done.fail)); diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts index 47a6dcb50..2210d7c84 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts @@ -30,12 +30,15 @@ import { import {ComponentInfoService} from "../../../component-info/component-info.service"; import {ComponentInfoType} from "../../../component-info/component-info-model"; import {ModelInformationItem} from "../../../../../shared/components/model-information/model-information.component"; +import {VfModuleUpgradePopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; +import {FeatureFlagsService, Features} from "../../../../../shared/services/featureFlag/feature-flags.service"; export class VFModuleModelInfo implements ILevelNodeInfo { constructor(private _dynamicInputsService: DynamicInputsService, private _sharedTreeService: SharedTreeService, private _dialogService: DialogService, private _vfModulePopupService: VfModulePopuopService, + private _vfModuleUpgradePopupService: VfModuleUpgradePopupService, private _iframeService: IframeService, private _store: NgRedux<AppState>, private _componentInfoService: ComponentInfoService) { @@ -93,7 +96,7 @@ export class VFModuleModelInfo implements ILevelNodeInfo { newVfModule.typeName = this.typeName; newVfModule.menuActions = this.getMenuAction(<any>newVfModule, currentModel.uuid); newVfModule.isFailed = _.isNil(instance.isFailed) ? false : instance.isFailed; - newVfModule.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage: ""; + newVfModule.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage : ""; newVfModule = this._sharedTreeService.addingStatusProperty(newVfModule); return newVfModule; @@ -247,7 +250,7 @@ export class VFModuleModelInfo implements ILevelNodeInfo { if (!_.isNil(this._store.getState().service.serviceInstance[serviceModelId].vnfs[selectedVNF]) && node.parent.data.name === this._store.getState().service.serviceInstance[serviceModelId].vnfs[selectedVNF].originalName) { const existingVFModules = this.getCountVFModuleOfSelectedVNF(node, selectedVNF, serviceModelId); const reachedLimit = this.isVFModuleReachedLimit(node, this._store.getState().service.serviceHierarchy, serviceModelId, existingVFModules); - const showAddIcon = this._sharedTreeService.shouldShowAddIcon()&& !reachedLimit; + const showAddIcon = this._sharedTreeService.shouldShowAddIcon() && !reachedLimit; return new AvailableNodeIcons(showAddIcon, reachedLimit); } return new AvailableNodeIcons(false, false); @@ -356,10 +359,9 @@ export class VFModuleModelInfo implements ILevelNodeInfo { visible: (node) => this._sharedTreeService.shouldShowUndoDelete(node), enable: (node, serviceModelId) => this._sharedTreeService.shouldShowUndoDelete(node) && this._sharedTreeService.shouldShowDelete(node.parent) && !this._sharedTreeService.isServiceOnDeleteMode(serviceModelId) }, - upgrade : { - method : (node, serviceModelId) => { - this._sharedTreeService.upgradeBottomUp(node, serviceModelId); - this._store.dispatch(upgradeVFModule(node.data.modelName, node.parent.data.vnfStoreKey, serviceModelId, node.data.dynamicModelName)); + upgrade: { + method: (node, serviceModelId) => { + this.upgradeVFM(serviceModelId, node); }, visible: (node,serviceModelId) => { return this._sharedTreeService.shouldShowUpgrade(node, serviceModelId); @@ -371,7 +373,7 @@ export class VFModuleModelInfo implements ILevelNodeInfo { undoUpgrade: { method: (node, serviceModelId) => { this._sharedTreeService.undoUpgradeBottomUp(node, serviceModelId); - this._store.dispatch(undoUgradeVFModule(node.data.modelName, node.parent.data.vnfStoreKey, serviceModelId, node.data.dynamicModelName)); + this._store.dispatch(undoUgradeVFModule(node.data.modelName, node.parent.data.vnfStoreKey, serviceModelId, node.data.dynamicModelName)); }, visible: (node) => { return this._sharedTreeService.shouldShowUndoUpgrade(node); @@ -383,7 +385,30 @@ export class VFModuleModelInfo implements ILevelNodeInfo { }; } - updatePosition(that , node, instanceId, parentStoreKey): void { + private upgradeVFM(serviceModelId, node) { + this._sharedTreeService.upgradeBottomUp(node, serviceModelId); + this._store.dispatch(upgradeVFModule(node.data.modelName, node.parent.data.vnfStoreKey, serviceModelId, node.data.dynamicModelName)); + + if (FeatureFlagsService.getFlagState(Features.FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS, this._store)) { + this._iframeService.addClassOpenModal('content'); + this._dialogService.addDialog(GenericFormPopupComponent, { + type: PopupType.VF_MODULE_UPGRADE, + uuidData: <any>{ + serviceId: serviceModelId, + modelName: node.data.modelName, + vFModuleStoreKey: node.data.dynamicModelName, + vnfStoreKey: node.parent.data.vnfStoreKey, + modelId: node.data.modelId, + type: node.data.type, + popupService: this._vfModuleUpgradePopupService, + }, + node: node, + isUpdateMode: false + }); + } + } + + updatePosition(that, node, instanceId, parentStoreKey): void { that.store.dispatch(updateVFModulePosition(node, instanceId, parentStoreKey)); } @@ -395,12 +420,12 @@ export class VFModuleModelInfo implements ILevelNodeInfo { getInfo(model, instance): ModelInformationItem[] { const modelInformation = !_.isEmpty(model) && !_.isEmpty(model.properties) ? [ ModelInformationItem.createInstance("Base module", model.properties.baseModule), - ModelInformationItem.createInstance("Min instances", !_.isNull(model.properties.minCountInstances)? String(model.properties.minCountInstances): null), - ModelInformationItem.createInstance("Max instances", !_.isNull(model.properties.maxCountInstances)? String(model.properties.maxCountInstances): null), - ModelInformationItem.createInstance("Initial instances count", !_.isNull(model.properties.initialCount)? String(model.properties.initialCount): null) + ModelInformationItem.createInstance("Min instances", !_.isNull(model.properties.minCountInstances) ? String(model.properties.minCountInstances) : null), + ModelInformationItem.createInstance("Max instances", !_.isNull(model.properties.maxCountInstances) ? String(model.properties.maxCountInstances) : null), + ModelInformationItem.createInstance("Initial instances count", !_.isNull(model.properties.initialCount) ? String(model.properties.initialCount) : null) ] : []; - const instanceInfo = []; + const instanceInfo = []; const result = [modelInformation, instanceInfo]; return _.uniq(_.flatten(result)); } diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.spec.ts index de8962787..3af42884d 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.spec.ts @@ -22,6 +22,7 @@ import {ComponentInfoService} from "../../../component-info/component-info.servi import {AaiService} from "../../../../../shared/services/aaiService/aai.service"; import {HttpClient, HttpHandler} from "@angular/common/http"; import {FeatureFlagsService} from "../../../../../shared/services/featureFlag/feature-flags.service"; +import {VfModuleUpgradePopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; describe('Vnf Model Info', () => { let injector; @@ -32,6 +33,7 @@ describe('Vnf Model Info', () => { let _defaultDataGeneratorService : DefaultDataGeneratorService; let _dialogService : DialogService; let _vfModulePopupService : VfModulePopuopService; + let _vfModuleUpgradePopupService : VfModuleUpgradePopupService; let _vnfPopupService : VnfPopupService; let _duplicateService : DuplicateService; let _iframeService : IframeService; @@ -47,6 +49,7 @@ describe('Vnf Model Info', () => { DynamicInputsService, DialogService, VfModulePopuopService, + VfModuleUpgradePopupService, VnfPopupService, DefaultDataGeneratorService, SharedTreeService, @@ -71,6 +74,7 @@ describe('Vnf Model Info', () => { _dialogService, _vnfPopupService, _vfModulePopupService, + _vfModuleUpgradePopupService, _duplicateService, null, _iframeService, diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts index ebcba162e..05d4af18d 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts @@ -38,6 +38,7 @@ import {IModalConfig} from "onap-ui-angular/dist/modals/models/modal-config"; import {ComponentInfoType} from "../../../component-info/component-info-model"; import {ComponentInfoService} from "../../../component-info/component-info.service"; import {ModelInformationItem} from "../../../../../shared/components/model-information/model-information.component"; +import {VfModuleUpgradePopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; export class VnfModelInfo implements ILevelNodeInfo { constructor(private _dynamicInputsService: DynamicInputsService, @@ -46,6 +47,7 @@ export class VnfModelInfo implements ILevelNodeInfo { private _dialogService: DialogService, private _vnfPopupService: VnfPopupService, private _vfModulePopupService: VfModulePopuopService, + private _vfModuleUpgradePopupService : VfModuleUpgradePopupService, private _duplicateService: DuplicateService, private modalService: SdcUiServices.ModalService, private _iframeService: IframeService, @@ -111,7 +113,7 @@ export class VnfModelInfo implements ILevelNodeInfo { * return next level object (VFModule) ************************************************************/ getNextLevelObject = (): VFModuleModelInfo => { - return new VFModuleModelInfo(this._dynamicInputsService, this._sharedTreeService, this._dialogService, this._vfModulePopupService, this._iframeService, this._store, this._componentInfoService); + return new VFModuleModelInfo(this._dynamicInputsService, this._sharedTreeService, this._dialogService, this._vfModulePopupService, this._vfModuleUpgradePopupService, this._iframeService, this._store, this._componentInfoService); }; /*********************************************************** diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts index 7ab2f5b5b..9add349db 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts @@ -32,6 +32,7 @@ import {ErrorMsgService} from "../../../../shared/components/error-msg/error-msg import {ComponentInfoService} from "../../component-info/component-info.service"; import {NetworkStepService} from "../models/vrf/vrfModal/networkStep/network.step.service"; import {VpnStepService} from "../models/vrf/vrfModal/vpnStep/vpn.step.service"; +import {VfModuleUpgradePopupService} from "../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; class MockAppStore<T> { getState() { @@ -73,6 +74,7 @@ describe('Model Tree Generator service', () => { NetworkPopupService, NetworkControlGenerator, VfModulePopuopService, + VfModuleUpgradePopupService, VfModuleControlGenerator, VnfGroupControlGenerator, DialogService, diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.spec.ts index 7246adc27..e5559ee15 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.spec.ts @@ -35,6 +35,7 @@ import {ComponentInfoService} from "../../component-info/component-info.service" import {IModelTreeNodeModel} from "../../../objectsToTree/objectToModelTree/modelTreeNode.model"; import {VpnStepService} from "../models/vrf/vrfModal/vpnStep/vpn.step.service"; import {NetworkStepService} from "../models/vrf/vrfModal/networkStep/network.step.service"; +import {VfModuleUpgradePopupService} from "../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; class MockAppStore<T> { getState() { @@ -98,6 +99,7 @@ describe('Model Tree Generator service', () => { NetworkPopupService, NetworkControlGenerator, VfModulePopuopService, + VfModuleUpgradePopupService, VfModuleControlGenerator, VnfGroupControlGenerator, DialogService, diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts index 0072196f2..443741ff9 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts @@ -24,6 +24,7 @@ import {AaiService} from "../../../shared/services/aaiService/aai.service"; import {VrfModelInfo} from "./models/vrf/vrf.model.info"; import {NetworkStepService} from "./models/vrf/vrfModal/networkStep/network.step.service"; import {VpnStepService} from "./models/vrf/vrfModal/vpnStep/vpn.step.service"; +import { VfModuleUpgradePopupService } from "../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; @Injectable() export class ObjectToTreeService { @@ -34,6 +35,7 @@ export class ObjectToTreeService { private _vnfPopupService : VnfPopupService, private _networkPopupService : NetworkPopupService, private _vfModulePopupService : VfModulePopuopService, + private _vfModuleUpgradePopupService : VfModuleUpgradePopupService, private _vnfGroupPopupService : VnfGroupPopupService, private _duplicateService : DuplicateService, private _modalService: SdcUiServices.ModalService, @@ -52,7 +54,7 @@ export class ObjectToTreeService { * return all first optional first level of the model tree ************************************************************/ getFirstLevelOptions(): ILevelNodeInfo[] { - return [new VnfModelInfo(this._dynamicInputsService, this._sharedTreeService, this._defaultDataGeneratorService, this._dialogService, this._vnfPopupService, this._vfModulePopupService, this._duplicateService, this._modalService, this._iframeService, this._componentInfoService, this._store) + return [new VnfModelInfo(this._dynamicInputsService, this._sharedTreeService, this._defaultDataGeneratorService, this._dialogService, this._vnfPopupService, this._vfModulePopupService, this._vfModuleUpgradePopupService,this._duplicateService, this._modalService, this._iframeService, this._componentInfoService, this._store) , new NetworkModelInfo(this._dynamicInputsService, this._sharedTreeService, this._dialogService, this._networkPopupService, this._duplicateService, this._modalService, this._iframeService, this._store), new PnfModelInfo(), new VrfModelInfo(this._store, this._sharedTreeService, this._dialogService, this._iframeService, this._networkStepService, this._vpnStepService), diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts index 89e20a2d6..1412faa24 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts @@ -40,6 +40,7 @@ import {ComponentInfoModel, ComponentInfoType} from "../component-info/component import {ModelInformationItem} from "../../../shared/components/model-information/model-information.component"; import {VpnStepService} from "./models/vrf/vrfModal/vpnStep/vpn.step.service"; import {NetworkStepService} from "./models/vrf/vrfModal/networkStep/network.step.service"; +import {VfModuleUpgradePopupService} from "../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; class MockAppStore<T> { getState() { @@ -96,6 +97,7 @@ describe('Shared Tree Service', () => { NetworkPopupService, NetworkControlGenerator, VfModulePopuopService, + VfModuleUpgradePopupService, VfModuleControlGenerator, VnfGroupControlGenerator, DialogService, @@ -162,7 +164,7 @@ describe('Shared Tree Service', () => { jest.spyOn(AuditInfoModalComponent.openInstanceAuditInfoModal, 'next'); let modelInfoServiceMock: ILevelNodeInfo = new VnfModelInfo(null, null, - null, null, null, null, + null, null, null, null, null, null, null, null, null,null); const modelMock = {"a": "a"}; const instanceMock = {"instance": "instance", "trackById": "123456789"}; |