diff options
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/interface-operation/operation-creator')
4 files changed, 67 insertions, 14 deletions
diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html index 8f70f7f584..ec056ad6f2 100644 --- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html +++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html @@ -184,16 +184,17 @@ </div> <param-row - *ngFor="let param of tableParameters" - class="data-row" - [isInputParam]="currentTab === TYPE_INPUT" - [isAssociateWorkflow]="isUsingExistingWF()" - [param]="param" - [inputProps]="inputProperties" - [operationOutputs]="operationOutputs" - [onRemoveParam]="onRemoveParam" - [readonly]="readonly" - [validityChanged]="validityChanged"> + *ngFor="let param of tableParameters" + class="data-row" + [isInputParam]="currentTab === TYPE_INPUT" + [isAssociateWorkflow]="isUsingExistingWF()" + [param]="param" + [inputProps]="inputProperties" + [capabilitiesProps]="componentCapabilities" + [operationOutputs]="operationOutputs" + [onRemoveParam]="onRemoveParam" + [readonly]="readonly" + [validityChanged]="validityChanged"> </param-row> </div> diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts index a574460478..e12905654b 100644 --- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts +++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts @@ -5,7 +5,15 @@ import {Subscription} from "rxjs/Subscription"; import {TranslateService} from "app/ng2/shared/translator/translate.service"; import {WorkflowServiceNg2} from 'app/ng2/services/workflow.service'; -import {InterfaceModel, OperationModel, OperationParameter, InputBEModel, RadioButtonModel, WORKFLOW_ASSOCIATION_OPTIONS} from 'app/models'; +import { + InterfaceModel, + OperationModel, + OperationParameter, + InputBEModel, + RadioButtonModel, + WORKFLOW_ASSOCIATION_OPTIONS, + Capability +} from 'app/models'; import {IDropDownOption} from "sdc-ui/lib/angular/form-elements/dropdown/dropdown-models"; import {Tabs, Tab} from "app/ng2/components/ui/tabs/tabs.component"; @@ -39,7 +47,8 @@ export interface OperationCreatorInput { readonly: boolean, interfaceTypes: { [interfaceType: string]: Array<string> }, validityChangedCallback: Function, - workflowIsOnline: boolean; + workflowIsOnline: boolean, + capabilities: Array<Capability> } @Component({ @@ -59,6 +68,7 @@ export class OperationCreatorComponent implements OperationCreatorInput { interfaceTypes: { [interfaceType: string]: Array<string> }; operationNames: Array<TypedDropDownOption> = []; validityChangedCallback: Function; + capabilities: Array<Capability>; allWorkflows: Array<any>; workflows: Array<DropdownValue> = []; @@ -73,6 +83,7 @@ export class OperationCreatorComponent implements OperationCreatorInput { outputParameters: Array<OperationParameter> = []; noAssignOutputParameters: Array<OperationParameter> = []; assignOutputParameters: { [key: string]: { [key: string]: Array<OperationParameter>; }; } = {}; + componentCapabilities: Array<Capability> = []; tableParameters: Array<OperationParameter> = []; operationOutputs: Array<OperationModel> = []; @@ -171,6 +182,7 @@ export class OperationCreatorComponent implements OperationCreatorInput { } } this.reconstructOperation(); + this.filterCapabilities(); this.validityChanged(); this.updateTable(); } @@ -217,6 +229,10 @@ export class OperationCreatorComponent implements OperationCreatorInput { } + filterCapabilities() { + this.componentCapabilities = _.filter(this.capabilities, (cap: Capability) => cap.properties); + } + buildParams = () => { if (this.inputOperation.outputs) { diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html index 3ac9328487..4a4782eaee 100644 --- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html +++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html @@ -58,6 +58,15 @@ {{output.label}} </option> </optgroup> + <optgroup + *ngFor="let cap of filteredCapabilitiesProps" + label="{{cap.capabilityName}}"> + <option + *ngFor="let prop of cap.properties" + [ngValue]="prop.value"> + {{prop.label}} + </option> + </optgroup> </select> <span *ngIf="!filteredInputProps.length && !operationOutputCats.length && isAssociateWorkflow" diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts index bdf1003a64..c18fb82094 100644 --- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts +++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts @@ -1,7 +1,6 @@ import {Component, Input} from '@angular/core'; import {DataTypeService} from "app/ng2/services/data-type.service"; -import {OperationModel, OperationParameter, InputBEModel, DataTypeModel} from 'app/models'; -import {DropDownOption} from "../operation-creator.component"; +import {OperationModel, OperationParameter, InputBEModel, DataTypeModel, Capability} from 'app/models'; import {DropdownValue} from "app/ng2/components/ui/form-components/dropdown/ui-element-dropdown.component"; class DropdownValueType extends DropdownValue { @@ -25,6 +24,7 @@ export class ParamRowComponent { @Input() param: OperationParameter; @Input() inputProps: Array<InputBEModel>; @Input() operationOutputs: Array<OperationModel>; + @Input() capabilitiesProps: Array<Capability>; @Input() onRemoveParam: Function; @Input() isAssociateWorkflow: boolean; @Input() readonly: boolean; @@ -34,6 +34,7 @@ export class ParamRowComponent { propTypeEnum: Array<string> = []; operationOutputCats: Array<{ operationName: string, outputs: Array<DropdownValueType> }> = []; filteredInputProps: Array<DropdownValue> = []; + filteredCapabilitiesProps: Array<{capabilityName: string, properties: Array<DropdownValueType>}> = []; constructor(private dataTypeService: DataTypeService) {} @@ -113,6 +114,26 @@ export class ParamRowComponent { category => category.outputs.length > 0 ); + this.filteredCapabilitiesProps = _.filter( + _.map( + this.capabilitiesProps, + cap => { + return { + capabilityName: cap.name, + properties: _.map( + _.filter(cap.properties, prop => !this.param.type || prop.type === this.param.type), + prop => new DropdownValueType( + prop.uniqueId, + prop.name, + prop.type + ) + ) + }; + } + ), + capability => capability.properties.length > 0 + ); + if (this.param.inputId) { const selProp = this.getSelectedProp(); if (selProp && selProp.type === this.param.type) { @@ -181,6 +202,12 @@ export class ParamRowComponent { (acc, cat) => [...acc, ...cat.outputs], []), (out: DropdownValueType) => this.param.inputId === out.value + ) || _.find( + _.reduce( + this.filteredCapabilitiesProps, + (acc, cap) => [...acc, ...cap.properties], + []), + (prop: DropdownValueType) => this.param.inputId === prop.value ); } |