summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/utils
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/utils')
-rw-r--r--catalog-ui/src/app/utils/common-utils.ts34
-rw-r--r--catalog-ui/src/app/utils/constants.ts3
2 files changed, 35 insertions, 2 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;
+ }
+ )
+ );
+
+ }, []);
+ }
}
diff --git a/catalog-ui/src/app/utils/constants.ts b/catalog-ui/src/app/utils/constants.ts
index c8603424bb..9665999dcf 100644
--- a/catalog-ui/src/app/utils/constants.ts
+++ b/catalog-ui/src/app/utils/constants.ts
@@ -235,6 +235,7 @@ export class States {
public static WORKSPACE_INFORMATION_ARTIFACTS = 'workspace.information_artifacts';
public static WORKSPACE_TOSCA_ARTIFACTS = 'workspace.tosca_artifacts';
public static WORKSPACE_COMPOSITION = 'workspace.composition';
+ public static WORKSPACE_INTERFACE_OPERATION = 'workspace.interface_operation';
public static WORKSPACE_NETWORK_CALL_FLOW = 'workspace.network_call_flow';
public static WORKSPACE_MANAGEMENT_WORKFLOW = 'workspace.management_workflow';
public static WORKSPACE_DEPLOYMENT = 'workspace.deployment';
@@ -318,7 +319,7 @@ export class COMPONENT_FIELDS {
static COMPONENT_TOSCA_ARTIFACTS = "toscaArtifacts";
static COMPONENT_POLICIES = "policies";
static COMPONENT_GROUPS = "groups";
-
+ static COMPONENT_INTERFACE_OPERATIONS = "interfaces";
}
export class SERVICE_FIELDS {