aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.spec.ts259
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.ts48
2 files changed, 204 insertions, 103 deletions
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 41ad23f07..7246adc27 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
@@ -8,7 +8,10 @@ import {DefaultDataGeneratorService} from "../../../../shared/services/defaultDa
import {DynamicInputsService} from "../dynamicInputs.service";
import {SharedTreeService} from "../shared.tree.service";
import {DrawingBoardModes} from "../../drawing-board.modes";
-import {AvailableModelsTreeService} from "../../available-models-tree/available-models-tree.service";
+import {
+ AvailableModelsTreeService,
+ AvailableNodeIcons
+} from "../../available-models-tree/available-models-tree.service";
import {DialogService} from "ng2-bootstrap-modal";
import {VnfPopupService} from "../../../../shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service";
import {BasicControlGenerator} from "../../../../shared/components/genericForm/formControlsServices/basic.control.generator";
@@ -29,12 +32,39 @@ import {VnfGroupControlGenerator} from "../../../../shared/components/genericFor
import {DuplicateService} from "../../duplicate/duplicate.service";
import {SdcUiComponentsModule} from "onap-ui-angular";
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";
class MockAppStore<T> {
getState() {
return {
global: {
'drawingBoardStatus': DrawingBoardModes.CREATE
+ },
+ service: {
+ serviceInstance: {
+ "1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd": {
+ "existingVNFCounterMap": {
+ "280dec31-f16d-488b-9668-4aae55d6648a": 1
+ }
+ }
+ },
+ serviceHierarchy: {
+ "1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd": {
+ vnfs: {
+ "2017-388_PASQUALE-vPE 1": {
+ "properties": {}
+ },
+ "2017-388_PASQUALE-vPE 0": {
+ "properties": {}
+ },
+ "2017-488_PASQUALE-vPE 0": {
+ "properties": {}
+ }
+ }
+ }
+ }
}
}
}
@@ -77,8 +107,10 @@ describe('Model Tree Generator service', () => {
DialogService,
DuplicateService,
ComponentInfoService,
+ NetworkStepService,
+ VpnStepService,
{provide: NgRedux, useClass: MockAppStore},
- MockNgRedux]
+ MockNgRedux ]
}).compileComponents();
injector = getTestBed();
@@ -90,25 +122,72 @@ describe('Model Tree Generator service', () => {
expect(service).toBeDefined();
});
- test('should return nodes correctly: VNF', () => {
+ test('calculateNumberOfNodesWithPlusIcon : should return 0 when there are no nodes', () => {
+ service.calculateNumberOfNodesWithPlusIcon("someServiceModelId", []);
+ expect(service.numberOfPlusButton).toEqual(0);
+ });
+
+ test('calculateNumberOfNodesWithPlusIcon : should return 1 there is one node with plus icon', () => {
+ const serviceModel = {
+ service: {
+ uuid: "uuid"
+ }
+ };
+ service.calculateNumberOfNodesWithPlusIcon(serviceModel, [{
+ showNodeIcons: () => {
+ return new AvailableNodeIcons(true, false)
+ }
+ }]);
+ expect(service.numberOfPlusButton).toEqual(1);
+ });
+
+ test('calculateNumberOfNodesWithPlusIcon : should return 1 there is one node with plus icon and one without', () => {
+ const serviceModel = {
+ service: {
+ uuid: "uuid"
+ }
+ };
+ service.calculateNumberOfNodesWithPlusIcon(serviceModel, [
+ {
+ showNodeIcons: () => {
+ return new AvailableNodeIcons(true, false)
+ }
+ },
+ {
+ showNodeIcons: () => {
+ return new AvailableNodeIcons(false, true)
+ }
+ }
+ ]);
+ expect(service.numberOfPlusButton).toEqual(1);
+ });
+
+ test('should return nodes correctly: VNF', () => {
let convertToNodes = service.convertServiceHierarchyModelToTreeNodes(getServiceHeirarchyVNF());
- convertToNodes.map((item) => {
- delete item['onAddClick'];
- delete item['getNodeCount'];
- delete item['showNodeIcons'];
+ convertToNodes.map((item: IModelTreeNodeModel) => {
+ delete item.onAddClick;
+ delete item.getNodeCount;
+ delete item.showNodeIcons;
+ delete item.getModel;
+ delete item.componentInfoType;
+ delete item.getMenuAction;
delete item['menuActions'];
- delete item['getMenuAction'];
delete item['trackById'];
+ delete item.getInfo;
+
if (item.children) {
item.children.map((child) => {
- delete child['onAddClick'];
- delete child['getNodeCount'];
- delete child['showNodeIcons'];
+ delete child.onAddClick;
+ delete child.getNodeCount;
+ delete child.showNodeIcons;
+ delete child.getModel;
+ delete child.componentInfoType;
+ delete child.getMenuAction;
delete child['menuActions'];
- delete child['getMenuAction'];
delete child['trackById'];
+ delete child.getInfo;
});
}
});
@@ -121,7 +200,7 @@ describe('Model Tree Generator service', () => {
return [{
"id": "280dec31-f16d-488b-9668-4aae55d6648a",
"modelVersionId": "0903e1c0-8e03-4936-b5c2-260653b96413",
- "name": "2017-388_ADIOD-vPE 1",
+ "name": "2017-388_PASQUALE-vPE 1",
"tooltip": "VF",
"type": "VF",
"count": 0,
@@ -138,7 +217,7 @@ describe('Model Tree Generator service', () => {
"modelVersionId": "afacccf6-397d-45d6-b5ae-94c39734b168",
"modelCustomizationId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c",
"modelUniqueId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c",
- "name": "2017-388_ADIOD-vPE 0",
+ "name": "2017-388_PASQUALE-vPE 0",
"tooltip": "VF",
"type": "VF",
"count": 0,
@@ -153,7 +232,7 @@ describe('Model Tree Generator service', () => {
"modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
"modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
"modelUniqueId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
- "name": "2017-488_ADIOD-vPE 0",
+ "name": "2017-488_PASQUALE-vPE 0",
"tooltip": "VF",
"type": "VF",
"count": 0,
@@ -163,7 +242,7 @@ describe('Model Tree Generator service', () => {
"modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5",
"modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
"modelUniqueId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
- "name": "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "name": "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"tooltip": "VFmodule",
"type": "VFmodule",
"count": 0,
@@ -178,7 +257,7 @@ describe('Model Tree Generator service', () => {
"modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db",
"modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
"modelUniqueId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
- "name": "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "name": "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"tooltip": "VFmodule",
"type": "VFmodule",
"count": 0,
@@ -193,7 +272,7 @@ describe('Model Tree Generator service', () => {
"modelVersionId": "0a0dd9d4-31d3-4c3a-ae89-a02f383e6a9a",
"modelCustomizationId": "3cd946bb-50e0-40d8-96d3-c9023520b557",
"modelUniqueId": "3cd946bb-50e0-40d8-96d3-c9023520b557",
- "name": "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "name": "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"tooltip": "VFmodule",
"type": "VFmodule",
"count": 0,
@@ -223,25 +302,25 @@ describe('Model Tree Generator service', () => {
"category": "Network L1-3",
"serviceType": "pnf",
"serviceRole": "Testing",
- "description": "ADIOD vMX vPE based on Juniper 17.2 release. Updated with updated VF for v8.0 of VLM",
+ "description": "PASQUALE vMX vPE based on Juniper 17.2 release. Updated with updated VF for v8.0 of VLM",
"serviceEcompNaming": "false",
"instantiationType": "Macro",
"inputs": {},
"vidNotions": {"instantiationUI": "legacy", "modelCategory": "other"}
},
"vnfs": {
- "2017-388_ADIOD-vPE 1": {
+ "2017-388_PASQUALE-vPE 1": {
"uuid": "0903e1c0-8e03-4936-b5c2-260653b96413",
"invariantUuid": "00beb8f9-6d39-452f-816d-c709b9cbb87d",
- "description": "Name ADIOD vPE Description The provider edge function for the ADIOD service supported by the Junipers VMX product Category Router Vendor Juniper Vendor Release Code 17.2 Owners Mary Fragale. Updated 9-25 to use v8.0 of the Juniper Valid 2 VLM",
- "name": "2017-388_ADIOD-vPE",
+ "description": "Name PASQUALE vPE Description The provider edge function for the PASQUALE service supported by the Junipers VMX product Category Router Vendor Juniper Vendor Release Code 17.2 Owners Mary Fragale. Updated 9-25 to use v8.0 of the Juniper Valid 2 VLM",
+ "name": "2017-388_PASQUALE-vPE",
"version": "1.0",
"customizationUuid": "280dec31-f16d-488b-9668-4aae55d6648a",
"inputs": {},
"commands": {},
"properties": {
"vmxvre_retype": "RE-VMX",
- "vnf_config_template_version": "get_input:2017488_adiodvpe0_vnf_config_template_version",
+ "vnf_config_template_version": "get_input:2017488_pasqualevpe0_vnf_config_template_version",
"sriov44_net_id": "48d399b3-11ee-48a8-94d2-f0ea94d6be8d",
"int_ctl_net_id": "2f323477-6936-4d01-ac53-d849430281d9",
"vmxvpfe_sriov41_0_port_mac": "00:11:22:EF:AC:DF",
@@ -287,7 +366,7 @@ describe('Model Tree Generator service', () => {
"vmxvpfe_sriov43_0_port_unknownmulticastallow": "true",
"vmxvre_int_ctl_ip_0": "10.0.0.10",
"ecomp_generated_naming": "true",
- "AIC_CLLI": "get_input:2017488_adiodvpe0_AIC_CLLI",
+ "AIC_CLLI": "get_input:2017488_pasqualevpe0_AIC_CLLI",
"vnf_name": "mtnj309me6vre",
"vmxvpfe_sriov41_0_port_unknownunicastallow": "true",
"vmxvre_volume_type_1": "HITACHI",
@@ -295,14 +374,14 @@ describe('Model Tree Generator service', () => {
"vmxvre_volume_type_0": "HITACHI",
"vmxvpfe_volume_type_0": "HITACHI",
"vmxvpfe_sriov43_0_port_broadcastallow": "true",
- "bandwidth_units": "get_input:2017488_adiodvpe0_bandwidth_units",
+ "bandwidth_units": "get_input:2017488_pasqualevpe0_bandwidth_units",
"vnf_id": "123",
"vmxvre_oam_prefix": "24",
"availability_zone_0": "mtpocfo-kvm-az01",
- "ASN": "get_input:2017488_adiodvpe0_ASN",
+ "ASN": "get_input:2017488_pasqualevpe0_ASN",
"vmxvre_chassis_i2cid": "161",
"vmxvpfe_name_0": "vPFEXI",
- "bandwidth": "get_input:2017488_adiodvpe0_bandwidth",
+ "bandwidth": "get_input:2017488_pasqualevpe0_bandwidth",
"availability_zone_max_count": "1",
"vmxvre_volume_size_0": "45.0",
"vmxvre_volume_size_1": "50.0",
@@ -312,7 +391,7 @@ describe('Model Tree Generator service', () => {
"vmxvre_ore_present": "0",
"vmxvre_volume_name_0": "vREXI_FBVolume",
"vmxvre_type": "0",
- "vnf_instance_name": "get_input:2017488_adiodvpe0_vnf_instance_name",
+ "vnf_instance_name": "get_input:2017488_pasqualevpe0_vnf_instance_name",
"vmxvpfe_sriov41_0_port_unknownmulticastallow": "true",
"oam_net_id": "b95eeb1d-d55d-4827-abb4-8ebb94941429",
"vmx_int_ctl_len": "24",
@@ -326,23 +405,23 @@ describe('Model Tree Generator service', () => {
"vmxvpfe_flavor_name": "ns.c20r16d25.v5"
},
"type": "VF",
- "modelCustomizationName": "2017-388_ADIOD-vPE 1",
+ "modelCustomizationName": "2017-388_PASQUALE-vPE 1",
"vfModules": {},
"volumeGroups": {},
"vfcInstanceGroups": {}
},
- "2017-388_ADIOD-vPE 0": {
+ "2017-388_PASQUALE-vPE 0": {
"uuid": "afacccf6-397d-45d6-b5ae-94c39734b168",
"invariantUuid": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
- "description": "Name ADIOD vPE Description The provider edge function for the ADIOD service supported by the Junipers VMX product Category Router Vendor Juniper Vendor Release Code 17.2 Owners Mary Fragale. Updated 9-25 to use v8.0 of the Juniper Valid 2 VLM",
- "name": "2017-388_ADIOD-vPE",
+ "description": "Name PASQUALE vPE Description The provider edge function for the PASQUALE service supported by the Junipers VMX product Category Router Vendor Juniper Vendor Release Code 17.2 Owners Mary Fragale. Updated 9-25 to use v8.0 of the Juniper Valid 2 VLM",
+ "name": "2017-388_PASQUALE-vPE",
"version": "4.0",
"customizationUuid": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c",
"inputs": {},
"commands": {},
"properties": {
"vmxvre_retype": "RE-VMX",
- "vnf_config_template_version": "get_input:2017488_adiodvpe0_vnf_config_template_version",
+ "vnf_config_template_version": "get_input:2017488_pasqualevpe0_vnf_config_template_version",
"sriov44_net_id": "48d399b3-11ee-48a8-94d2-f0ea94d6be8d",
"int_ctl_net_id": "2f323477-6936-4d01-ac53-d849430281d9",
"vmxvpfe_sriov41_0_port_mac": "00:11:22:EF:AC:DF",
@@ -388,7 +467,7 @@ describe('Model Tree Generator service', () => {
"vmxvpfe_sriov43_0_port_unknownmulticastallow": "true",
"vmxvre_int_ctl_ip_0": "10.0.0.10",
"ecomp_generated_naming": "true",
- "AIC_CLLI": "get_input:2017488_adiodvpe0_AIC_CLLI",
+ "AIC_CLLI": "get_input:2017488_pasqualevpe0_AIC_CLLI",
"vnf_name": "mtnj309me6vre",
"vmxvpfe_sriov41_0_port_unknownunicastallow": "true",
"vmxvre_volume_type_1": "HITACHI",
@@ -396,14 +475,14 @@ describe('Model Tree Generator service', () => {
"vmxvre_volume_type_0": "HITACHI",
"vmxvpfe_volume_type_0": "HITACHI",
"vmxvpfe_sriov43_0_port_broadcastallow": "true",
- "bandwidth_units": "get_input:2017488_adiodvpe0_bandwidth_units",
+ "bandwidth_units": "get_input:2017488_pasqualevpe0_bandwidth_units",
"vnf_id": "123",
"vmxvre_oam_prefix": "24",
"availability_zone_0": "mtpocfo-kvm-az01",
- "ASN": "get_input:2017488_adiodvpe0_ASN",
+ "ASN": "get_input:2017488_pasqualevpe0_ASN",
"vmxvre_chassis_i2cid": "161",
"vmxvpfe_name_0": "vPFEXI",
- "bandwidth": "get_input:2017488_adiodvpe0_bandwidth",
+ "bandwidth": "get_input:2017488_pasqualevpe0_bandwidth",
"availability_zone_max_count": "1",
"vmxvre_volume_size_0": "45.0",
"vmxvre_volume_size_1": "50.0",
@@ -413,7 +492,7 @@ describe('Model Tree Generator service', () => {
"vmxvre_ore_present": "0",
"vmxvre_volume_name_0": "vREXI_FBVolume",
"vmxvre_type": "0",
- "vnf_instance_name": "get_input:2017488_adiodvpe0_vnf_instance_name",
+ "vnf_instance_name": "get_input:2017488_pasqualevpe0_vnf_instance_name",
"vmxvpfe_sriov41_0_port_unknownmulticastallow": "true",
"oam_net_id": "b95eeb1d-d55d-4827-abb4-8ebb94941429",
"vmx_int_ctl_len": "24",
@@ -427,23 +506,23 @@ describe('Model Tree Generator service', () => {
"vmxvpfe_flavor_name": "ns.c20r16d25.v5"
},
"type": "VF",
- "modelCustomizationName": "2017-388_ADIOD-vPE 0",
+ "modelCustomizationName": "2017-388_PASQUALE-vPE 0",
"vfModules": {},
"volumeGroups": {},
"vfcInstanceGroups": {}
},
- "2017-488_ADIOD-vPE 0": {
+ "2017-488_PASQUALE-vPE 0": {
"uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
"invariantUuid": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
- "description": "Name ADIOD vPE Description The provider edge function for the ADIOD service supported by the Junipers VMX product Category Router Vendor Juniper Vendor Release Code 17.2 Owners Mary Fragale. Updated 9-25 to use v8.0 of the Juniper Valid 2 VLM",
- "name": "2017-488_ADIOD-vPE",
+ "description": "Name PASQUALE vPE Description The provider edge function for the PASQUALE service supported by the Junipers VMX product Category Router Vendor Juniper Vendor Release Code 17.2 Owners Mary Fragale. Updated 9-25 to use v8.0 of the Juniper Valid 2 VLM",
+ "name": "2017-488_PASQUALE-vPE",
"version": "5.0",
"customizationUuid": "1da7b585-5e61-4993-b95e-8e6606c81e45",
"inputs": {},
"commands": {},
"properties": {
"vmxvre_retype": "RE-VMX",
- "vnf_config_template_version": "get_input:2017488_adiodvpe0_vnf_config_template_version",
+ "vnf_config_template_version": "get_input:2017488_pasqualevpe0_vnf_config_template_version",
"sriov44_net_id": "48d399b3-11ee-48a8-94d2-f0ea94d6be8d",
"int_ctl_net_id": "2f323477-6936-4d01-ac53-d849430281d9",
"vmxvpfe_sriov41_0_port_mac": "00:11:22:EF:AC:DF",
@@ -489,7 +568,7 @@ describe('Model Tree Generator service', () => {
"vmxvpfe_sriov43_0_port_unknownmulticastallow": "true",
"vmxvre_int_ctl_ip_0": "10.0.0.10",
"ecomp_generated_naming": "true",
- "AIC_CLLI": "get_input:2017488_adiodvpe0_AIC_CLLI",
+ "AIC_CLLI": "get_input:2017488_pasqualevpe0_AIC_CLLI",
"vnf_name": "mtnj309me6vre",
"vmxvpfe_sriov41_0_port_unknownunicastallow": "true",
"vmxvre_volume_type_1": "HITACHI",
@@ -497,14 +576,14 @@ describe('Model Tree Generator service', () => {
"vmxvre_volume_type_0": "HITACHI",
"vmxvpfe_volume_type_0": "HITACHI",
"vmxvpfe_sriov43_0_port_broadcastallow": "true",
- "bandwidth_units": "get_input:2017488_adiodvpe0_bandwidth_units",
+ "bandwidth_units": "get_input:2017488_pasqualevpe0_bandwidth_units",
"vnf_id": "123",
"vmxvre_oam_prefix": "24",
"availability_zone_0": "mtpocfo-kvm-az01",
- "ASN": "get_input:2017488_adiodvpe0_ASN",
+ "ASN": "get_input:2017488_pasqualevpe0_ASN",
"vmxvre_chassis_i2cid": "161",
"vmxvpfe_name_0": "vPFEXI",
- "bandwidth": "get_input:2017488_adiodvpe0_bandwidth",
+ "bandwidth": "get_input:2017488_pasqualevpe0_bandwidth",
"availability_zone_max_count": "1",
"vmxvre_volume_size_0": "45.0",
"vmxvre_volume_size_1": "50.0",
@@ -514,7 +593,7 @@ describe('Model Tree Generator service', () => {
"vmxvre_ore_present": "0",
"vmxvre_volume_name_0": "vREXI_FBVolume",
"vmxvre_type": "0",
- "vnf_instance_name": "get_input:2017488_adiodvpe0_vnf_instance_name",
+ "vnf_instance_name": "get_input:2017488_pasqualevpe0_vnf_instance_name",
"vmxvpfe_sriov41_0_port_unknownmulticastallow": "true",
"oam_net_id": "b95eeb1d-d55d-4827-abb4-8ebb94941429",
"vmx_int_ctl_len": "24",
@@ -528,57 +607,57 @@ describe('Model Tree Generator service', () => {
"vmxvpfe_flavor_name": "ns.c20r16d25.v5"
},
"type": "VF",
- "modelCustomizationName": "2017-488_ADIOD-vPE 0",
+ "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
"vfModules": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
"uuid": "25284168-24bb-4698-8cb4-3f509146eca5",
"invariantUuid": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
"customizationUuid": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "name": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"version": "6",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"baseModule": false
},
"inputs": {},
"volumeGroupAllowed": true
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
"uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db",
"invariantUuid": "b34833bb-6aa9-4ad6-a831-70b06367a091",
"customizationUuid": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "name": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"version": "5",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"properties": {
"minCountInstances": 1,
"maxCountInstances": 1,
"initialCount": 1,
- "vfModuleLabel": "ADIOD_base_vPE_BV",
+ "vfModuleLabel": "PASQUALE_base_vPE_BV",
"baseModule": true
},
"inputs": {},
"volumeGroupAllowed": false
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vPFE_BV..module-2": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2": {
"uuid": "0a0dd9d4-31d3-4c3a-ae89-a02f383e6a9a",
"invariantUuid": "eff8cc59-53a1-4101-aed7-8cf24ecf8339",
"customizationUuid": "3cd946bb-50e0-40d8-96d3-c9023520b557",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "name": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"version": "6",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vPFE_BV",
+ "vfModuleLabel": "PASQUALE_vPFE_BV",
"baseModule": false
},
"inputs": {},
@@ -586,36 +665,36 @@ describe('Model Tree Generator service', () => {
}
},
"volumeGroups": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
"uuid": "25284168-24bb-4698-8cb4-3f509146eca5",
"invariantUuid": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
"customizationUuid": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "name": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"version": "6",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"baseModule": false
},
"inputs": {}
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vPFE_BV..module-2": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2": {
"uuid": "0a0dd9d4-31d3-4c3a-ae89-a02f383e6a9a",
"invariantUuid": "eff8cc59-53a1-4101-aed7-8cf24ecf8339",
"customizationUuid": "3cd946bb-50e0-40d8-96d3-c9023520b557",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "name": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"version": "6",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vPFE_BV",
+ "vfModuleLabel": "PASQUALE_vPFE_BV",
"baseModule": false
},
"inputs": {}
@@ -625,60 +704,60 @@ describe('Model Tree Generator service', () => {
}
},
"networks": {},
- "collectionResource": {},
+ "collectionResources": {},
"configurations": {},
"fabricConfigurations": {},
"serviceProxies": {},
"vfModules": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
"uuid": "25284168-24bb-4698-8cb4-3f509146eca5",
"invariantUuid": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
"customizationUuid": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "name": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"version": "6",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"baseModule": false
},
"inputs": {},
"volumeGroupAllowed": true
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
"uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db",
"invariantUuid": "b34833bb-6aa9-4ad6-a831-70b06367a091",
"customizationUuid": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "name": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"version": "5",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"properties": {
"minCountInstances": 1,
"maxCountInstances": 1,
"initialCount": 1,
- "vfModuleLabel": "ADIOD_base_vPE_BV",
+ "vfModuleLabel": "PASQUALE_base_vPE_BV",
"baseModule": true
},
"inputs": {},
"volumeGroupAllowed": false
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vPFE_BV..module-2": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2": {
"uuid": "0a0dd9d4-31d3-4c3a-ae89-a02f383e6a9a",
"invariantUuid": "eff8cc59-53a1-4101-aed7-8cf24ecf8339",
"customizationUuid": "3cd946bb-50e0-40d8-96d3-c9023520b557",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "name": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"version": "6",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vPFE_BV",
+ "vfModuleLabel": "PASQUALE_vPFE_BV",
"baseModule": false
},
"inputs": {},
@@ -686,36 +765,36 @@ describe('Model Tree Generator service', () => {
}
},
"volumeGroups": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
"uuid": "25284168-24bb-4698-8cb4-3f509146eca5",
"invariantUuid": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
"customizationUuid": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "name": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"version": "6",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"baseModule": false
},
"inputs": {}
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vPFE_BV..module-2": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2": {
"uuid": "0a0dd9d4-31d3-4c3a-ae89-a02f383e6a9a",
"invariantUuid": "eff8cc59-53a1-4101-aed7-8cf24ecf8339",
"customizationUuid": "3cd946bb-50e0-40d8-96d3-c9023520b557",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "name": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"version": "6",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vPFE_BV",
+ "vfModuleLabel": "PASQUALE_vPFE_BV",
"baseModule": false
},
"inputs": {}
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 e941faad3..c101f44e9 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
@@ -2,9 +2,11 @@ import {Injectable} from "@angular/core";
import {ILevelNodeInfo} from "../models/basic.model.info";
import {ObjectToTreeService} from "../objectToTree.service";
import * as _ from "lodash";
+import {IModelTreeNodeModel} from "../../../objectsToTree/objectToModelTree/modelTreeNode.model";
@Injectable()
export class ObjectToModelTreeService {
+ numberOfPlusButton: number;
constructor(private _objectToTreeService: ObjectToTreeService) {
}
@@ -21,10 +23,20 @@ export class ObjectToModelTreeService {
nodes.push(_this.addFirstLevelModel(serviceModel.service.uuid, key, item, item.type, serviceModel, option));
});
}
+
+ this.calculateNumberOfNodesWithPlusIcon(serviceModel, nodes);
+
console.log('nodes', nodes);
return nodes;
}
+ calculateNumberOfNodesWithPlusIcon(serviceModel, nodes) : void {
+ this.numberOfPlusButton = nodes.reduce((sum, node)=>{
+ let showNodeIconResult = node.showNodeIcons({data : node}, serviceModel.service.uuid);
+ return (!_.isNil(showNodeIconResult) && showNodeIconResult.addIcon && !showNodeIconResult.vIcon) ? sum + 1 : sum;
+ }, 0);
+ }
+
/***********************************************************
* return node with all his child's
@@ -50,13 +62,14 @@ export class ObjectToModelTreeService {
* @param parentNode - parent node.
************************************************************/
addNextLevelNodes(serviceId: string, currentModel, parentModel, levelNodeInfo: ILevelNodeInfo, parentNode): any[] {
- if (!_.isNil(levelNodeInfo.childName)) {
- if (!_.isNil(currentModel[levelNodeInfo.childName])) {
- let nextLevelNodeInfo = levelNodeInfo.getNextLevelObject.apply(this);
- parentNode.children = Object.keys(currentModel[levelNodeInfo.childName]).map((key) =>
- ObjectToModelTreeService.convertItemToTreeNode(serviceId, key, currentModel[levelNodeInfo.childName][key], levelNodeInfo.childName, currentModel, nextLevelNodeInfo));
-
- }
+ if (!_.isNil(levelNodeInfo.childNames) && levelNodeInfo.childNames.length > 0) {
+ levelNodeInfo.childNames.forEach(function (childName) {
+ if (!_.isNil(currentModel[childName])) {
+ let nextLevelNodeInfo = levelNodeInfo.getNextLevelObject.apply(this, [childName]);
+ parentNode.children = Object.keys(currentModel[childName]).map((key) =>
+ ObjectToModelTreeService.convertItemToTreeNode(serviceId, key, currentModel[childName][key], childName, currentModel, nextLevelNodeInfo));
+ }
+ })
}
return parentNode.children;
}
@@ -72,7 +85,7 @@ export class ObjectToModelTreeService {
* @param levelNodeInfo - current levelNodeInfo object
************************************************************/
static convertItemToTreeNode(serviceId: string, name: string, currentModel: any, valueType: string, parentModel: string, levelNodeInfo: ILevelNodeInfo) {
- let node = {
+ let node : IModelTreeNodeModel = {
id: currentModel.customizationUuid || currentModel.uuid,
modelCustomizationId : currentModel.customizationUuid,
modelVersionId: currentModel.uuid,
@@ -88,11 +101,20 @@ export class ObjectToModelTreeService {
isEcompGeneratedNaming: levelNodeInfo.isEcompGeneratedNaming(currentModel, parentModel)
};
- node['onAddClick'] = (node, serviceId) => levelNodeInfo.onClickAdd(node, serviceId);
- node['getNodeCount'] = (node, serviceId) => levelNodeInfo.getNodeCount(node, serviceId);
- node['getMenuAction'] = (node, serviceId) => levelNodeInfo.getMenuAction(node, serviceId);
- node['showNodeIcons'] = (node, serviceId) => levelNodeInfo.showNodeIcons(node, serviceId);
- node['typeName'] = levelNodeInfo['typeName'];
+ node = this.addExtraFunctionality(node, serviceId, name, currentModel, valueType, parentModel, levelNodeInfo);
+ return node;
+ }
+
+
+ static addExtraFunctionality(node, serviceId: string, name: string, currentModel: any, valueType: string, parentModel: string, levelNodeInfo: ILevelNodeInfo){
+ node.onAddClick = (node, serviceId) => levelNodeInfo.onClickAdd(node, serviceId);
+ node.getNodeCount = (node, serviceId) => levelNodeInfo.getNodeCount(node, serviceId);
+ node.getMenuAction = (node, serviceId) => levelNodeInfo.getMenuAction(node, serviceId);
+ node.showNodeIcons = (node, serviceId) => levelNodeInfo.showNodeIcons(node, serviceId);
+ node.typeName = levelNodeInfo.typeName;
+ node.getModel = levelNodeInfo.getModel.bind(levelNodeInfo);
+ node.getInfo = !_.isNil(levelNodeInfo.getInfo) ? levelNodeInfo.getInfo.bind(levelNodeInfo) : ()=>{};
+ node.componentInfoType = levelNodeInfo.componentInfoType;
return node;
}
}