diff options
author | Mojahidul Islam <mojahidul.islam@amdocs.com> | 2019-05-14 12:49:31 +0530 |
---|---|---|
committer | Mojahidul Islam <mojahidul.islam@amdocs.com> | 2019-05-14 12:50:27 +0530 |
commit | 82e531a1ee8ffa30e80b27d9097a2272ae18cdee (patch) | |
tree | 900964c5f61e15437e0568f3a5bec3c7083ca5a2 /catalog-ui/src/app/ng2/pages/service-consumption-editor | |
parent | 3d5b80b9035b9832f86326858b4c6c2cecd952a3 (diff) |
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 <mojahidul.islam@amdocs.com>
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/service-consumption-editor')
2 files changed, 53 insertions, 9 deletions
diff --git a/catalog-ui/src/app/ng2/pages/service-consumption-editor/service-consumption-editor.component.html b/catalog-ui/src/app/ng2/pages/service-consumption-editor/service-consumption-editor.component.html index e77d880176..2c4e2886a1 100644 --- a/catalog-ui/src/app/ng2/pages/service-consumption-editor/service-consumption-editor.component.html +++ b/catalog-ui/src/app/ng2/pages/service-consumption-editor/service-consumption-editor.component.html @@ -77,6 +77,15 @@ {{output.name}} </option> </optgroup> + <optgroup + *ngFor="let cap of consumptionInput.associatedCapabilities" + label="{{cap.name}}"> + <option + *ngFor="let prop of cap.properties" + [ngValue]="cap.name + '_' + prop.name"> + {{prop.name}} + </option> + </optgroup> </select> </div> </div> diff --git a/catalog-ui/src/app/ng2/pages/service-consumption-editor/service-consumption-editor.component.ts b/catalog-ui/src/app/ng2/pages/service-consumption-editor/service-consumption-editor.component.ts index 25f412671f..2c86cc5c5c 100644 --- a/catalog-ui/src/app/ng2/pages/service-consumption-editor/service-consumption-editor.component.ts +++ b/catalog-ui/src/app/ng2/pages/service-consumption-editor/service-consumption-editor.component.ts @@ -17,7 +17,17 @@ import * as _ from "lodash"; import { Component } from '@angular/core'; import {ServiceServiceNg2} from "app/ng2/services/component-services/service.service"; -import {Service, ServiceInstanceObject, InstanceFePropertiesMap, InstanceBePropertiesMap, PropertyBEModel, InputBEModel, OperationModel, InterfaceModel} from 'app/models'; +import { + Service, + ServiceInstanceObject, + InstanceFePropertiesMap, + InstanceBePropertiesMap, + PropertyBEModel, + InputBEModel, + OperationModel, + InterfaceModel, + Capability +} from 'app/models'; import {ConsumptionInput, ConsumptionInputDetails, ServiceOperation} from 'app/ng2/components/logic/service-consumption/service-consumption.component'; import {PropertiesUtils} from "app/ng2/pages/properties-assignment/services/properties.utils"; import { PROPERTY_DATA } from 'app/utils'; @@ -33,7 +43,7 @@ import { PROPERTY_DATA } from 'app/utils'; export class ServiceConsumptionCreatorComponent { input: { - interfaceId: string; + interfaceId: string, serviceOperationIndex: number, serviceOperations: Array<ServiceOperation>, parentService: Service, @@ -41,7 +51,9 @@ export class ServiceConsumptionCreatorComponent { parentServiceInputs: Array<InputBEModel>, selectedServiceProperties: Array<PropertyBEModel>, selectedServiceInstanceId: String, - selectedInstanceSiblings: Array<ServiceInstanceObject> + selectedInstanceSiblings: Array<ServiceInstanceObject>, + selectedInstanceCapabilitisList: Array<Capability>, + siblingsCapabilitiesList: Map<string, Array<Capability>> }; sourceTypes: Array<any> = []; serviceOperationsList: Array<ServiceOperation>; @@ -80,16 +92,24 @@ export class ServiceConsumptionCreatorComponent { initSourceTypes() { this.sourceTypes = [ - { label: this.SOURCE_TYPES.STATIC, value: this.SOURCE_TYPES.STATIC, options: [], interfaces: []}, + { + label: this.SOURCE_TYPES.STATIC, + value: this.SOURCE_TYPES.STATIC, + options: [], + interfaces: [], + capabilities: [] + }, { label: this.SOURCE_TYPES.SELF + ' (' + this.selectedService.name + ')', value: this.selectedServiceInstanceId, options: this.selectedServiceProperties, - interfaces: this.selectedService.interfaces + interfaces: this.selectedService.interfaces, + capabilities: this.input.selectedInstanceCapabilitisList }, { label: this.parentService.name, value: this.parentService.uniqueId, options: this.parentServiceInputs, - interfaces: [] + interfaces: [], + capabilities: [] } ]; _.forEach(this.input.selectedInstanceSiblings, sib => @@ -97,7 +117,8 @@ export class ServiceConsumptionCreatorComponent { label: sib.name, value: sib.id, options: _.unionBy(sib.inputs, sib.properties, 'uniqueId'), - interfaces: sib.interfaces + interfaces: sib.interfaces, + capabilities: this.input.siblingsCapabilitiesList[sib.id] }) ); } @@ -160,6 +181,7 @@ export class ServiceConsumptionCreatorComponent { consumptionInputDetails.assignValueLabel = this.getAssignValueLabel(sourceVal); consumptionInputDetails.associatedProps = filteredListsObj.associatedPropsList; consumptionInputDetails.associatedInterfaces = filteredListsObj.associatedInterfacesList; + consumptionInputDetails.associatedCapabilities = filteredListsObj.associatedCapabilitiesList; return new ConsumptionInputDetails(consumptionInputDetails); }); } @@ -171,6 +193,7 @@ export class ServiceConsumptionCreatorComponent { let filteredListsObj = this.getFilteredProps(consumptionInput.source, consumptionInput.type); consumptionInput.associatedProps = filteredListsObj.associatedPropsList; consumptionInput.associatedInterfaces = filteredListsObj.associatedInterfacesList; + consumptionInput.associatedCapabilities = filteredListsObj.associatedCapabilitiesList; if(consumptionInput.source === this.SOURCE_TYPES.STATIC) { if(PROPERTY_DATA.SIMPLE_TYPES.indexOf(consumptionInput.type) !== -1) { consumptionInput.value = consumptionInput.defaultValue || ""; @@ -184,7 +207,7 @@ export class ServiceConsumptionCreatorComponent { private getFilteredProps(sourceVal, inputType) { let currentSourceObj = this.sourceTypes.find(s => s.value === sourceVal); - let associatedInterfacesList = [], associatedPropsList = []; + let associatedInterfacesList = [], associatedPropsList = [], associatedCapabilitiesPropsList: Array<Capability> = []; if(currentSourceObj) { if (currentSourceObj.interfaces) { associatedInterfacesList = this.getFilteredInterfaceOutputs(currentSourceObj, inputType); @@ -195,10 +218,22 @@ export class ServiceConsumptionCreatorComponent { } return result; }, []); + associatedCapabilitiesPropsList = + _.reduce(currentSourceObj.capabilities, + (filteredCapsList, capability: Capability) => { + let filteredProps = _.filter(capability.properties, prop => prop.type === inputType); + if (filteredProps.length) { + let cap = new Capability(capability); + cap.properties = filteredProps; + filteredCapsList.push(cap); + } + return filteredCapsList + }, []); } return { associatedPropsList: associatedPropsList, - associatedInterfacesList: associatedInterfacesList + associatedInterfacesList: associatedInterfacesList, + associatedCapabilitiesList: associatedCapabilitiesPropsList } } |