diff options
author | Arielk <Ariel.Kenan@amdocs.com> | 2018-04-16 15:37:39 +0300 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-05-01 03:38:57 +0000 |
commit | 802bd2af2e3c6ba92eb1ce0180a13b11018f6695 (patch) | |
tree | 0906a846aa2c3edc9f2067364ed812bdead9f939 /catalog-ui/src/app/utils/common-utils.ts | |
parent | d0f6cb3ef9600846358a0e7f849759be6f9d917e (diff) |
Interface Operation tab and screens
Change-Id: If03234c783d6ce16fdd0945987ada83b6285f97f
Issue-ID: SDC-1060
Signed-off-by: Arielk <Ariel.Kenan@amdocs.com>
Diffstat (limited to 'catalog-ui/src/app/utils/common-utils.ts')
-rw-r--r-- | catalog-ui/src/app/utils/common-utils.ts | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/catalog-ui/src/app/utils/common-utils.ts b/catalog-ui/src/app/utils/common-utils.ts index 97177949ee..1868550225 100644 --- a/catalog-ui/src/app/utils/common-utils.ts +++ b/catalog-ui/src/app/utils/common-utils.ts @@ -19,7 +19,7 @@ */ import * as _ from "lodash"; -import {Module, AttributeModel, ResourceInstance, PropertyModel, InputFEModel} from "../models"; +import {Module, AttributeModel, ResourceInstance, PropertyModel, InputFEModel, OperationModel} from "../models"; import {ComponentInstanceFactory} from "./component-instance-factory"; import {InputBEModel, PropertyBEModel, RelationshipModel} from "app/models"; import { PolicyInstance } from "app/models/graph/zones/policy-instance"; @@ -126,5 +126,37 @@ export class CommonUtils { return policies; } + + static initInterfaceOperations(interfaces: any): Array<OperationModel> { + + return _.reduce(interfaces, (acc, interf: any) => { + + return acc.concat( + _.map(interf.operations, + ({description, name, uniqueId, inputs, outputs}) => { + const operation = new OperationModel({ + description, + operationType: name, + uniqueId + }); + if (inputs) { + const inputParams = _.map(inputs.listToscaDataDefinition, (input:any) => { + return {paramName: input.name, paramId: input.inputId}; + }); + operation.createInputParamsList(inputParams); + } + if (outputs) { + const outputParams = _.map(outputs.listToscaDataDefinition, (output:any) => { + return {paramName: output.name, paramId: output.outputId}; + }); + operation.createOutputParamsList(outputParams); + } + return operation; + } + ) + ); + + }, []); + } } |