From 0a268267af54b1b187591bf45c3ca43a89db3195 Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Sun, 15 Dec 2019 10:03:03 +0200 Subject: when there is no max instances for VfModule/Network show Unlimited (default) in component info Issue-ID: VID-726 Change-Id: Ic296de9ba2c8d25a7b5f3bd789ffb5fdef0329d0 Signed-off-by: Eylon Malin --- .../models/network/network.model.info.spec.ts | 10 ++++++++- .../models/network/network.model.info.ts | 24 ++++++++++------------ .../models/vfModule/vfModule.model.info.spec.ts | 2 +- .../models/vfModule/vfModule.model.info.ts | 2 +- .../objectsToTree/models/vnf/vnf.model.info.ts | 4 +--- 5 files changed, 23 insertions(+), 19 deletions(-) (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models') diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.spec.ts index 089f812a7..f26ab0cf1 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.spec.ts @@ -311,13 +311,21 @@ describe('Network Model Info', () => { const instance = getNetworkInstance(); let actualNetworkInfo = networkModel.getInfo(model, instance); let expectedNetworkInfo = [ + ModelInformationItem.createInstance("Min instances", "0"), + ModelInformationItem.createInstance("Max instances", "1"), ModelInformationItem.createInstance('Network role', "network role 1, network role 2"), ModelInformationItem.createInstance("Route target id", null), - ModelInformationItem.createInstance("Route target role", null) + ModelInformationItem.createInstance("Route target role", null), ]; expect(actualNetworkInfo).toEqual(expectedNetworkInfo); }); + test('When there is no max Max instances text is: Unlimited (default)', () => { + let actualVNFInfo = networkModel.getInfo({just:"not empty"},null); + const maxInstancesItem = actualVNFInfo.find((item)=> item.label == 'Max instances'); + expect(maxInstancesItem.values[0]).toEqual('Unlimited (default)'); + }); + function getNetworkModel() { return { "customizationUuid": "94fdd893-4a36-4d70-b16a-ec29c54c184f", diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts index 3ba4a2c4b..486ac93c0 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts @@ -7,10 +7,7 @@ import {SharedTreeService} from "../../shared.tree.service"; import {InputType} from "../../../../../shared/models/inputTypes"; import {NgRedux} from "@angular-redux/store"; import {AppState} from "../../../../../shared/store/reducers"; -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 {NetworkPopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/network/network.popup.service"; import * as _ from "lodash"; @@ -22,11 +19,7 @@ import {IframeService} from "../../../../../shared/utils/iframe.service"; import {SdcUiServices} from "onap-ui-angular"; import {DuplicateService} from "../../../duplicate/duplicate.service"; import {ServiceInstanceActions} from "../../../../../shared/models/serviceInstanceActions"; -import { - deleteActionNetworkInstance, - undoDeleteActionNetworkInstance, - updateNetworkPosition -} from "../../../../../shared/storeUtil/utils/network/network.actions"; +import {deleteActionNetworkInstance, undoDeleteActionNetworkInstance, updateNetworkPosition} from "../../../../../shared/storeUtil/utils/network/network.actions"; import {IModalConfig} from "onap-ui-angular/dist/modals/models/modal-config"; import {ComponentInfoType} from "../../../component-info/component-info-model"; import {ModelInformationItem} from "../../../../../shared/components/model-information/model-information.component"; @@ -265,10 +258,15 @@ export class NetworkModelInfo implements ILevelNodeInfo { } getInfo(model, instance): ModelInformationItem[] { - const modelInformation = !_.isEmpty(model) && !_.isEmpty(model.properties) ? [ - ModelInformationItem.createInstance("Network role", model.properties.network_role)] : []; - ModelInformationItem.createInstance("Min instances", !_.isNull(model.min) ? String(model.min) : null), - ModelInformationItem.createInstance("Max instances", !_.isNull(model.max) ? String(model.max) : null) + const modelInformation = !_.isEmpty(model) ? [ + ModelInformationItem.createInstance("Min instances", !_.isNull(model.min) ? String(model.min) : null), + this._sharedTreeService.createMaximumToInstantiateModelInformationItem(model) + ] : []; + + if (!_.isEmpty(model) && !_.isEmpty(model.properties)) { + modelInformation.push(ModelInformationItem.createInstance("Network role", model.properties.network_role)) + } + const instanceInfo = !_.isEmpty(instance) ? [ ModelInformationItem.createInstance("Route target id", instance.routeTargetId ? instance.routeTargetId : null), ModelInformationItem.createInstance("Route target role", instance.routeTargetRole ? instance.routeTargetRole : null)] : 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 276c0aeb2..85e57613a 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 @@ -477,7 +477,7 @@ describe('VFModule Model Info', () => { let expectedVNFInfo = [ ModelInformationItem.createInstance('Base module', false), ModelInformationItem.createInstance('Min instances', "0"), - ModelInformationItem.createInstance("Max instances", null), + ModelInformationItem.createInstance("Max instances", 'Unlimited (default)'), ModelInformationItem.createInstance('Initial instances count',"0") ]; expect(actualVNFInfo).toEqual(expectedVNFInfo); 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 1ce452793..1e4a22c45 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 @@ -418,7 +418,7 @@ export class VFModuleModelInfo implements ILevelNodeInfo { 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), + this._sharedTreeService.createMaximumToInstantiateModelInformationItem(model), ModelInformationItem.createInstance("Initial instances count", !_.isNull(model.properties.initialCount) ? String(model.properties.initialCount) : null) ] : []; 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 ff86925f1..a5a85c41a 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 @@ -31,7 +31,6 @@ import {ComponentInfoService} from "../../../component-info/component-info.servi import {ModelInformationItem} from "../../../../../shared/components/model-information/model-information.component"; import {VfModuleUpgradePopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service"; import {FeatureFlagsService} from "../../../../../shared/services/featureFlag/feature-flags.service"; -import {Constants} from "../../../../../shared/utils/constants"; export class VnfModelInfo implements ILevelNodeInfo { constructor(private _dynamicInputsService: DynamicInputsService, @@ -319,8 +318,7 @@ export class VnfModelInfo implements ILevelNodeInfo { getInfo(model, instance): ModelInformationItem[] { const modelInformation = !_.isEmpty(model) ? [ ModelInformationItem.createInstance("Min instances", !_.isNil(model.min) ? String(model.min) : null), - ModelInformationItem.createInstance("Max instances", !_.isNil(model.max) ? String(model.max) : - Constants.ModelInfo.UNLIMITED_DEFAULT) + this._sharedTreeService.createMaximumToInstantiateModelInformationItem(model) ] : []; const instanceInfo = !_.isEmpty(instance) ? [ -- cgit 1.2.3-korg