aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-02-16 17:37:57 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-02-17 15:57:55 +0000
commit26e5029d922779fd7e786c1a31b6b37492132388 (patch)
tree8e8e68a6913749e1405fce951bc7816d4fa35ba3 /catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts
parentf2c0a4118c3c0b6360b639622766543bd754b59c (diff)
Implement Attributes/Outputs FE
Change-Id: I014bb0ebc07f3fea4266a4f295172eadee546705 Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3448
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.ts48
1 files changed, 48 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 953f0a1960..0249912862 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
@@ -70,6 +70,8 @@ import {
ComponentInstanceInterfaceModel,
InterfaceOperationModel
} from "../../../models/interfaceOperation";
+import {AttributeBEModel} from "../../../models/attributes-outputs/attribute-be-model";
+import {InstanceAttributesAPIMap} from "../../../models/attributes-outputs/attribute-fe-map";
/* 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*/
@@ -126,6 +128,11 @@ export class TopologyTemplateService {
[COMPONENT_FIELDS.COMPONENT_INPUTS, COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_INSTANCES_PROPERTIES, COMPONENT_FIELDS.COMPONENT_PROPERTIES]);
}
+ getComponentOutputsWithAttributes(componentType: string, componentId: string): Observable<ComponentGenericResponse> {
+ return this.getComponentDataByFieldsName(componentType, componentId,
+ [COMPONENT_FIELDS.COMPONENT_OUTPUTS, COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_INSTANCES_ATTRIBUTES, COMPONENT_FIELDS.COMPONENT_ATTRIBUTES,COMPONENT_FIELDS.COMPONENT_INSTANCES_OUTPUTS]);
+ }
+
getComponentDeploymentArtifacts(component: Component): Observable<ComponentGenericResponse> {
return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_DEPLOYMENT_ARTIFACTS]);
}
@@ -164,6 +171,11 @@ export class TopologyTemplateService {
return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/create/inputs', inputs);
}
+ createOutput(component: Component, outputsToCreate: InstanceAttributesAPIMap, isSelf: boolean): Observable<any> {
+ const outputs = isSelf ? { serviceProperties: outputsToCreate.componentInstanceAttributes } : outputsToCreate;
+ return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/create/outputs', outputs);
+ }
+
restoreComponent(componentType: string, componentId: string) {
return this.http.post(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/restore', {});
}
@@ -206,6 +218,16 @@ export class TopologyTemplateService {
});
}
+ createServiceAttribute(componentId: string, attributeModel: AttributeBEModel): Observable<AttributeBEModel> {
+ const serverObject = {};
+ serverObject[attributeModel.name] = attributeModel;
+ return this.http.post<AttributeBEModel>(this.baseUrl + 'services/' + componentId + '/attributes', serverObject)
+ .map((res) => {
+ const attribute: AttributeBEModel = new AttributeBEModel(res);
+ return attribute;
+ });
+ }
+
getServiceProperties(componentId: string): Observable<PropertyBEModel[]> {
return this.http.get<any>(this.baseUrl + 'services/' + componentId + '/properties')
.map((res) => {
@@ -216,6 +238,16 @@ export class TopologyTemplateService {
});
}
+ getServiceAttributes(componentId: string): Observable<AttributeBEModel[]> {
+ return this.http.get<any>(this.baseUrl + 'services/' + componentId + '/attributes')
+ .map((res) => {
+ if (!res) {
+ return new Array<AttributeBEModel>();
+ }
+ return CommonUtils.initAttributes(res);
+ });
+ }
+
updateServiceProperties(componentId: string, properties: PropertyBEModel[]) {
return this.http.put<any>( this.baseUrl + 'services/' + componentId + '/properties', properties)
.map((res) => {
@@ -225,6 +257,15 @@ export class TopologyTemplateService {
});
}
+ updateServiceAttributes(componentId: string, attributes: AttributeBEModel[]) {
+ return this.http.put<any>( this.baseUrl + 'services/' + componentId + '/attributes', attributes)
+ .map((res) => {
+ const resJson = res;
+ return _.map(resJson,
+ (resValue: AttributeBEModel) => new AttributeBEModel(resValue));
+ });
+ }
+
deleteServiceProperty(componentId: string, property: PropertyBEModel): Observable<string> {
return this.http.delete(this.baseUrl + 'services/' + componentId + '/properties/' + property.uniqueId )
.map((res: Response) => {
@@ -242,6 +283,13 @@ export class TopologyTemplateService {
});
}
+ deleteServiceAttribute(componentId: string, attribute: AttributeBEModel): Observable<string> {
+ return this.http.delete(this.baseUrl + 'services/' + componentId + '/attributes/' + attribute.uniqueId )
+ .map((res: Response) => {
+ return attribute.uniqueId;
+ });
+ }
+
getDependencies(componentType: string, componentId: string): Observable<IDependenciesServerResponse[]> {
return this.http.get<IDependenciesServerResponse[]>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/dependencies');
}