diff options
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning')
10 files changed, 193 insertions, 26 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.extended.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.extended.ts new file mode 100644 index 000000000..e2e31e904 --- /dev/null +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.extended.ts @@ -0,0 +1,138 @@ +import {ILevelNodeInfo} from "../basic.model.info"; +import {ComponentInfoType} from "../../../component-info/component-info-model"; +import {ModelInformationItem} from "../../../../../shared/components/model-information/model-information.component"; +import {ITreeNode} from "angular-tree-component/dist/defs/api"; +import {AvailableNodeIcons} from "../../../available-models-tree/available-models-tree.service"; + +import {PNFModel} from "../../../../../shared/models/pnfModel"; +import {SharedTreeService} from "../../shared.tree.service"; +import * as _ from "lodash"; +import {FeatureFlagsService} from "../../../../../shared/services/featureFlag/feature-flags.service"; +import {NgRedux} from "@angular-redux/store"; +import {AppState} from "../../../../../shared/store/reducers"; +import { + GenericFormPopupComponent, + PopupType +} from "../../../../../shared/components/genericFormPopup/generic-form-popup.component"; +import {DialogService} from "ng2-bootstrap-modal"; +import {PnfPopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/pnf/pnf.popup.service"; +import {PnfTreeNode} from "../../../../../shared/models/pnfTreeNode"; + + +export class PnfModelInfoExtended implements ILevelNodeInfo{ + + constructor( + private _store: NgRedux<AppState>, + private _sharedTreeService: SharedTreeService, + private _dialogService: DialogService, + private _pnfPopupService: PnfPopupService + ){} + + name: string = 'pnfs'; + type: string ='PNF'; + typeName: string = 'PNF'; + childNames: string[]; + componentInfoType = ComponentInfoType.PNF; + + createInstanceTreeNode = (instance: any, model: any, parentModel: any, storeKey: string, serviceModelId: string): any => { + let node = new PnfTreeNode(instance, model, storeKey); + node.missingData = this.hasMissingData(instance, node, model.isEcompGeneratedNaming); + node.typeName = this.typeName; + node.menuActions = this.getMenuAction(<any>node, serviceModelId); + node.isFailed = _.isNil(instance.isFailed) ? false : instance.isFailed; + node.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage : ""; + node = this._sharedTreeService.addingStatusProperty(node); + return node; + }; + + getInfo(model, instance): ModelInformationItem[] { + const modelInformation = !_.isEmpty(model) ? [ + ModelInformationItem.createInstance("Min instances", !_.isNil(model.min) ? String(model.min) : null), + this._sharedTreeService.createMaximumToInstantiateModelInformationItem(model) + ] : []; + + const instanceInfo = !_.isEmpty(instance) ? [ + ModelInformationItem.createInstance("NF type", instance.nfType), + ModelInformationItem.createInstance("NF role", instance.nfRole) + ] : []; + + const result = [modelInformation, instanceInfo]; + return _.uniq(_.flatten(result)); + } + + getMenuAction(node: ITreeNode, serviceModelId: string): { [methodName: string]: { method: Function; visible: Function; enable: Function } } { + return {}; + } + + getModel = (instanceModel: any): PNFModel => { + return new PNFModel(instanceModel); + }; + + getNextLevelObject(): any { return null; } + + getNodeCount(node: ITreeNode, serviceModelId: string): number { + let map = null; + if (!_.isNil(this._store.getState().service.serviceInstance[serviceModelId])) { + map = this._store.getState().service.serviceInstance[serviceModelId].existingPNFCounterMap || 0; + + if (!_.isNil(map)) { + let count = map[node.data.modelUniqueId] || 0; + count -= this._sharedTreeService.getExistingInstancesWithDeleteMode(node, serviceModelId, 'pnfs'); + return count; + } + } + return 0; + } + + getNodePosition(instance): number { + return !_.isNil(instance) ? instance.position : null; + } + + getTooltip = (): string => 'PNF'; + + + getType = (): string => 'PNF'; + + + hasMissingData(instance, dynamicInputs: any, isEcompGeneratedNaming: boolean): boolean { + return false; + } + + isEcompGeneratedNaming(currentModel): boolean { + return false; + } + + onClickAdd(node, serviceModelId: string): void { + this._dialogService.addDialog(GenericFormPopupComponent, { + type: PopupType.PNF, + uuidData: <any>{ + serviceId: serviceModelId, + modelName: node.data.name, + pnfStoreKey: null, + modelId: node.data.modelVersionId, + type: node.data.type, + popupService: this._pnfPopupService + }, + node: node, + isUpdateMode: false + }) + } + + showNodeIcons(node: ITreeNode, serviceModelId: string): AvailableNodeIcons { + let counter: number = !_.isNil(this._store.getState().service.serviceInstance[serviceModelId]) ? + (this._store.getState().service.serviceInstance[serviceModelId].existingPNFCounterMap[node.data.modelUniqueId] || 0) : 0; + counter -= this._sharedTreeService.getExistingInstancesWithDeleteMode(node, serviceModelId, 'pnfs'); + + const properties = this._store.getState().service.serviceHierarchy[serviceModelId].pnfs[node.data.name].properties; + const flags = FeatureFlagsService.getAllFlags(this._store); + const isReachedLimit: boolean = this._sharedTreeService.isReachedToMaxInstances(properties, counter, flags); + const showAddIcon = this._sharedTreeService.shouldShowAddIcon() && !isReachedLimit; + return new AvailableNodeIcons(showAddIcon, isReachedLimit) + } + + updateDynamicInputsDataFromModel = (currentModel): any => []; + + updatePosition(that, node, instanceId): void { + } + +} 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 8073d1727..6cc31ad57 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 @@ -14,6 +14,7 @@ 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"; +import {PnfPopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/pnf/pnf.popup.service"; class MockAppStore<T> { @@ -41,6 +42,7 @@ describe('Related Vnf member Model Info', () => { VfModulePopupService, VfModuleUpgradePopupService, VnfPopupService, + PnfPopupService, DefaultDataGeneratorService, SharedTreeService, DuplicateService, 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 53aedddcb..1a31a21f1 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 @@ -23,6 +23,7 @@ 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"; +import { PnfPopupService } from "../../../../../shared/components/genericFormPopup/genericFormServices/pnf/pnf.popup.service"; class MockFeatureFlagsService extends FeatureFlagsService{ getAllFlags(): { [p: string]: boolean } { @@ -58,6 +59,7 @@ describe('Vnf Model Info', () => { VfModulePopupService, VfModuleUpgradePopupService, VnfPopupService, + PnfPopupService, DefaultDataGeneratorService, SharedTreeService, DuplicateService, 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 f8a738ac7..32b8d6bac 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 @@ -36,6 +36,7 @@ import {VfModuleUpgradePopupService} from "../../../../shared/components/generic import {SharedControllersService} from "../../../../shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service"; import {ModalService} from "../../../../shared/components/customModal/services/modal.service"; import {CreateDynamicComponentService} from "../../../../shared/components/customModal/services/create-dynamic-component.service"; +import {PnfPopupService} from "../../../../shared/components/genericFormPopup/genericFormServices/pnf/pnf.popup.service"; class MockAppStore<T> { getState() { @@ -67,6 +68,7 @@ describe('Model Tree Generator service', () => { DynamicInputsService, SharedTreeService, VnfPopupService, + PnfPopupService, VnfGroupPopupService, ControlGeneratorUtil, SharedControllersService, diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.ts index 13dca560c..cabf80664 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.ts @@ -37,7 +37,7 @@ export class ObjectToInstanceTreeService { this.numberOfElements = 0; let _this = this; const serviceModelId:string = serviceInstance.modelInfo.modelVersionId; - const firstLevelOptions: ILevelNodeInfo[] = _this._objectToTreeService.getFirstLevelOptions(); + const firstLevelOptions: ILevelNodeInfo[] = _this._objectToTreeService.getFirstLevelOptions(serviceInstance.isAlaCarte); for (let option of firstLevelOptions) { _.forOwn(serviceInstance[option.name], function (instance, modelName) { nodes.push(_this.getNodeInstance(modelName, null, instance, serviceHierarchy, option, serviceModelId)); 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 7fa679bb5..8d4dbc4bb 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 @@ -39,6 +39,7 @@ import {VfModuleUpgradePopupService} from "../../../../shared/components/generic import {SharedControllersService} from "../../../../shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service"; import {ModalService} from "../../../../shared/components/customModal/services/modal.service"; import {CreateDynamicComponentService} from "../../../../shared/components/customModal/services/create-dynamic-component.service"; +import {PnfPopupService} from "../../../../shared/components/genericFormPopup/genericFormServices/pnf/pnf.popup.service"; class MockAppStore<T> { getState() { @@ -92,6 +93,7 @@ describe('Model Tree Generator service', () => { SharedTreeService, DialogService, VnfPopupService, + PnfPopupService, VnfGroupPopupService, ControlGeneratorUtil, GenericFormService, diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.ts index c3c8fa1b3..e769a1333 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.ts @@ -18,7 +18,8 @@ export class ObjectToModelTreeService { ************************************************************/ convertServiceHierarchyModelToTreeNodes(serviceModel): any[] { let _this = this; - const firstLevelOptions: ILevelNodeInfo[] = _this._objectToTreeService.getFirstLevelOptions(); + let isALaCarte = serviceModel.service.vidNotions.instantiationType === "ALaCarte"; + const firstLevelOptions: ILevelNodeInfo[] = _this._objectToTreeService.getFirstLevelOptions(isALaCarte); let nodes = []; let flags = this._featureFlagsService.getAllFlags(); for (let option of firstLevelOptions) { 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 a70b7efeb..67a962e8a 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,42 +24,55 @@ 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"; -import {FeatureFlagsService} from "../../../shared/services/featureFlag/feature-flags.service"; +import {FeatureFlagsService, Features} from "../../../shared/services/featureFlag/feature-flags.service"; import {ModalService} from "../../../shared/components/customModal/services/modal.service"; +import {PnfPopupService} from "../../../shared/components/genericFormPopup/genericFormServices/pnf/pnf.popup.service"; +import {PnfModelInfoExtended} from "./models/pnf/pnf.model.info.extended"; @Injectable() export class ObjectToTreeService { constructor(private _defaultDataGeneratorService: DefaultDataGeneratorService, private _dynamicInputsService: DynamicInputsService, - private _sharedTreeService : SharedTreeService, - private _dialogService : DialogService, - private _vnfPopupService : VnfPopupService, - private _networkPopupService : NetworkPopupService, - private _vfModulePopupService : VfModulePopupService, - private _vfModuleUpgradePopupService : VfModuleUpgradePopupService, - private _vnfGroupPopupService : VnfGroupPopupService, - private _duplicateService : DuplicateService, + private _sharedTreeService: SharedTreeService, + private _dialogService: DialogService, + private _vnfPopupService: VnfPopupService, + private _pnfPopupService: PnfPopupService, + private _networkPopupService: NetworkPopupService, + private _vfModulePopupService: VfModulePopupService, + private _vfModuleUpgradePopupService: VfModuleUpgradePopupService, + private _vnfGroupPopupService: VnfGroupPopupService, + private _duplicateService: DuplicateService, private _modalService: ModalService, - private _iframeService : IframeService, - private _componentInfoService : ComponentInfoService, - private _networkStepService : NetworkStepService, - private _vpnStepService : VpnStepService, - private _aaiService : AaiService, + private _iframeService: IframeService, + private _componentInfoService: ComponentInfoService, + private _networkStepService: NetworkStepService, + private _vpnStepService: VpnStepService, + private _aaiService: AaiService, private _featureFlagsService: FeatureFlagsService, - private _store : NgRedux<AppState>) { + private _store: NgRedux<AppState>) { } /*********************************************************** * 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._vfModuleUpgradePopupService,this._duplicateService, this._modalService, this._iframeService, this._componentInfoService, this._featureFlagsService, this._store) - , new NetworkModelInfo(this._dynamicInputsService, this._sharedTreeService, this._dialogService, this._networkPopupService, this._duplicateService, this._modalService, this._iframeService, this._featureFlagsService, this._store), - new PnfModelInfo(this._sharedTreeService), - new VrfModelInfo(this._store, this._sharedTreeService, this._dialogService, this._iframeService, this._featureFlagsService, this._networkStepService, this._vpnStepService), - new CollectionResourceModelInfo(this._store, this._sharedTreeService), - new ConfigurationModelInfo(this._dynamicInputsService, this._sharedTreeService), - new VnfGroupingModelInfo(this._dynamicInputsService, this._sharedTreeService, this._dialogService, this._vnfGroupPopupService, this._iframeService, this._aaiService, this._store)]; - }; + getFirstLevelOptions(isALaCarte: boolean): ILevelNodeInfo[] { + if (FeatureFlagsService.getFlagState(Features.FLAG_EXTENDED_MACRO_PNF_CONFIG, this._store) === true && isALaCarte === false) { + 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._featureFlagsService, this._store) + , new NetworkModelInfo(this._dynamicInputsService, this._sharedTreeService, this._dialogService, this._networkPopupService, this._duplicateService, this._modalService, this._iframeService, this._featureFlagsService, this._store), + new PnfModelInfoExtended(this._store, this._sharedTreeService, this._dialogService, this._pnfPopupService), + new VrfModelInfo(this._store, this._sharedTreeService, this._dialogService, this._iframeService, this._featureFlagsService, this._networkStepService, this._vpnStepService), + new CollectionResourceModelInfo(this._store, this._sharedTreeService), + new ConfigurationModelInfo(this._dynamicInputsService, this._sharedTreeService), + new VnfGroupingModelInfo(this._dynamicInputsService, this._sharedTreeService, this._dialogService, this._vnfGroupPopupService, this._iframeService, this._aaiService, this._store)]; + } else { + 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._featureFlagsService, this._store) + , new NetworkModelInfo(this._dynamicInputsService, this._sharedTreeService, this._dialogService, this._networkPopupService, this._duplicateService, this._modalService, this._iframeService, this._featureFlagsService, this._store), + new PnfModelInfo(this._sharedTreeService), + new VrfModelInfo(this._store, this._sharedTreeService, this._dialogService, this._iframeService, this._featureFlagsService, this._networkStepService, this._vpnStepService), + new CollectionResourceModelInfo(this._store, this._sharedTreeService), + new ConfigurationModelInfo(this._dynamicInputsService, this._sharedTreeService), + new VnfGroupingModelInfo(this._dynamicInputsService, this._sharedTreeService, this._dialogService, this._vnfGroupPopupService, this._iframeService, this._aaiService, this._store)]; + } + } } 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 60f59de4c..9a35d4883 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 @@ -44,6 +44,7 @@ import {VfModuleUpgradePopupService} from "../../../shared/components/genericFor import {SharedControllersService} from "../../../shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service"; import {ModalService} from "../../../shared/components/customModal/services/modal.service"; import {CreateDynamicComponentService} from "../../../shared/components/customModal/services/create-dynamic-component.service"; +import { PnfPopupService } from "../../../shared/components/genericFormPopup/genericFormServices/pnf/pnf.popup.service"; class MockAppStore<T> { getState() { @@ -91,6 +92,7 @@ describe('Shared Tree Service', () => { DefaultDataGeneratorService, DialogService, VnfPopupService, + PnfPopupService, ControlGeneratorUtil, AaiService, LogService, diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/typeNodeInformation.model.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/typeNodeInformation.model.ts index e8e22a422..78a963a07 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/typeNodeInformation.model.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/typeNodeInformation.model.ts @@ -13,6 +13,11 @@ export class TypeNodeInformation { this.existingMappingCounterName = 'existingVNFCounterMap'; break; } + case 'PNF' : { + this.hierarchyName = 'pnfs'; + this.existingMappingCounterName = 'existingPNFCounterMap'; + break; + } case 'VnfGroup' : { this.hierarchyName = 'vnfGroups'; this.existingMappingCounterName = 'existingVnfGroupCounterMap'; |