From c8e15e6f98019d9a337dd0a5c8724dcb35d18c69 Mon Sep 17 00:00:00 2001 From: Shubham Takode Date: Tue, 27 Feb 2024 18:33:10 +0530 Subject: [PATCH] Pipeline compile and run API integration --- .../api-services/pipelines.service.ts | 96 ++++++++++++++++++- .../business-logic/model/pipelines/models.ts | 2 + .../model/pipelines/pipeline.ts | 13 ++- .../pipelines/pipelinesCompileRequest.ts | 6 ++ .../model/pipelines/pipelinesRunRequest.ts | 4 + .../edit-pipeline-header.component.html | 4 +- .../edit-pipeline-header.component.ts | 10 +- .../edit-pipeline-page.component.html | 2 + .../edit-pipeline-page.component.ts | 31 +++++- .../pipelines/pipelines.actions.ts | 13 ++- .../pipelines/pipelines.effects.ts | 41 +++++++- 11 files changed, 211 insertions(+), 11 deletions(-) create mode 100644 src/app/business-logic/model/pipelines/pipelinesCompileRequest.ts create mode 100644 src/app/business-logic/model/pipelines/pipelinesRunRequest.ts diff --git a/src/app/business-logic/api-services/pipelines.service.ts b/src/app/business-logic/api-services/pipelines.service.ts index 79325e02..97490261 100644 --- a/src/app/business-logic/api-services/pipelines.service.ts +++ b/src/app/business-logic/api-services/pipelines.service.ts @@ -44,6 +44,8 @@ import { PipelinesGetByIdResponse, PipelinesUpdateRequest, PipelinesUpdateResponse, + PipelinesCompileRequest, + PipelinesRunRequest, } from "../model/pipelines/models"; @Injectable() @@ -356,7 +358,7 @@ export class ApiPipelinesService { ): Observable { if (request === null || request === undefined) { throw new Error( - "Required parameter request was null or undefined when calling projectsUpdate." + "Required parameter request was null or undefined when calling pipelinesUpdate." ); } @@ -393,6 +395,98 @@ export class ApiPipelinesService { ); } + + public pipelinesCompile( + request: PipelinesCompileRequest, + options?: any, + observe: any = "body", + reportProgress: boolean = false + ): Observable { + if (request === null || request === undefined) { + throw new Error( + "Required parameter request was null or undefined when calling pipelinesCompile." + ); + } + + let headers = this.defaultHeaders; + if (options && options.async_enable) { + headers = headers.set(this.configuration.asyncHeader, "1"); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = ["application/json"]; + const httpHeaderAcceptSelected: string | undefined = + this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers = headers.set("Accept", httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + const httpContentTypeSelected: string | undefined = + this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers = headers.set("Content-Type", httpContentTypeSelected); + } + + return this.apiRequest.post( + `${this.basePath}/pipelines.compile`, + request, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress, + } + ); + } + + public pipelinesRun( + request: PipelinesRunRequest, + options?: any, + observe: any = "body", + reportProgress: boolean = false + ): Observable { + if (request === null || request === undefined) { + throw new Error( + "Required parameter request was null or undefined when calling pipelinesRun." + ); + } + + let headers = this.defaultHeaders; + if (options && options.async_enable) { + headers = headers.set(this.configuration.asyncHeader, "1"); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = ["application/json"]; + const httpHeaderAcceptSelected: string | undefined = + this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers = headers.set("Accept", httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + const httpContentTypeSelected: string | undefined = + this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers = headers.set("Content-Type", httpContentTypeSelected); + } + + return this.apiRequest.post( + `${this.basePath}/pipelines.run`, + request, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress, + } + ); + } + + /** * * diff --git a/src/app/business-logic/model/pipelines/models.ts b/src/app/business-logic/model/pipelines/models.ts index 960b5601..49866365 100644 --- a/src/app/business-logic/model/pipelines/models.ts +++ b/src/app/business-logic/model/pipelines/models.ts @@ -9,5 +9,7 @@ export * from '././pipelinesGetByIdRequest'; export * from '././pipelinesGetByIdResponse'; export * from '././pipelinesUpdateRequest'; export * from '././pipelinesUpdateResponse'; +export * from '././pipelinesCompileRequest'; +export * from '././pipelinesRunRequest'; export * from "././pipeline"; \ No newline at end of file diff --git a/src/app/business-logic/model/pipelines/pipeline.ts b/src/app/business-logic/model/pipelines/pipeline.ts index 215f0aed..63023fc7 100644 --- a/src/app/business-logic/model/pipelines/pipeline.ts +++ b/src/app/business-logic/model/pipelines/pipeline.ts @@ -15,10 +15,19 @@ import { PipelinesParameter } from './pipelinesParameter'; * Do not edit the class manually. */ +interface PipelineNode { + id?:string; +} + +interface PipelineEdge { + source?: string; + target?: string +} + interface FlowDisplay { - nodes?: Array; - edges?: Array + nodes?: Array; + edges?: Array } export interface Pipeline { diff --git a/src/app/business-logic/model/pipelines/pipelinesCompileRequest.ts b/src/app/business-logic/model/pipelines/pipelinesCompileRequest.ts new file mode 100644 index 00000000..b835ddab --- /dev/null +++ b/src/app/business-logic/model/pipelines/pipelinesCompileRequest.ts @@ -0,0 +1,6 @@ + +export interface PipelinesCompileRequest { + pipeline_id?: string; + steps?: Array<{nodeName:string}>; + connections?: Array<{startNodeName:string, endNodeName: string}>; +} diff --git a/src/app/business-logic/model/pipelines/pipelinesRunRequest.ts b/src/app/business-logic/model/pipelines/pipelinesRunRequest.ts new file mode 100644 index 00000000..516b890b --- /dev/null +++ b/src/app/business-logic/model/pipelines/pipelinesRunRequest.ts @@ -0,0 +1,4 @@ + +export interface PipelinesRunRequest { + pipeline_id: string; +} diff --git a/src/app/webapp-common/pipelines/edit-pipeline-header/edit-pipeline-header.component.html b/src/app/webapp-common/pipelines/edit-pipeline-header/edit-pipeline-header.component.html index 1ecfc79b..1f94aff8 100644 --- a/src/app/webapp-common/pipelines/edit-pipeline-header/edit-pipeline-header.component.html +++ b/src/app/webapp-common/pipelines/edit-pipeline-header/edit-pipeline-header.component.html @@ -37,13 +37,13 @@ - -