From 82e531a1ee8ffa30e80b27d9097a2272ae18cdee Mon Sep 17 00:00:00 2001 From: Mojahidul Islam Date: Tue, 14 May 2019 12:49:31 +0530 Subject: Support Capability Properties This change includes following changes 1. Get capability properties from global types- BE 2. Show capability properties in cap/req screen 3. Support Capability Properties in assingment, operation and consumption screens Change-Id: Ieb4fa5705007c8bed3d82eb4fe4604572aa202d7 Issue-ID: SDC-2294 Signed-off-by: Mojahidul Islam --- .../service-consumption.component.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'catalog-ui/src/app/ng2/components/logic') diff --git a/catalog-ui/src/app/ng2/components/logic/service-consumption/service-consumption.component.ts b/catalog-ui/src/app/ng2/components/logic/service-consumption/service-consumption.component.ts index ef8d63df97..ebcf9eba22 100644 --- a/catalog-ui/src/app/ng2/components/logic/service-consumption/service-consumption.component.ts +++ b/catalog-ui/src/app/ng2/components/logic/service-consumption/service-consumption.component.ts @@ -29,7 +29,9 @@ import { PropertyFEModel, PropertyBEModel, InputBEModel, - InterfaceModel + InterfaceModel, + CapabilitiesGroup, + Capability } from 'app/models'; import {ServiceConsumptionCreatorComponent} from 'app/ng2/pages/service-consumption-editor/service-consumption-editor.component'; @@ -59,6 +61,7 @@ export class ConsumptionInputDetails extends ConsumptionInput { assignValueLabel: string; associatedProps: Array; associatedInterfaces: Array; + associatedCapabilities: Array; origVal: string; isValid: boolean; @@ -70,6 +73,7 @@ export class ConsumptionInputDetails extends ConsumptionInput { this.assignValueLabel = input.assignValueLabel; this.associatedProps = input.associatedProps; this.associatedInterfaces = input.associatedInterfaces; + this.associatedCapabilities = input.associatedCapabilities; this.origVal = input.value || ""; this.isValid = input.isValid; } @@ -128,15 +132,18 @@ export class ServiceConsumptionComponent { @Input() selectedService: Service; @Input() selectedServiceInstanceId: string; @Input() instancesMappedList: Array; + @Input() instancesCapabilitiesMap: Map>; @Input() readonly: boolean; selectedInstanceSiblings: Array; selectedInstancePropertiesList: Array = []; + selectedInstanceCapabilitisList: Array = []; constructor(private ModalServiceNg2: ModalService, private serviceServiceNg2: ServiceServiceNg2, private componentServiceNg2: ComponentServiceNg2, private componentInstanceServiceNg2:ComponentInstanceServiceNg2) {} ngOnInit() { this.updateSelectedInstancePropertiesAndSiblings(); + this.updateSelectedServiceCapabilities(); } ngOnChanges(changes) { @@ -146,9 +153,11 @@ export class ServiceConsumptionComponent { this.selectedService = changes.selectedService.currentValue; } this.updateSelectedInstancePropertiesAndSiblings(); + this.updateSelectedServiceCapabilities(); } if(changes.instancesMappedList && !_.isEqual(changes.instancesMappedList.currentValue, changes.instancesMappedList.previousValue)) { this.updateSelectedInstancePropertiesAndSiblings(); + this.updateSelectedServiceCapabilities(); } } @@ -166,6 +175,13 @@ export class ServiceConsumptionComponent { this.selectedInstanceSiblings = _.filter(this.instancesMappedList, coInstance => coInstance.id !== this.selectedServiceInstanceId); } + updateSelectedServiceCapabilities() { + this.selectedInstanceCapabilitisList = _.filter( + CapabilitiesGroup.getFlattenedCapabilities(this.selectedService.capabilities), + cap => cap.properties && cap.ownerId === this.selectedService.uniqueId + ); + } + expandCollapseInterfaceGroup(currInterface) { currInterface.isExpanded = !currInterface.isExpanded; } @@ -190,7 +206,9 @@ export class ServiceConsumptionComponent { parentServiceInputs: this.parentServiceInputs, selectedServiceProperties: this.selectedInstancePropertiesList, selectedServiceInstanceId: this.selectedServiceInstanceId, - selectedInstanceSiblings: this.selectedInstanceSiblings + selectedInstanceSiblings: this.selectedInstanceSiblings, + selectedInstanceCapabilitisList: this.selectedInstanceCapabilitisList, + siblingsCapabilitiesList: this.instancesCapabilitiesMap } ); this.modalInstance.instance.open(); -- cgit 1.2.3-korg