diff options
Diffstat (limited to 'catalog-ui/src/app/ng2/services')
-rw-r--r-- | catalog-ui/src/app/ng2/services/component-services/component.service.ts | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/catalog-ui/src/app/ng2/services/component-services/component.service.ts b/catalog-ui/src/app/ng2/services/component-services/component.service.ts index fd746516b7..e0884d714f 100644 --- a/catalog-ui/src/app/ng2/services/component-services/component.service.ts +++ b/catalog-ui/src/app/ng2/services/component-services/component.service.ts @@ -23,7 +23,7 @@ import {Injectable, Inject} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/toPromise'; -import {Response, URLSearchParams} from '@angular/http'; +import {Response, URLSearchParams, Headers} from '@angular/http'; import { Component, ComponentInstance, InputBEModel, InstancePropertiesAPIMap, FilterPropertiesAssignmentData, PropertyBEModel, OperationModel, BEOperationModel, Capability, Requirement, PolicyInstance} from "app/models"; import {COMPONENT_FIELDS, CommonUtils, SERVICE_FIELDS} from "app/utils"; @@ -207,6 +207,28 @@ export class ComponentServiceNg2 { }); } + uploadInterfaceOperationArtifact(component:Component, response:OperationModel, UIOperation:OperationModel) { + const payload = { + artifactType: "WORKFLOW", + artifactName: UIOperation.artifactFile.name, + description: "Workflow Artifact Description", + payloadData: UIOperation.artifactData + }; + + const headers = new Headers(); + JSON.stringify(payload); + const payloadString = JSON.stringify(payload, null, ' '); + const md5Result = md5(payloadString).toLowerCase(); + headers.append('Content-MD5', btoa(md5Result)); + + return this.http.post(this.baseUrl + component.getTypeUrl() + component.uuid + '/interfaces/' + response.interfaceId + '/operations/' + response.uniqueId + '/artifacts/' + response.implementation.artifactUUID, + payload, + {headers} + ).map((res: Response) => { + return res.json(); + }); + } + getCapabilitiesAndRequirements(componentType: string, componentId:string):Observable<ComponentGenericResponse> { return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_REQUIREMENTS, COMPONENT_FIELDS.COMPONENT_CAPABILITIES]); } |