diff options
author | 2019-12-26 15:21:17 +0200 | |
---|---|---|
committer | 2019-12-30 06:18:18 +0200 | |
commit | 18c3ce8d1e1d166d5302f9708036202b0258110e (patch) | |
tree | fcbcf8f2c90472d538177cb5e359b17e7b757493 /vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts | |
parent | a371bcd5601df09063af5a00b1579ce197690bfd (diff) |
Fixing the issue which prevents from clicking the [+] button on templates
i) Use modelUniqueName instead of obsolete originalName
ii) Add RECREATE as "editable" case
iii) Lift vfModules limitation in model to 3
Issue-ID: VID-724
Change-Id: I9e55142ee379f4eead3c8634f5b816d2d1db1f8e
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts')
-rw-r--r-- | vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts | 28 |
1 files changed, 20 insertions, 8 deletions
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 73f35279f..36b5ed072 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 @@ -8,7 +8,10 @@ import {VfModuleInstance} from "../../../../../shared/models/vfModuleInstance"; import {VfModule} from "../../../../../shared/models/vfModule"; import {NgRedux} from "@angular-redux/store"; import {ITreeNode} from "angular-tree-component/dist/defs/api"; -import {GenericFormPopupComponent, PopupType} from "../../../../../shared/components/genericFormPopup/generic-form-popup.component"; +import { + GenericFormPopupComponent, + PopupType +} from "../../../../../shared/components/genericFormPopup/generic-form-popup.component"; import {DialogService} from "ng2-bootstrap-modal"; import {VfModulePopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service"; import {AppState} from "../../../../../shared/store/reducers"; @@ -16,7 +19,15 @@ import {MessageBoxData} from "../../../../../shared/components/messageBox/messag import {MessageBoxService} from "../../../../../shared/components/messageBox/messageBox.service"; import {AvailableNodeIcons} from "../../../available-models-tree/available-models-tree.service"; import {IframeService} from "../../../../../shared/utils/iframe.service"; -import {deleteActionVfModuleInstance, deleteVFModuleField, removeVfModuleInstance, undoDeleteVfModuleInstance, undoUgradeVFModule, updateVFModulePosition, upgradeVFModule} from "../../../../../shared/storeUtil/utils/vfModule/vfModule.actions"; +import { + deleteActionVfModuleInstance, + deleteVFModuleField, + removeVfModuleInstance, + undoDeleteVfModuleInstance, + undoUgradeVFModule, + updateVFModulePosition, + upgradeVFModule +} from "../../../../../shared/storeUtil/utils/vfModule/vfModule.actions"; 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"; @@ -166,7 +177,7 @@ export class VFModuleModelInfo implements ILevelNodeInfo { getDefaultVNF(node: ITreeNode, serviceModelId: string): string { let keys = _.keys(_.pickBy(this._store.getState().service.serviceInstance[serviceModelId].vnfs, vnf => { - return (vnf.originalName == node.data.name); + return (this._sharedTreeService.modelUniqueId(vnf) === node.data.modelUniqueId); })); return keys.length === 1 ? this._store.getState().service.serviceInstance[serviceModelId].vnfs[keys[0]].vnfStoreKey : null; } @@ -198,7 +209,7 @@ export class VFModuleModelInfo implements ILevelNodeInfo { let count = 0; for (let vfModuleKey in vnf['vfModules']) { for (let vfModule in vnf['vfModules'][vfModuleKey]) { - if (vnf['vfModules'][vfModuleKey][vfModule]['modelInfo'].modelCustomizationId === node.data.modelUniqueId) { + if (this._sharedTreeService.modelUniqueId(vnf['vfModules'][vfModuleKey][vfModule]) === node.data.modelUniqueId) { const vfModuleObj = vnf['vfModules'][vfModuleKey][vfModule]; if (!(!_.isNil(vfModuleObj) && !_.isNil(vfModuleObj.action) && vfModuleObj.action.split('_').pop() === 'Delete')) count++; } @@ -228,7 +239,7 @@ export class VFModuleModelInfo implements ILevelNodeInfo { if (selectedVNF) { return this.showVFModuleOnSelectedVNF(node, selectedVNF, serviceModelId); } else { - const optionalSelected = this.getOptionalVNFs(serviceModelId, node.parent.data.name); + const optionalSelected = this.getOptionalVNFs(serviceModelId, node.parent.data.modelUniqueId); if (optionalSelected.length === 1) { return this.showVFModuleOnSelectedVNF(node, optionalSelected[0].vnfStoreKey, serviceModelId); } else { @@ -239,7 +250,8 @@ export class VFModuleModelInfo implements ILevelNodeInfo { showVFModuleOnSelectedVNF(node: ITreeNode, selectedVNF: string, serviceModelId: string): AvailableNodeIcons { - if (!_.isNil(this._store.getState().service.serviceInstance[serviceModelId].vnfs[selectedVNF]) && node.parent.data.name === this._store.getState().service.serviceInstance[serviceModelId].vnfs[selectedVNF].originalName) { + if (!_.isNil(this._store.getState().service.serviceInstance[serviceModelId].vnfs[selectedVNF]) + && node.parent.data.modelUniqueId === this._sharedTreeService.modelUniqueId(this._store.getState().service.serviceInstance[serviceModelId].vnfs[selectedVNF])) { 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; @@ -249,12 +261,12 @@ export class VFModuleModelInfo implements ILevelNodeInfo { } - getOptionalVNFs(serviceUUID: string, vnfOriginalModelName: string): any[] { + getOptionalVNFs(serviceUUID: string, vnfModelUniqueId: string): any[] { let result = []; if (!_.isNil(this._store.getState().service.serviceInstance) && !_.isNil(this._store.getState().service.serviceInstance[serviceUUID])) { const serviceVNFsInstances = this._store.getState().service.serviceInstance[serviceUUID].vnfs; for (let vnfKey in serviceVNFsInstances) { - if (serviceVNFsInstances[vnfKey].originalName === vnfOriginalModelName) { + if (this._sharedTreeService.modelUniqueId(serviceVNFsInstances[vnfKey]) === vnfModelUniqueId) { serviceVNFsInstances[vnfKey].vnfStoreKey = vnfKey; result.push(serviceVNFsInstances[vnfKey]); } |