From b734ea21ac7be393c59cf9976f0e5ddeaf27d568 Mon Sep 17 00:00:00 2001 From: siddharth0905 Date: Thu, 22 Nov 2018 13:37:31 +0530 Subject: Service Workflow changes Service workflow change with few bug fixes Change-Id: Ice2376565bf46fb8d86fb6062654ec54bb2daa43 Issue-ID: SDC-1937 Signed-off-by: siddharth0905 --- .../component-services/component.service.ts | 18 ++++------------- .../src/app/ng2/services/workflow.service.ts | 23 +++++++++++----------- 2 files changed, 16 insertions(+), 25 deletions(-) (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 3546ebd374..26b0291156 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 @@ -128,9 +128,7 @@ export class ComponentServiceNg2 { getInterfaceOperation(component:Component, operation:OperationModel):Observable { return this.http.get(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/interfaceOperations/' + operation.uniqueId) - .map((res:Response) => { - return res.json(); - }); + .map((res:Response) => res.json()); } createInterfaceOperation(component:Component, operation:OperationModel):Observable { @@ -140,9 +138,7 @@ export class ComponentServiceNg2 { } }; return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/interfaceOperations', operationList) - .map((res:Response) => { - return res.json(); - }); + .map((res:Response) => res.json()); } updateInterfaceOperation(component:Component, operation:OperationModel):Observable { @@ -152,16 +148,12 @@ export class ComponentServiceNg2 { } }; return this.http.put(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/interfaceOperations', operationList) - .map((res:Response) => { - return res.json(); - }); + .map((res:Response) => res.json()); } deleteInterfaceOperation(component:Component, operation:OperationModel):Observable { return this.http.delete(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/interfaceOperations/' + operation.uniqueId) - .map((res:Response) => { - return res.json(); - }); + .map((res:Response) => res.json()); } getCapabilitiesAndRequirements(componentType: string, componentId:string):Observable { @@ -189,7 +181,6 @@ export class ComponentServiceNg2 { deleteInput(component:Component, input:InputBEModel):Observable { - return this.http.delete(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/delete/' + input.uniqueId + '/input') .map((res:Response) => { return new InputBEModel(res.json()); @@ -197,7 +188,6 @@ export class ComponentServiceNg2 { } updateComponentInputs(component:Component, inputs:InputBEModel[]):Observable { - return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/update/inputs', inputs) .map((res:Response) => { return res.json().map((input) => new InputBEModel(input)); diff --git a/catalog-ui/src/app/ng2/services/workflow.service.ts b/catalog-ui/src/app/ng2/services/workflow.service.ts index ae06a39713..24ba882a96 100644 --- a/catalog-ui/src/app/ng2/services/workflow.service.ts +++ b/catalog-ui/src/app/ng2/services/workflow.service.ts @@ -3,6 +3,7 @@ import { Response } from "@angular/http"; import { Observable } from "rxjs/Observable"; import { HttpService } from "./http.service"; import { SdcConfigToken, ISdcConfig } from "../config/sdc-config.config"; +import { Component } from "app/models"; @Injectable() export class WorkflowServiceNg2 { @@ -12,11 +13,21 @@ export class WorkflowServiceNg2 { VERSION_STATE_CERTIFIED = 'CERTIFIED'; - constructor(private http: HttpService, @Inject(SdcConfigToken) sdcConfig:ISdcConfig) { + constructor(private http: HttpService, @Inject(SdcConfigToken) sdcConfig: ISdcConfig) { this.baseUrl = sdcConfig.api.workflow_root; this.catalogBaseUrl = sdcConfig.api.POST_workflow_artifact; } + public associateWorkflowArtifact(component: Component, operationId: string, workflowId: string, workflowVersionId: string, artifactUuid: string): Observable { + return this.http.post(this.baseUrl + '/workflows/' + workflowId + '/versions/' + workflowVersionId + '/artifact-deliveries', { + endpoint: this.catalogBaseUrl + '/' + component.getTypeUrl() + component.uuid + '/interfaces/' + operationId + '/artifacts/' + artifactUuid, + method: 'POST' + }) + .map((res:Response) => { + return res.json(); + }); + } + public getWorkflows(filterCertified: boolean = true): Observable { return this.http.get(this.baseUrl + '/workflows' + (filterCertified ? '?versionState=' + this.VERSION_STATE_CERTIFIED : '')) .map((res:Response) => { @@ -38,14 +49,4 @@ export class WorkflowServiceNg2 { }); } - public associateWorkflowArtifact(resourceUuid, operationId, workflowId, workflowVersionId, artifactUuid): Observable { - return this.http.post(this.baseUrl + '/workflows/' + workflowId + '/versions/' + workflowVersionId + '/artifact-deliveries', { - endpoint: this.catalogBaseUrl + '/resources/' + resourceUuid + '/interfaces/' + operationId + '/artifacts/' + artifactUuid, - method: 'POST' - }) - .map((res:Response) => { - return res.json(); - }); - } - } -- cgit 1.2.3-korg