Skip to content

Commit

Permalink
feat(workflow): add doc and api
Browse files Browse the repository at this point in the history
  • Loading branch information
qianmoQ committed Dec 19, 2024
1 parent 32520bb commit 95d09e7
Show file tree
Hide file tree
Showing 36 changed files with 495 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public CommonResponse<WorkflowEntity> saveOrUpdate(BaseRepository<WorkflowEntity
repository.findByCode(configure.getCode())
.ifPresent(value -> NullAwareBeanUtils.copyNullProperties(value, configure));

if (configure.getState().equals(RunState.RUNNING)) {
if (configure.getState() != null && configure.getState().equals(RunState.RUNNING)) {
return CommonResponse.failure("Workflow is already running");
}

Expand Down
97 changes: 0 additions & 97 deletions docs/docs/api/pipeline/submit.md

This file was deleted.

33 changes: 33 additions & 0 deletions docs/docs/api/workflow/delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: 删除工作流
---

请求地址:`/api/v1/workflow/{code}`

请求方式:`DELETE`

## Path

=== "示例"

```json
/api/v1/workflow/8ee2171b5d014779a45901fb9c2428c9
```

=== "参数"

|参数|类型|描述|
|---|---|---|
|`code`|String|仪表盘编码|

## Response

=== "示例"

```json
8ee2171b5d014779a45901fb9c2428c9
```

=== "参数"

删除成功后返回仪表盘编码。
73 changes: 73 additions & 0 deletions docs/docs/api/workflow/edit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: 修改工作流
---

请求地址:`/api/v1/workflow`

请求方式:`PUT`

## Body

=== "示例"

```json
{
"code": "10ae626195704b96b353d00aeb6ab1e5",
"executor": "LocalExecutor",
"name": "dsf",
"configure": {
"nodes": [
{
"id": "52c6222f-e49a-4afc-9201-35e296201a33",
"tid": "jdbc-source",
"category": "source",
"position": {
"x": 137,
"y": 95
},
"key": "Jdbc",
"data": { ... }
}
],
"connections": [
{
"id": "668a7830-5c48-433e-9688-c6f8c9341ff7",
"source": "52c6222f-e49a-4afc-9201-35e296201a33-output",
"target": "f2f8b63e-902a-4467-acdf-32c0a7ed4074-input"
}
]
}
}
```

=== "参数"

| 参数 |类型| 描述 |
|-------------|---|----------------------------------------------------------|
| `code` |String| 工作流编码 |
| `name` |String| 工作流名称 |
| `configure` |String| 工作流配置 |
| `executor` |String| 执行器 |

> configure 参数请参考组件:https://view-shadcn-ui.devlive.org/components/workflow.html#workflow-props

## Response

=== "示例"

```json
{
"name": "sss",
"code": "c1ff398243994338a79730f8a1d4f55f",
"active": true,
"createTime": "2024-12-19 22:19:30",
"updateTime": "2024-12-19 22:19:31",
"state": "FAILURE",
"message": "/bin/sh: null/bin/start-seatunnel-spark-connector-v2.sh: No such file or directory",
"work": "...",
"elapsed": 492,
"executor": "SeatunnelExecutor",
"configure": { ... },
"user": { ... }
}
```
46 changes: 46 additions & 0 deletions docs/docs/api/workflow/get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: 获取工作流
---

请求地址: `/api/v1/workflow/info/{code}`

请求方式: `GET`

## Response

=== "示例"

```json
{
"name": "sss",
"code": "c1ff398243994338a79730f8a1d4f55f",
"active": true,
"createTime": "2024-12-19 22:19:30",
"updateTime": "2024-12-19 22:19:31",
"state": "FAILURE",
"message": "/bin/sh: null/bin/start-seatunnel-spark-connector-v2.sh: No such file or directory",
"work": "...",
"elapsed": 492,
"executor": "SeatunnelExecutor",
"configure": { ... },
"user": { ... }
}
```

=== "参数"

| 参数名 | 类型 | 描述 |
| --- |----| --- |
| `code` | 字符串 | 工作流编码 |
| `name` | 字符串 | 名称 |
| `executor` | 字符串 | 执行器 |
| `active` | 布尔值 | 是否启用 |
|`createTime`|字符串|创建时间|
|`updateTime`|字符串|更新时间|
|`state`|字符串|状态|
|`message`|字符串|消息|
|`work`|字符串|工作目录|
|`elapsed`|整数|耗时|
|`executor`|字符串|执行器|
|`configure`|对象|配置|
|`user`|对象|用户|
52 changes: 52 additions & 0 deletions docs/docs/api/workflow/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: 工作流列表
---

请求地址: `/api/v1/workflow/list`

请求方式: `POST`

!!! note

该接口用于获取菜单列表,需要传递分页数据 `page` 和 `size` 作为参数,分页数据默认为 `1`,`size` 默认为 `10`。详细参考 [分页实体](../common/page.md)

## Response

=== "示例"

```json
[
{
"name": "sss",
"code": "c1ff398243994338a79730f8a1d4f55f",
"active": true,
"createTime": "2024-12-19 22:19:30",
"updateTime": "2024-12-19 22:19:31",
"state": "FAILURE",
"message": "/bin/sh: null/bin/start-seatunnel-spark-connector-v2.sh: No such file or directory",
"work": "...",
"elapsed": 492,
"executor": "SeatunnelExecutor",
"configure": { ... },
"user": { ... }
}
]
```

=== "参数"

| 参数名 | 类型 | 描述 |
| --- |----| --- |
| `code` | 字符串 | 工作流编码 |
| `name` | 字符串 | 名称 |
| `executor` | 字符串 | 执行器 |
| `active` | 布尔值 | 是否启用 |
|`createTime`|字符串|创建时间|
|`updateTime`|字符串|更新时间|
|`state`|字符串|状态|
|`message`|字符串|消息|
|`work`|字符串|工作目录|
|`elapsed`|整数|耗时|
|`executor`|字符串|执行器|
|`configure`|对象|配置|
|`user`|对象|用户|
34 changes: 34 additions & 0 deletions docs/docs/api/workflow/log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: 工作流日志
---

请求地址:`/api/v1/workflow/log/{code}`

请求方式:`GET`

## Path

=== "示例"

```json
/api/v1/workflow/log/8ee2171b5d014779a45901fb9c2428c9
```

=== "参数"

|参数|类型|描述|
|---|---|---|
|`code`|String|仪表盘编码|

## Response

=== "示例"

```json
"2024-12-19 22:19:30,265 INFO [pool-5-thread-1] [ProcessBuilderCommander.java:39] Execute task on username [ admin ]",
"2024-12-19 22:19:30,349 INFO [pool-5-thread-1] [ProcessBuilderCommander.java:50] Execute command /bin/sh -c null/bin/start-seatunnel-spark-connector-v2.sh --master local --deploy-mode client --config /Users/shicheng/Code/datacap/data/admin/20241219/workflow/seatunnelexecutor/c1ff398243994338a79730f8a1d4f55f/c1ff398243994338a79730f8a1d4f55f.configure --name c1ff398243994338a79730f8a1d4f55f",
```

=== "参数"

工作流的日志信息。
33 changes: 33 additions & 0 deletions docs/docs/api/workflow/restart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: 重启工作流
---

请求地址:`/api/v1/workflow/restart/{code}`

请求方式:`PUT`

## Path

=== "示例"

```json
/api/v1/workflow/restart/8ee2171b5d014779a45901fb9c2428c9
```

=== "参数"

|参数|类型|描述|
|---|---|---|
|`code`|String|仪表盘编码|

## Response

=== "示例"

```json
8ee2171b5d014779a45901fb9c2428c9
```

=== "参数"

删除成功后返回仪表盘编码。
Loading

0 comments on commit 95d09e7

Please sign in to comment.