aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2020-11-19 13:28:43 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-01-29 08:22:04 +0000
commit5c1f5756bcb5856e2d8b35e3c6ac206f891f8695 (patch)
tree29a7c4424b3ced8800e5bcacc629c8fff8dd8753 /catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts
parent3c957597725f306b4ca06cebfa54fbf0f2622938 (diff)
Add support for updating interface operations
Allows to update interface operations on a component instance. Issue-ID: SDC-3446 Signed-off-by: aribeiro <anderson.ribeiro@est.tech> Signed-off-by: andre.schmid <andre.schmid@est.tech> Change-Id: I6a2c44997c04d9d9ea298e3d0bc971da7b137799
Diffstat (limited to 'catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts')
-rw-r--r--catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts31
1 files changed, 28 insertions, 3 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 492acdc1d6..953f0a1960 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
@@ -35,7 +35,7 @@ import {
PropertyModel,
IFileDownload,
AttributeModel,
- Capability, Requirement
+ Capability, Requirement, BEOperationModel, InterfaceModel
} from "app/models";
import {ArtifactGroupType, COMPONENT_FIELDS} from "app/utils";
import {ComponentGenericResponse} from "../responses/component-generic-response";
@@ -65,6 +65,11 @@ import { PolicyInstance } from "../../../models/graph/zones/policy-instance";
import { PropertyBEModel } from "../../../models/properties-inputs/property-be-model";
import {map} from "rxjs/operators";
import {CapabilitiesConstraintObject} from "../../components/logic/capabilities-constraint/capabilities-constraint.component";
+import {
+ BEInterfaceOperationModel,
+ ComponentInstanceInterfaceModel,
+ InterfaceOperationModel
+} from "../../../models/interfaceOperation";
/* we need to use this service from now, we will remove component.service when we finish remove the angular1.
The service is duplicated since we can not use downgrades service with NGXS*/
@@ -108,8 +113,8 @@ export class TopologyTemplateService {
[COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_POLICIES, COMPONENT_FIELDS.COMPONENT_NON_EXCLUDED_GROUPS]);
}
- getComponentResourceInstances(component: Component): Observable<ComponentGenericResponse> {
- return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES]);
+ getComponentInstances(componentType: string, componentId: string): Observable<ComponentGenericResponse> {
+ return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_INSTANCES]);
}
getComponentInputs(component: Component): Observable<ComponentGenericResponse> {
@@ -478,6 +483,7 @@ export class TopologyTemplateService {
}
protected getComponentDataByFieldsName(componentType: string, componentId: string, fields: string[]): Observable<ComponentGenericResponse> {
+ console.info("Topology template -> getComponentDataByFieldsName with id:", componentId)
let params: HttpParams = new HttpParams();
_.forEach(fields, (field: string): void => {
params = params.append(API_QUERY_PARAMS.INCLUDE, field);
@@ -485,6 +491,7 @@ export class TopologyTemplateService {
// tslint:disable-next-line:object-literal-shorthand
return this.http.get<ComponentGenericResponse>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/filteredDataByParams', {params: params})
.map((res) => {
+ console.info("Topology template -> getComponentDataByFieldsName response:", res);
return componentType === ComponentType.SERVICE ? new ServiceGenericResponse().deserialize(res) :
new ComponentGenericResponse().deserialize(res);
});
@@ -564,4 +571,22 @@ export class TopologyTemplateService {
.pipe(map(response => response.directives));
}
+ updateComponentInstanceInterfaceOperation(componentMetaDataId: string,
+ componentMetaDataType: string,
+ componentInstanceId: string,
+ operation: InterfaceOperationModel): Observable<ComponentInstance> {
+ const operationList = {
+ interfaces: {
+ [operation.interfaceType]: {
+ type: operation.interfaceType,
+ operations: {
+ [operation.name]: new BEInterfaceOperationModel(operation)
+ }
+ }
+ }
+ };
+ return this.http.put<ComponentInstance>(this.baseUrl + this
+ .getServerTypeUrl(componentMetaDataType) + componentMetaDataId + '/componentInstance/' + componentInstanceId + '/interfaceOperation', operationList);
+ }
+
}