From 646843b196c237cc63773da054a89ae4de82c825 Mon Sep 17 00:00:00 2001 From: Shubham Takode Date: Thu, 22 Feb 2024 13:59:44 +0530 Subject: [PATCH] added support for drawing pipeline steps --- .../api-services/pipelines.service.ts | 120 ++++++++++- .../business-logic/model/pipelines/models.ts | 4 + .../model/pipelines/pipeline.ts | 10 +- .../pipelines/pipelinesCreateResponse.ts | 1 + .../pipelines/pipelinesCreateStepsRequest.ts | 6 +- .../pipelines/pipelinesGetByIdRequest.ts | 8 + .../pipelines/pipelinesGetByIdResponse.ts | 7 + .../model/pipelines/pipelinesUpdateRequest.ts | 8 + .../pipelines/pipelinesUpdateResponse.ts | 28 +++ .../projects/projectsGetAllResponseSingle.ts | 1 + .../edit-pipeline-header.component.html | 5 +- .../edit-pipeline-header.component.scss | 4 + .../edit-pipeline-header.component.ts | 7 +- .../edit-pipeline-page.component.html | 6 +- .../edit-pipeline-page.component.ts | 78 ++++++- .../flow-editor.component.ts | 45 ++-- .../react/pipeline-flow.component.tsx | 149 +++++++------ .../react/pipeline-step.component.tsx | 5 +- .../pipeline-add-step-form.component.html | 4 +- .../pipeline-add-step-form.component.ts | 36 +++- .../pipelines-page.component.ts | 196 +++++++++++------- .../pipelines/pipelines.actions.ts | 47 +++-- .../pipelines/pipelines.effects.ts | 189 ++++++++++++++--- .../pipelines/pipelines.reducer.ts | 11 +- 24 files changed, 749 insertions(+), 226 deletions(-) create mode 100644 src/app/business-logic/model/pipelines/pipelinesGetByIdRequest.ts create mode 100644 src/app/business-logic/model/pipelines/pipelinesGetByIdResponse.ts create mode 100644 src/app/business-logic/model/pipelines/pipelinesUpdateRequest.ts create mode 100644 src/app/business-logic/model/pipelines/pipelinesUpdateResponse.ts diff --git a/src/app/business-logic/api-services/pipelines.service.ts b/src/app/business-logic/api-services/pipelines.service.ts index e30c9ba2..f87f6153 100644 --- a/src/app/business-logic/api-services/pipelines.service.ts +++ b/src/app/business-logic/api-services/pipelines.service.ts @@ -34,7 +34,16 @@ import { BASE_PATH, COLLECTION_FORMATS } from "../variables"; import { Configuration } from "../configuration"; import { PipelinesDeleteRunsRequest } from "~/business-logic/model/pipelines/pipelinesDeleteRunsRequest"; import { PipelinesDeleteRunsResponse } from "~/business-logic/model/pipelines/pipelinesDeleteRunsResponse"; -import { PipelinesCreateRequest, PipelinesCreateResponse, PipelinesCreateStepsRequest, PipelinesCreateStepsResponse } from "../model/pipelines/models"; +import { + PipelinesCreateRequest, + PipelinesCreateResponse, + PipelinesCreateStepsRequest, + PipelinesCreateStepsResponse, + PipelinesGetByIdRequest, + PipelinesGetByIdResponse, + PipelinesUpdateRequest, + PipelinesUpdateResponse, +} from "../model/pipelines/models"; @Injectable() export class ApiPipelinesService { @@ -215,7 +224,7 @@ export class ApiPipelinesService { } return this.apiRequest.post( - `${this.basePath}/pipelines.create`, + `${this.basePath}/pipelines.create_pipeline`, request, { withCredentials: this.configuration.withCredentials, @@ -226,7 +235,6 @@ export class ApiPipelinesService { ); } - /** * * Create a new pipeline step @@ -269,7 +277,7 @@ export class ApiPipelinesService { } return this.apiRequest.post( - `${this.basePath}/pipelines.create.step`, + `${this.basePath}/pipelines.create_step`, request, { withCredentials: this.configuration.withCredentials, @@ -280,5 +288,107 @@ export class ApiPipelinesService { ); } - + /** + * + * Update pipeline information + * @param request request body + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public pipelinesUpdate( + request: PipelinesUpdateRequest, + 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 projectsUpdate." + ); + } + + 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.update_pipeline`, + {...request, pipeline_id: request.id}, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress, + } + ); + } + + /** + * + * + * @param request request body + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public pipelinesGetById( + request: PipelinesGetByIdRequest, + 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 pipelinesGetById." + ); + } + + 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.get_by_id`, + 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 070a4379..7309e821 100644 --- a/src/app/business-logic/model/pipelines/models.ts +++ b/src/app/business-logic/model/pipelines/models.ts @@ -4,5 +4,9 @@ export * from '././pipelinesCreateRequest'; export * from '././pipelinesCreateResponse'; export * from '././pipelinesCreateStepsRequest'; export * from '././pipelinesCreateStepsResponse'; +export * from '././pipelinesGetByIdRequest'; +export * from '././pipelinesGetByIdResponse'; +export * from '././pipelinesUpdateRequest'; +export * from '././pipelinesUpdateResponse'; 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 8a06b779..215f0aed 100644 --- a/src/app/business-logic/model/pipelines/pipeline.ts +++ b/src/app/business-logic/model/pipelines/pipeline.ts @@ -15,7 +15,11 @@ import { PipelinesParameter } from './pipelinesParameter'; * Do not edit the class manually. */ - +interface FlowDisplay { + + nodes?: Array; + edges?: Array +} export interface Pipeline { /** @@ -70,5 +74,7 @@ export interface Pipeline { own_models?: number; hidden?: boolean; - parameters?: Array + parameters?: Array; + + flow_display?: FlowDisplay; } diff --git a/src/app/business-logic/model/pipelines/pipelinesCreateResponse.ts b/src/app/business-logic/model/pipelines/pipelinesCreateResponse.ts index 30c50436..68e0ae20 100644 --- a/src/app/business-logic/model/pipelines/pipelinesCreateResponse.ts +++ b/src/app/business-logic/model/pipelines/pipelinesCreateResponse.ts @@ -4,4 +4,5 @@ export interface PipelinesCreateResponse { * Pipeline id */ id?: string; + project_id?: string; } diff --git a/src/app/business-logic/model/pipelines/pipelinesCreateStepsRequest.ts b/src/app/business-logic/model/pipelines/pipelinesCreateStepsRequest.ts index b1e213f0..4ea1c997 100644 --- a/src/app/business-logic/model/pipelines/pipelinesCreateStepsRequest.ts +++ b/src/app/business-logic/model/pipelines/pipelinesCreateStepsRequest.ts @@ -1,6 +1,6 @@ export interface PipelinesCreateStepsRequest { /** - * Pipeline name. Unique within the company. + * Pipeline step name. Unique within the company. */ name: string; /** @@ -10,5 +10,7 @@ export interface PipelinesCreateStepsRequest { experiment?: string; - parameters?: Array + parameters?: Array, + + pipeline_id?: string; } diff --git a/src/app/business-logic/model/pipelines/pipelinesGetByIdRequest.ts b/src/app/business-logic/model/pipelines/pipelinesGetByIdRequest.ts new file mode 100644 index 00000000..7d9268a5 --- /dev/null +++ b/src/app/business-logic/model/pipelines/pipelinesGetByIdRequest.ts @@ -0,0 +1,8 @@ + +export interface PipelinesGetByIdRequest { + /** + * Project id + */ + pipeline?: string; + pipeline_name?: string; +} diff --git a/src/app/business-logic/model/pipelines/pipelinesGetByIdResponse.ts b/src/app/business-logic/model/pipelines/pipelinesGetByIdResponse.ts new file mode 100644 index 00000000..817fdcba --- /dev/null +++ b/src/app/business-logic/model/pipelines/pipelinesGetByIdResponse.ts @@ -0,0 +1,7 @@ + +import { Pipeline } from './pipeline'; + + +export interface PipelinesGetByIdResponse { + pipeline?: Pipeline; +} diff --git a/src/app/business-logic/model/pipelines/pipelinesUpdateRequest.ts b/src/app/business-logic/model/pipelines/pipelinesUpdateRequest.ts new file mode 100644 index 00000000..db057359 --- /dev/null +++ b/src/app/business-logic/model/pipelines/pipelinesUpdateRequest.ts @@ -0,0 +1,8 @@ +import { Pipeline } from "./pipeline"; + + + +export interface PipelinesUpdateRequest extends Pipeline { + flow_display?: unknown; + pipeline_id?: string; +} diff --git a/src/app/business-logic/model/pipelines/pipelinesUpdateResponse.ts b/src/app/business-logic/model/pipelines/pipelinesUpdateResponse.ts new file mode 100644 index 00000000..acd2b9ea --- /dev/null +++ b/src/app/business-logic/model/pipelines/pipelinesUpdateResponse.ts @@ -0,0 +1,28 @@ +/** + * projects + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 2.14 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { Pipeline } from "./pipeline"; + + + +export interface PipelinesUpdateResponse extends Pipeline { + /** + * Number of projects updated (0 or 1) + */ + updated?: number; + /** + * Updated fields names and values + */ + fields?: object; + + id?: string; +} diff --git a/src/app/business-logic/model/projects/projectsGetAllResponseSingle.ts b/src/app/business-logic/model/projects/projectsGetAllResponseSingle.ts index f1d72567..ce0830c4 100644 --- a/src/app/business-logic/model/projects/projectsGetAllResponseSingle.ts +++ b/src/app/business-logic/model/projects/projectsGetAllResponseSingle.ts @@ -58,4 +58,5 @@ export interface ProjectsGetAllResponseSingle { sub_projects?: Array; isRoot?: boolean; last_update?: string; //MANUALLY + //basename?: 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 2f6cf56b..df540c97 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 @@ -1,4 +1,7 @@
+
+ Editing {{pipelineData?.name}} +
-
Please provide a experiment Please @@ -52,7 +52,7 @@ -
+