summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-12-15 14:50:18 +0000
committerGerrit Code Review <gerrit@onap.org>2019-12-15 14:50:18 +0000
commit73e153974e4f5a7dc4a60f5612fd30ca6a47dee0 (patch)
tree041fd09309cdb4a10657fde3a48e0693515b3f7c /vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree
parent9c100d6c298af429b182b55f2b06d096461e0b97 (diff)
parent0a268267af54b1b187591bf45c3ca43a89db3195 (diff)
Merge "when there is no max instances for VfModule/Network show Unlimited (default) in component info"
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.spec.ts10
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts24
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts2
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts2
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts4
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts8
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts8
7 files changed, 39 insertions, 19 deletions
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) ? [
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 b330b72dc..504dc86bd 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
@@ -186,6 +186,14 @@ describe('Shared Tree Service', () => {
"type": instanceTypeMock
});
});
+ each([
+ ['undefined', 'Unlimited (default)', {}],
+ ['null', 'Unlimited (default)', {max:null}],
+ ['3', '3', {max:3}],
+ ]).
+ test("when there is %s max instances in model , shell return %s text", (desc, expected, model) =>{
+ expect(service.createMaximumToInstantiateModelInformationItem(model).values[0]).toBe(expected);
+ });
test('shouldShowDeleteInstanceWithChildrfenModal should not open modal if all childs with action None', () => {
let foo = () => {
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
index b8eddbbf7..7f5b6e33c 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
@@ -14,6 +14,7 @@ import {undoUpgradeService, upgradeService} from "../../../shared/storeUtil/util
import {VNFMethods} from "../../../shared/storeUtil/utils/vnf/vnf.actions";
import {FeatureFlagsService, Features} from "../../../shared/services/featureFlag/feature-flags.service";
import {Utils} from "../../../shared/utils/utils";
+import {Constants} from "../../../shared/utils/constants";
@Injectable()
export class SharedTreeService {
@@ -368,4 +369,11 @@ export class SharedTreeService {
const modelInfoItemsWithoutEmpty = _.filter(modelInfoItems, function(item){ return !item.values.every(_.isNil)});
return new ComponentInfoModel(type, modelInfoItemsWithoutEmpty, [], instance != null);
}
+
+ createMaximumToInstantiateModelInformationItem(model): ModelInformationItem {
+ return ModelInformationItem.createInstance(
+ "Max instances",
+ !_.isNil(model.max) ? String(model.max) : Constants.ModelInfo.UNLIMITED_DEFAULT
+ );
+ }
}