From c21ba95e56f70ba9fbe0daa3ac4b413424b323eb Mon Sep 17 00:00:00 2001 From: Arielk Date: Sun, 21 Apr 2019 16:07:44 +0300 Subject: bug fixes to operation screen and External workflowartifact completion Change-Id: I9d71385d6e29e1736a24f9d84581e465187e9f26 Issue-ID: SDC-2249 Signed-off-by: Arielk --- .../component-services/component.service.ts | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'catalog-ui/src/app/ng2/services') 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 { return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_REQUIREMENTS, COMPONENT_FIELDS.COMPONENT_CAPABILITIES]); } -- cgit 1.2.3-korg