diff options
author | Arielk <Ariel.Kenan@amdocs.com> | 2018-07-31 12:59:36 +0300 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-08-02 08:56:34 +0000 |
commit | eaaf8019188ad99ad2b76e43519c7dae9f4ac592 (patch) | |
tree | 3f42e4ea4bee6c2735395f61bb9f6f1623f64570 /catalog-ui/src/app/ng2/services | |
parent | decd2dff3b5b8aff53be52c825e45186d5c16e99 (diff) |
Enhance operations to associate workflows
Change-Id: Iacf74ee333a3bc2e76e764c28ae660322bc9e6e4
Issue-ID: SDC-1535
Signed-off-by: Arielk <Ariel.Kenan@amdocs.com>
Diffstat (limited to 'catalog-ui/src/app/ng2/services')
-rw-r--r-- | catalog-ui/src/app/ng2/services/workflow.service.ts | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/catalog-ui/src/app/ng2/services/workflow.service.ts b/catalog-ui/src/app/ng2/services/workflow.service.ts new file mode 100644 index 0000000000..7e596e1eda --- /dev/null +++ b/catalog-ui/src/app/ng2/services/workflow.service.ts @@ -0,0 +1,52 @@ +import { Injectable, Inject } from "@angular/core"; +import { Response } from "@angular/http"; +import { Observable } from "rxjs/Observable"; +import { HttpService } from "./http.service"; +import { SdcConfigToken, ISdcConfig } from "../config/sdc-config.config"; + +@Injectable() +export class WorkflowServiceNg2 { + + protected baseUrl; + protected catalogBaseUrl; + + VERSION_STATE_CERTIFIED = 'CERTIFIED'; + + constructor(private http: HttpService, @Inject(SdcConfigToken) sdcConfig:ISdcConfig) { + this.baseUrl = sdcConfig.api.workflow_root; + this.catalogBaseUrl = sdcConfig.api.POST_workflow_artifact; + } + + public getWorkflows(filterCertified: boolean = true): Observable<any> { + return this.http.get(this.baseUrl + '/workflows' + (filterCertified ? '?versionState=' + this.VERSION_STATE_CERTIFIED : '')) + .map((res:Response) => { + return res.json().results; + }); + } + + public getWorkflowVersions(workflowId: string, filterCertified: boolean = true): Observable<any> { + return this.http.get(this.baseUrl + '/workflows/' + workflowId + '/versions' + (filterCertified ? '?state=' + this.VERSION_STATE_CERTIFIED : '')) + .map((res:Response) => { + return res.json().results; + }); + } + + public updateWorkflowVersion(workflowId: string, versionId: string, payload: any): Observable<any> { + return this.http.put(this.baseUrl + '/workflows/' + workflowId + '/versions/' + versionId, payload) + .map((res:Response) => { + return res; + }); + } + + public associateWorkflowArtifact(resourceUuid, operationId, workflowId, workflowVersionId, artifactUuid): Observable<any> { + 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(); + }); + } + +} |