aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2023-09-11 10:56:37 +0100
committerMichael Morris <michael.morris@est.tech>2023-09-25 08:50:01 +0000
commitceaf83e0f29c10e4521321abcd6dd17080d2db60 (patch)
tree4ff4ac46184543f6a86f35a1860a9a5b7d6a24e8 /catalog-ui/src/app/ng2/services
parentda6b4a245482f4eebade8f487fc9d63f456469ab (diff)
Support setting interfaces on instances
Issue-ID: SDC-4620 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: I4f78eb5e017e79120d61870ecc3b7268f83b4206
Diffstat (limited to 'catalog-ui/src/app/ng2/services')
-rw-r--r--catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts b/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts
index 0af8c737de..405d2bb8af 100644
--- a/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts
+++ b/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts
@@ -36,6 +36,7 @@ import {
IFileDownload,
InputBEModel,
InstancePropertiesAPIMap,
+ InterfaceModel,
OperationModel,
PropertyModel,
Requirement
@@ -672,4 +673,29 @@ export class TopologyTemplateService {
.pipe(map(response => response && response.defaultCustomToscaFunction ? response.defaultCustomToscaFunction : []));
}
+ createComponentInstanceInterfaceOperation(componentMetaDataId: string, componentInstanceId: string,
+ operation: InterfaceOperationModel): Observable<InterfaceOperationModel> {
+ const operationList = {
+ interfaces: {
+ [operation.interfaceType]: {
+ type: operation.interfaceType,
+ operations: {
+ [operation.name]: new BEInterfaceOperationModel(operation)
+ }
+ }
+ }
+ };
+ return this.http.post<any>(this.baseUrl + 'services/' + componentMetaDataId + '/componentInstance/' + componentInstanceId + '/interfaceOperation', operationList)
+ .map((res: any) => {
+ const interf: InterfaceModel = _.find(res.interfaces, interf => interf.type === operation.interfaceType);
+ const newOperation: OperationModel = _.find(interf.operations, op => op.name === operation.name);
+
+ return new InterfaceOperationModel({
+ ...newOperation,
+ interfaceType: interf.type,
+ interfaceId: interf.uniqueId,
+ });
+ });
+ }
+
}