diff --git a/.dumi/theme/builtins/PluginInfo.tsx b/.dumi/theme/builtins/PluginInfo.tsx index d1073b397..1007c4411 100644 --- a/.dumi/theme/builtins/PluginInfo.tsx +++ b/.dumi/theme/builtins/PluginInfo.tsx @@ -14,7 +14,7 @@ const PluginInfo = (props) => { {zhCN ? (

该功能由{commercial ? '商业' : ''}插件 plugin-{name} 提供{commercial && <>,请查看 商业授权 了解详情}。

) : ( -

This feature is provided by the {commercial ? 'commercial ' : ''}plugin plugin-{name}. {commercial && <>
Please refer to the commercial license for details.}

+

This feature is provided by the {commercial ? 'commercial ' : ''}plugin plugin-{name}. {commercial && <>
Please refer to the commercial license for details.}

)} diff --git a/docs/config/handbook.ts b/docs/config/handbook.ts index 6ac760045..e716dda41 100644 --- a/docs/config/handbook.ts +++ b/docs/config/handbook.ts @@ -161,7 +161,7 @@ export default [ { title: 'Expression collection', 'title.zh-CN': '表达式表', - link: '/handbook/workflow/plugins/dynamic-calculation/collection', + link: '/handbook/workflow-dynamic-calculation/collection', }, { title: 'SQL collection', @@ -1358,7 +1358,16 @@ export default [ children: [ '/handbook/workflow', '/handbook/workflow/quick-start', - '/handbook/workflow/advanced', + { + title: 'Advanced', + 'title.zh-CN': '进阶理解', + children: [ + '/handbook/workflow/advanced/variables', + '/handbook/workflow/advanced/executions', + '/handbook/workflow/advanced/revisions', + '/handbook/workflow/advanced/options', + ], + }, { title: 'Triggers', 'title.zh-CN': '触发器', @@ -1446,31 +1455,31 @@ export default [ 'title.zh-CN': '操作后事件', subTitle: '@nocobase/plugin-workflow-action-trigger', children: [ - '/handbook/workflow/plugins/action-trigger', - '/handbook/workflow/plugins/action-trigger/trigger', - '/handbook/workflow/plugins/action-trigger/action', - '/handbook/workflow/plugins/action-trigger/example', - '/handbook/workflow/plugins/action-trigger/http-api', + '/handbook/workflow-action-trigger', + '/handbook/workflow-action-trigger/trigger', + '/handbook/workflow-action-trigger/action', + '/handbook/workflow-action-trigger/example', + '/handbook/workflow-action-trigger/http-api', ], }, { title: 'Aggregate', 'title.zh-CN': '聚合查询', subTitle: '@nocobase/plugin-workflow-aggregate', - link: '/handbook/workflow/plugins/aggregate', + link: '/handbook/workflow-aggregate', }, { title: 'Approval', 'title.zh-CN': '审批', subTitle: '@nocobase/plugin-workflow-approval', children: [ - '/handbook/workflow/plugins/approval', - '/handbook/workflow/plugins/approval/trigger', - '/handbook/workflow/plugins/approval/node', - '/handbook/workflow/plugins/approval/action', - '/handbook/workflow/plugins/approval/block', - '/handbook/workflow/plugins/approval/advanced', - '/handbook/workflow/plugins/approval/http-api', + '/handbook/workflow-approval', + '/handbook/workflow-approval/trigger', + '/handbook/workflow-approval/node', + '/handbook/workflow-approval/action', + '/handbook/workflow-approval/block', + '/handbook/workflow-approval/advanced', + '/handbook/workflow-approval/http-api', ], }, { @@ -1478,95 +1487,95 @@ export default [ 'title.zh-CN': '自定义操作事件', subTitle: '@nocobase/plugin-workflow-custom-action-trigger', children: [ - '/handbook/workflow/plugins/custom-action-trigger', - '/handbook/workflow/plugins/custom-action-trigger/trigger', - '/handbook/workflow/plugins/custom-action-trigger/action', - '/handbook/workflow/plugins/custom-action-trigger/example', - '/handbook/workflow/plugins/custom-action-trigger/http-api', + '/handbook/workflow-custom-action-trigger', + '/handbook/workflow-custom-action-trigger/trigger', + '/handbook/workflow-custom-action-trigger/action', + '/handbook/workflow-custom-action-trigger/example', + '/handbook/workflow-custom-action-trigger/http-api', ], }, { title: 'Delay', 'title.zh-CN': '延时', subTitle: '@nocobase/plugin-workflow-delay', - link: '/handbook/workflow/plugins/delay', + link: '/handbook/workflow-delay', }, { title: 'Dynamic calculation', 'title.zh-CN': '动态表达式', subTitle: '@nocobase/plugin-workflow-dynamic-calculation', children: [ - '/handbook/workflow/plugins/dynamic-calculation', - '/handbook/workflow/plugins/dynamic-calculation/collection', - '/handbook/workflow/plugins/dynamic-calculation/node', + '/handbook/workflow-dynamic-calculation', + '/handbook/workflow-dynamic-calculation/collection', + '/handbook/workflow-dynamic-calculation/node', ], }, { title: 'JSON query', 'title.zh-CN': 'JSON 解析', subTitle: '@nocobase/plugin-workflow-json-query', - link: '/handbook/workflow/plugins/json-query', + link: '/handbook/workflow-json-query', }, { title: 'Loop', 'title.zh-CN': '循环', subTitle: '@nocobase/plugin-workflow-loop', - link: '/handbook/workflow/plugins/loop', + link: '/handbook/workflow-loop', }, { title: 'Manual process', 'title.zh-CN': '人工处理', subTitle: '@nocobase/plugin-workflow-manual', children: [ - '/handbook/workflow/plugins/manual', - '/handbook/workflow/plugins/manual/node', - '/handbook/workflow/plugins/manual/block', - '/handbook/workflow/plugins/manual/example', + '/handbook/workflow-manual', + '/handbook/workflow-manual/node', + '/handbook/workflow-manual/block', + '/handbook/workflow-manual/example', ], }, { title: 'Parallel', 'title.zh-CN': '并行分支', subTitle: '@nocobase/plugin-workflow-parallel', - link: '/handbook/workflow/plugins/parallel', + link: '/handbook/workflow-parallel', }, { title: 'HTTP Request', 'title.zh-CN': 'HTTP 请求', subTitle: '@nocobase/plugin-workflow-request', - link: '/handbook/workflow/plugins/request', + link: '/handbook/workflow-request', }, { title: 'Pre-action trigger', 'title.zh-CN': '操作前事件', subTitle: '@nocobase/plugin-workflow-request-interceptor', - link: '/handbook/workflow/plugins/request-interceptor', + link: '/handbook/workflow-request-interceptor', children: [ - '/handbook/workflow/plugins/request-interceptor', - '/handbook/workflow/plugins/request-interceptor/trigger', - '/handbook/workflow/plugins/request-interceptor/action', - '/handbook/workflow/plugins/request-interceptor/advanced', - '/handbook/workflow/plugins/request-interceptor/example', - '/handbook/workflow/plugins/request-interceptor/http-api', + '/handbook/workflow-request-interceptor', + '/handbook/workflow-request-interceptor/trigger', + '/handbook/workflow-request-interceptor/action', + '/handbook/workflow-request-interceptor/advanced', + '/handbook/workflow-request-interceptor/example', + '/handbook/workflow-request-interceptor/http-api', ], }, { title: 'Response message', 'title.zh-CN': '响应消息', subTitle: '@nocobase/plugin-workflow-response-message', - link: '/handbook/workflow/plugins/response-message', + link: '/handbook/workflow-response-message', }, { title: 'SQL action', 'title.zh-CN': 'SQL 操作', subTitle: '@nocobase/plugin-workflow-sql', - link: '/handbook/workflow/plugins/sql', + link: '/handbook/workflow-sql', }, { title: 'Custom variable', 'title.zh-CN': '自定义变量', subTitle: '@nocobase/plugin-workflow-variable', - link: '/handbook/workflow/plugins/variable', + link: '/handbook/workflow-variable', }, ], }, diff --git a/docs/en-US/api/server/plugin.md b/docs/en-US/api/server/plugin.md index e453aca01..dcaa9ad87 100644 --- a/docs/en-US/api/server/plugin.md +++ b/docs/en-US/api/server/plugin.md @@ -90,28 +90,6 @@ Executed before the plugin is removed. Executed after the plugin is removed. -### `onSync()` - -In a distributed environment, handle synchronization events published by the current plugin from other nodes. When the plugin uses memory state, it is necessary to override the event handling logic to ensure synchronization with the state of other nodes. - -#### Signature - -``` -onSync(message: SyncMessage): void | Promise -``` - -#### Arguments - -- `message`: Sync message data from other nodes. - -#### Example - -```ts -onSync(message: SyncMessage) { - console.log('onSync', message); - // this.reloadData(); -} -``` ## Other Methods @@ -127,24 +105,47 @@ Creates a logger. Refer to [Logger](../logger.md). A method for internal use. Outputs plugin-related configuration information. -### `sync()` +### `sendSyncMessage()` Publish synchronization messages. The synchronization messages sent by this method will only be received by the same plugin on other nodes, and will not be related to other plugins. #### Signature ```ts -sync(data: SyncMessageData = {}): void | Promise +sendSyncMessage(message: any): void | Promise ``` #### Arguments -- `data`: Sync message data, in key-value pair format. The keys and values must be strings. +- `message`: Sync message data. #### Example ```ts -this.sync({ +this.sendSyncMessage({ key: 'value' }); ``` + +### `handleSyncMessage()` + +In a distributed environment, handle synchronization events published by the current plugin from other nodes. When the plugin uses memory state, it is necessary to override the event handling logic to ensure synchronization with the state of other nodes. + +#### Signature + +``` +handleSyncMessage(message: any): void | Promise +``` + +#### Arguments + +- `message`: Sync message data from other nodes. + +#### Example + +```ts +handleSyncMessage(message: SyncMessage) { + console.log('handleSyncMessage', message); + // this.reloadData(); +} +``` diff --git a/docs/en-US/api/server/sync-manager.md b/docs/en-US/api/server/sync-manager.md deleted file mode 100644 index 4e07d66c0..000000000 --- a/docs/en-US/api/server/sync-manager.md +++ /dev/null @@ -1,74 +0,0 @@ -# SyncManager - -Used to manage synchronization signals between multiple application nodes. In a distributed deployment, when the memory state changes, it is necessary to notify other nodes for synchronization. `SyncManager` provides a common interface to be invoked, allowing it to be used in same way across different modules. - -The SyncManager itself does not implement specific synchronization functionality, but provides a unified interface. The specific synchronization logic should be implemented by adapter plugins based on other middleware. For example, synchronization adapter plugins can be implemented by using middleware such as Redis, Etcd, RabbitMQ, Kafka, etc. - -## `SyncManager` - -### Members - -#### `constructor()` - -Constructor, creates an instance of the SyncManager. An instance is automatically created during application initialization and is accessible globally within the application (`app.syncManager`), so there is no need to call it. - -#### `available: Boolean` - -Indicates the ready state whether the SyncManager is available. - -Returns `true` when the adapter has been initialized and connected to the corresponding middleware. Otherwise, returns `false`. - -#### `init(adapter: SyncAdapter)` - -Initializes the SyncManager. - -This method can only be called once, typically when loading the relevant adapter plugin to register the adapter instance with the SyncManager. Multiple calls will throw an exception, causing the application to fail to start. Administrators need to check for any plugins that may have redundantly injected adapters. - -#### `subscribe(namespace: string, callback: SyncEventCallback)` - -Subscribes to sync events. - -- `namespace`: Namespace to differentiate between different sync events. -- `callback`: Event callback function, called when a sync event occurs. - -#### `unsubscribe(namespace: string, callback: SyncEventCallback)` - -Unsubscribes from sync events. - -#### `publish(namespace: string, data: SyncMessageData = {})` - -Publishes a sync message. - -- `namespace`: Namespace to differentiate between different sync events. -- `data`: Sync message data. - -:::warning{title=Warning} -Sync message data must be in key-value pair format, with both keys and values being strings. -::: - -### Related Types - -```ts -export type SyncMessageData = Record; - -export type SyncEventCallback = (message: SyncMessageData) => void; - -export type SyncMessage = { - namespace: string; - nodeId: string; - appName: string; -} & SyncMessageData; -``` - -## `SyncAdapter` - -Abstract class for sync adapters, defining the interfaces that sync adapters must implement. Any implementation of a sync adapter must extend this class. This class inherits from Node.js's EventEmitter class. - -### Related Types - -```ts -export abstract class SyncAdapter extends EventEmitter { - abstract get ready(): boolean; - public abstract publish(data: SyncMessage): void | Promise; -} -``` diff --git a/docs/en-US/api/server/sync-message-manager.md b/docs/en-US/api/server/sync-message-manager.md new file mode 100644 index 000000000..dfb0d1e19 --- /dev/null +++ b/docs/en-US/api/server/sync-message-manager.md @@ -0,0 +1,37 @@ +# SyncMessageManager + +Used to manage synchronization signals between multiple application nodes. In a distributed deployment, when the memory state changes, it is necessary to notify other nodes for synchronization. `SyncMessageManager` provides a common interface to be invoked, allowing it to be used in same way across different modules. + +The SyncMessageManager itself does not implement specific synchronization functionality, but provides a unified interface, and it will invoke the underlying `pubSubManager` to send and receive messages. + +## `SyncMessageManager` + +### Members + +#### `constructor()` + +Constructor, creates an instance of the SyncMessageManager. An instance is automatically created during application initialization and is accessible globally within the application (`app.syncMessageManager`), so there is no need to call it. + +#### `subscribe(channel: string, callback: SyncEventCallback)` + +Subscribes to sync events. + +- `channel`: Channel name to differentiate between different sync events. +- `callback`: Event callback function, called when a sync event occurs. + +#### `unsubscribe(channel: string, callback: SyncEventCallback)` + +Unsubscribes from sync events. + +#### `publish(channel: string, message: any)` + +Publishes a sync message. + +- `channel`: Channel name to differentiate between different sync events. +- `message`: Sync message data. + +### Related Types + +```ts +export type PubSubCallback = (message: any) => Promise; +``` diff --git a/docs/en-US/handbook/ui/actions/types/trigger-workflow.md b/docs/en-US/handbook/ui/actions/types/trigger-workflow.md index d4cbf3874..aad3b77ff 100644 --- a/docs/en-US/handbook/ui/actions/types/trigger-workflow.md +++ b/docs/en-US/handbook/ui/actions/types/trigger-workflow.md @@ -1,5 +1,5 @@ # 触发工作流 - + - + diff --git a/docs/en-US/handbook/ui/blocks/other-blocks/workflow-approval.md b/docs/en-US/handbook/ui/blocks/other-blocks/workflow-approval.md index 8a8297af7..a1e941088 100644 --- a/docs/en-US/handbook/ui/blocks/other-blocks/workflow-approval.md +++ b/docs/en-US/handbook/ui/blocks/other-blocks/workflow-approval.md @@ -1,3 +1,3 @@ # Workflow: Approval blocks - \ No newline at end of file + diff --git a/docs/en-US/handbook/ui/blocks/other-blocks/workflow-manual.md b/docs/en-US/handbook/ui/blocks/other-blocks/workflow-manual.md index 0a60ef178..551b416ad 100644 --- a/docs/en-US/handbook/ui/blocks/other-blocks/workflow-manual.md +++ b/docs/en-US/handbook/ui/blocks/other-blocks/workflow-manual.md @@ -1,3 +1,3 @@ # Workflow: Manual todos block - \ No newline at end of file + diff --git a/docs/en-US/handbook/workflow/plugins/action-trigger/action.md b/docs/en-US/handbook/workflow-action-trigger/action.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/action-trigger/action.md rename to docs/en-US/handbook/workflow-action-trigger/action.md diff --git a/docs/en-US/handbook/workflow/plugins/action-trigger/example.md b/docs/en-US/handbook/workflow-action-trigger/example.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/action-trigger/example.md rename to docs/en-US/handbook/workflow-action-trigger/example.md diff --git a/docs/en-US/handbook/workflow/plugins/action-trigger/http-api.md b/docs/en-US/handbook/workflow-action-trigger/http-api.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/action-trigger/http-api.md rename to docs/en-US/handbook/workflow-action-trigger/http-api.md diff --git a/docs/en-US/handbook/workflow/plugins/action-trigger/index.md b/docs/en-US/handbook/workflow-action-trigger/index.md similarity index 98% rename from docs/en-US/handbook/workflow/plugins/action-trigger/index.md rename to docs/en-US/handbook/workflow-action-trigger/index.md index 81bf6ac0b..e6b5a1e25 100644 --- a/docs/en-US/handbook/workflow/plugins/action-trigger/index.md +++ b/docs/en-US/handbook/workflow-action-trigger/index.md @@ -1,6 +1,6 @@ # Overview - + 系统中的所有用户产生的数据变动,通常都通过某项操作来完成,具体形式通常是点击某个按钮,按钮可能是表单中的提交按钮,也可能是数据区块中的操作按钮。操作后事件用于对这些按钮的操作绑定相关的工作流,以达成用户操作成功后触发特定流程的效果。 diff --git a/docs/en-US/handbook/workflow/plugins/action-trigger/trigger.md b/docs/en-US/handbook/workflow-action-trigger/trigger.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/action-trigger/trigger.md rename to docs/en-US/handbook/workflow-action-trigger/trigger.md diff --git a/docs/zh-CN/handbook/workflow/plugins/aggregate.md b/docs/en-US/handbook/workflow-aggregate/index.md similarity index 96% rename from docs/zh-CN/handbook/workflow/plugins/aggregate.md rename to docs/en-US/handbook/workflow-aggregate/index.md index f43d0b7b7..ac9cb3fc9 100644 --- a/docs/zh-CN/handbook/workflow/plugins/aggregate.md +++ b/docs/en-US/handbook/workflow-aggregate/index.md @@ -1,6 +1,6 @@ # 聚合查询 - + 用于对某个数据表的满足条件的数据进行聚合函数查询,并返回对应的统计结果。常用于处理报表相关的统计数据。 diff --git a/docs/en-US/handbook/workflow/plugins/approval/action.md b/docs/en-US/handbook/workflow-approval/action.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/approval/action.md rename to docs/en-US/handbook/workflow-approval/action.md diff --git a/docs/en-US/handbook/workflow/plugins/approval/advanced.md b/docs/en-US/handbook/workflow-approval/advanced.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/approval/advanced.md rename to docs/en-US/handbook/workflow-approval/advanced.md diff --git a/docs/en-US/handbook/workflow/plugins/approval/block.md b/docs/en-US/handbook/workflow-approval/block.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/approval/block.md rename to docs/en-US/handbook/workflow-approval/block.md diff --git a/docs/en-US/handbook/workflow/plugins/approval/http-api.md b/docs/en-US/handbook/workflow-approval/http-api.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/approval/http-api.md rename to docs/en-US/handbook/workflow-approval/http-api.md diff --git a/docs/en-US/handbook/workflow/plugins/approval/index.md b/docs/en-US/handbook/workflow-approval/index.md similarity index 89% rename from docs/en-US/handbook/workflow/plugins/approval/index.md rename to docs/en-US/handbook/workflow-approval/index.md index 83d263670..d20d12faf 100644 --- a/docs/en-US/handbook/workflow/plugins/approval/index.md +++ b/docs/en-US/handbook/workflow-approval/index.md @@ -1,12 +1,12 @@ # Overview - + 审批是一种专用于人工发起且由人工处理以决定相关数据状态的流程形式。通常用于办公自动化或其他人工决策事务的流程管理,例如可以创建并管理“请假申请”、“费用报销审批”和“原料采购审批”等场景的人工流程。 审批插件提供了专用的工作流类型(触发器)“审批(事件)”和专用于该流程的“审批”节点,结合 NocoBase 特有的自定义数据表和自定义区块,可以快速且灵活地创建与管理各类审批场景。 - + ## 使用手册 diff --git a/docs/en-US/handbook/workflow/plugins/approval/node.md b/docs/en-US/handbook/workflow-approval/node.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/approval/node.md rename to docs/en-US/handbook/workflow-approval/node.md diff --git a/docs/en-US/handbook/workflow/plugins/approval/trigger.md b/docs/en-US/handbook/workflow-approval/trigger.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/approval/trigger.md rename to docs/en-US/handbook/workflow-approval/trigger.md diff --git a/docs/en-US/handbook/workflow/plugins/custom-action-trigger/action.md b/docs/en-US/handbook/workflow-custom-action-trigger/action.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/custom-action-trigger/action.md rename to docs/en-US/handbook/workflow-custom-action-trigger/action.md diff --git a/docs/en-US/handbook/workflow/plugins/custom-action-trigger/example.md b/docs/en-US/handbook/workflow-custom-action-trigger/example.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/custom-action-trigger/example.md rename to docs/en-US/handbook/workflow-custom-action-trigger/example.md diff --git a/docs/en-US/handbook/workflow/plugins/custom-action-trigger/http-api.md b/docs/en-US/handbook/workflow-custom-action-trigger/http-api.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/custom-action-trigger/http-api.md rename to docs/en-US/handbook/workflow-custom-action-trigger/http-api.md diff --git a/docs/en-US/handbook/workflow/plugins/custom-action-trigger/index.md b/docs/en-US/handbook/workflow-custom-action-trigger/index.md similarity index 86% rename from docs/en-US/handbook/workflow/plugins/custom-action-trigger/index.md rename to docs/en-US/handbook/workflow-custom-action-trigger/index.md index f54b9e4a8..93bd28e7d 100644 --- a/docs/en-US/handbook/workflow/plugins/custom-action-trigger/index.md +++ b/docs/en-US/handbook/workflow-custom-action-trigger/index.md @@ -1,6 +1,6 @@ # Overview - + NocoBase 内置了常见的数据操作(增删改查等),而当这些操作无法满足复杂的业务需求时,可以通过在工作流中使用自定义操作事件,并将该该事件绑定到页面区块的“触发工作流”的按钮上实现自定义的数据操作。 @@ -8,7 +8,7 @@ NocoBase 内置了常见的数据操作(增删改查等),而当这些操 “自定义操作事件”是由原来“操作后事件”中的“提交至工作流”模式演变而来,自 `v1.0.0-alpha.7` 版本开始独立为单独的事件,并更名为“自定义操作事件”。 ::: - + ## 使用手册 diff --git a/docs/en-US/handbook/workflow/plugins/custom-action-trigger/trigger.md b/docs/en-US/handbook/workflow-custom-action-trigger/trigger.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/custom-action-trigger/trigger.md rename to docs/en-US/handbook/workflow-custom-action-trigger/trigger.md diff --git a/docs/zh-CN/handbook/workflow/plugins/delay.md b/docs/en-US/handbook/workflow-delay/index.md similarity index 95% rename from docs/zh-CN/handbook/workflow/plugins/delay.md rename to docs/en-US/handbook/workflow-delay/index.md index e4825ab77..cdd75f4c8 100644 --- a/docs/zh-CN/handbook/workflow/plugins/delay.md +++ b/docs/en-US/handbook/workflow-delay/index.md @@ -1,6 +1,6 @@ # 延时 - + 延时节点可以在流程中增加一个延时,延时结束后,可根据配置是继续执行延时结束后的节点或是提前终止流程。 diff --git a/docs/en-US/handbook/workflow/plugins/dynamic-calculation/collection.md b/docs/en-US/handbook/workflow-dynamic-calculation/collection.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/dynamic-calculation/collection.md rename to docs/en-US/handbook/workflow-dynamic-calculation/collection.md diff --git a/docs/en-US/handbook/workflow/plugins/dynamic-calculation/example.md b/docs/en-US/handbook/workflow-dynamic-calculation/example.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/dynamic-calculation/example.md rename to docs/en-US/handbook/workflow-dynamic-calculation/example.md diff --git a/docs/en-US/handbook/workflow/plugins/dynamic-calculation/index.md b/docs/en-US/handbook/workflow-dynamic-calculation/index.md similarity index 94% rename from docs/en-US/handbook/workflow/plugins/dynamic-calculation/index.md rename to docs/en-US/handbook/workflow-dynamic-calculation/index.md index 72bd37879..86dc91691 100644 --- a/docs/en-US/handbook/workflow/plugins/dynamic-calculation/index.md +++ b/docs/en-US/handbook/workflow-dynamic-calculation/index.md @@ -1,6 +1,6 @@ # Overview - + 区别于普通的运算节点只执行固定的表达式计算,动态表达式节点可以基于数据关联的表达式进行不同的计算。其解决的核心问题是由于普通的公式字段针对数据表所有数据行都只能使用同一个固定公式进行计算,而动态表达式可以针对数据行不同计算方式时,在工作流中进行处理以达成动态计算的目标。 diff --git a/docs/en-US/handbook/workflow/plugins/dynamic-calculation/node.md b/docs/en-US/handbook/workflow-dynamic-calculation/node.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/dynamic-calculation/node.md rename to docs/en-US/handbook/workflow-dynamic-calculation/node.md diff --git a/docs/zh-CN/handbook/workflow/plugins/json-query.md b/docs/en-US/handbook/workflow-json-query/index.md similarity index 96% rename from docs/zh-CN/handbook/workflow/plugins/json-query.md rename to docs/en-US/handbook/workflow-json-query/index.md index e5581f016..bdd593310 100644 --- a/docs/zh-CN/handbook/workflow/plugins/json-query.md +++ b/docs/en-US/handbook/workflow-json-query/index.md @@ -1,10 +1,10 @@ # JSON 解析 - + 用于将一些节点产生的复杂 JSON 数据进行解析,以便后续节点使用。例如 SQL 操作和 HTTP 请求节点的结果,都可能是 JSON 格式的数据,可以通过该节点将其解析为需要的值和变量格式,以便后续节点使用。 - + ## 使用手册 diff --git a/docs/zh-CN/handbook/workflow/plugins/loop.md b/docs/en-US/handbook/workflow-loop/index.md similarity index 98% rename from docs/zh-CN/handbook/workflow/plugins/loop.md rename to docs/en-US/handbook/workflow-loop/index.md index 5e0f88321..168ae4119 100644 --- a/docs/zh-CN/handbook/workflow/plugins/loop.md +++ b/docs/en-US/handbook/workflow-loop/index.md @@ -1,6 +1,6 @@ # 循环 - + 循环相当编程语言中的 `for`/`while`/`forEach` 等语法结构,当需要一定次数或针对某个数据集合(数组)重复执行一些操作时,可以使用循环节点。 diff --git a/docs/en-US/handbook/workflow/plugins/manual/block.md b/docs/en-US/handbook/workflow-manual/block.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/manual/block.md rename to docs/en-US/handbook/workflow-manual/block.md diff --git a/docs/en-US/handbook/workflow/plugins/manual/example.md b/docs/en-US/handbook/workflow-manual/example.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/manual/example.md rename to docs/en-US/handbook/workflow-manual/example.md diff --git a/docs/en-US/handbook/workflow/plugins/manual/index.md b/docs/en-US/handbook/workflow-manual/index.md similarity index 87% rename from docs/en-US/handbook/workflow/plugins/manual/index.md rename to docs/en-US/handbook/workflow-manual/index.md index 484ac0ee4..aa490681d 100644 --- a/docs/en-US/handbook/workflow/plugins/manual/index.md +++ b/docs/en-US/handbook/workflow-manual/index.md @@ -1,6 +1,6 @@ # Overview - + 当业务流程不能完全自动化决策时,可以通过人工节点,将部分决策权交给人工处理。 diff --git a/docs/en-US/handbook/workflow/plugins/manual/node.md b/docs/en-US/handbook/workflow-manual/node.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/manual/node.md rename to docs/en-US/handbook/workflow-manual/node.md diff --git a/docs/zh-CN/handbook/workflow/plugins/parallel.md b/docs/en-US/handbook/workflow-parallel/index.md similarity index 96% rename from docs/zh-CN/handbook/workflow/plugins/parallel.md rename to docs/en-US/handbook/workflow-parallel/index.md index a89a08743..a75a278e4 100644 --- a/docs/zh-CN/handbook/workflow/plugins/parallel.md +++ b/docs/en-US/handbook/workflow-parallel/index.md @@ -32,4 +32,4 @@ ### 示例 -参考 [延时节点](/handbook/workflow/plugins/delay#示例) 中的例子。 +参考 [延时节点](/handbook/workflow-delay#示例) 中的例子。 diff --git a/docs/en-US/handbook/workflow/plugins/request-interceptor/action.md b/docs/en-US/handbook/workflow-request-interceptor/action.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/request-interceptor/action.md rename to docs/en-US/handbook/workflow-request-interceptor/action.md diff --git a/docs/en-US/handbook/workflow/plugins/request-interceptor/advanced.md b/docs/en-US/handbook/workflow-request-interceptor/advanced.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/request-interceptor/advanced.md rename to docs/en-US/handbook/workflow-request-interceptor/advanced.md diff --git a/docs/en-US/handbook/workflow/plugins/request-interceptor/example.md b/docs/en-US/handbook/workflow-request-interceptor/example.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/request-interceptor/example.md rename to docs/en-US/handbook/workflow-request-interceptor/example.md diff --git a/docs/en-US/handbook/workflow/plugins/request-interceptor/http-api.md b/docs/en-US/handbook/workflow-request-interceptor/http-api.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/request-interceptor/http-api.md rename to docs/en-US/handbook/workflow-request-interceptor/http-api.md diff --git a/docs/en-US/handbook/workflow/plugins/request-interceptor/index.md b/docs/en-US/handbook/workflow-request-interceptor/index.md similarity index 88% rename from docs/en-US/handbook/workflow/plugins/request-interceptor/index.md rename to docs/en-US/handbook/workflow-request-interceptor/index.md index 3de4e9e9a..bf9c4968e 100644 --- a/docs/en-US/handbook/workflow/plugins/request-interceptor/index.md +++ b/docs/en-US/handbook/workflow-request-interceptor/index.md @@ -1,10 +1,10 @@ # Overview - + 操作前事件插件提供了一种可以对表单的操作请求进行拦截的机制,拦截事件会在对应的表单操作提交后且被处理之前触发。如果在触发后的流程中有“结束流程”节点被执行,或者其他节点执行失败(出错或其他未能执行完成的情况),则该表单操作将被拦截,否则预定操作将被正常执行。搭配使用“响应消息”节点可以为该流程配置返回客户端的响应消息,以对客户端给出相应的提示信息。操作前事件可用于进行业务验证或逻辑检查,以通过或拦截客户端提交的创建、更新和删除等操作请求。 - + ## 使用手册 diff --git a/docs/en-US/handbook/workflow/plugins/request-interceptor/trigger.md b/docs/en-US/handbook/workflow-request-interceptor/trigger.md similarity index 100% rename from docs/en-US/handbook/workflow/plugins/request-interceptor/trigger.md rename to docs/en-US/handbook/workflow-request-interceptor/trigger.md diff --git a/docs/zh-CN/handbook/workflow/plugins/request.md b/docs/en-US/handbook/workflow-request/index.md similarity index 97% rename from docs/zh-CN/handbook/workflow/plugins/request.md rename to docs/en-US/handbook/workflow-request/index.md index e901a0556..eca3b5353 100644 --- a/docs/zh-CN/handbook/workflow/plugins/request.md +++ b/docs/en-US/handbook/workflow-request/index.md @@ -1,6 +1,6 @@ # HTTP 请求 - + 当需要与另一个 web 系统进行交互时,可以使用 HTTP 请求节点。该节点在执行时会根据配置向对应的地址发出一个 HTTP 请求,可以携带 JSON 或 `application/x-www-form-urlencoded` 格式的数据,完成与外部系统的数据交互。 diff --git a/docs/zh-CN/handbook/workflow/plugins/response-message.md b/docs/en-US/handbook/workflow-response-message/index.md similarity index 94% rename from docs/zh-CN/handbook/workflow/plugins/response-message.md rename to docs/en-US/handbook/workflow-response-message/index.md index d7a3781e4..3c3f60387 100644 --- a/docs/zh-CN/handbook/workflow/plugins/response-message.md +++ b/docs/en-US/handbook/workflow-response-message/index.md @@ -1,6 +1,6 @@ # 响应消息 - + 响应消息节点用于在特定类型的流程中向提交操作的客户端反馈流程中自定义的消息。 @@ -8,7 +8,7 @@ 目前支持在同步模式的“自定义操作事件”、“操作后事件”和“操作前事件”类型的工作流中使用。 ::: - + ## 使用手册 diff --git a/docs/zh-CN/handbook/workflow/plugins/sql.md b/docs/en-US/handbook/workflow-sql/index.md similarity index 95% rename from docs/zh-CN/handbook/workflow/plugins/sql.md rename to docs/en-US/handbook/workflow-sql/index.md index d1ed56b8f..c1eb37397 100644 --- a/docs/zh-CN/handbook/workflow/plugins/sql.md +++ b/docs/en-US/handbook/workflow-sql/index.md @@ -8,7 +8,7 @@ ### SQL 节点的结果如何使用? -如果使用了 `SELECT` 语句,查询结果会以 Seqeulize 的 JSON 格式保存在节点中,可以通过 [JSON-query](/handbook/workflow/plugins/json-query) 插件进行解析并使用。 +如果使用了 `SELECT` 语句,查询结果会以 Seqeulize 的 JSON 格式保存在节点中,可以通过 [JSON-query](/handbook/workflow-json-query) 插件进行解析并使用。 ### SQL 操作是否会触发数据表事件? diff --git a/docs/zh-CN/handbook/workflow/plugins/variable.md b/docs/en-US/handbook/workflow-variable/index.md similarity index 95% rename from docs/zh-CN/handbook/workflow/plugins/variable.md rename to docs/en-US/handbook/workflow-variable/index.md index 518d27a96..cb459a770 100644 --- a/docs/zh-CN/handbook/workflow/plugins/variable.md +++ b/docs/en-US/handbook/workflow-variable/index.md @@ -1,10 +1,10 @@ # 自定义变量 - + 可在流程中声明变量,或为已声明的变量赋值,通常用于在流程中保存一些临时数据。 - + ## 使用手册 diff --git a/docs/en-US/handbook/workflow/advanced.md b/docs/en-US/handbook/workflow/advanced.md deleted file mode 100644 index 7b33dc2e9..000000000 --- a/docs/en-US/handbook/workflow/advanced.md +++ /dev/null @@ -1,154 +0,0 @@ -# Advanced Usage - -From [Quick Start](./index) we have already learned the most basic usage of workflows, this article further introduces some more in-depth concepts. - -## Using Variables - -Just like variables in programming languages, **variables** are important tools for connecting and organizing processes in workflows. - -When each node is executed after the workflow is triggered, variables can be used in some configuration options, and the source of the variables is from data result of upstream node, including the following categories: - -- Trigger context data: In cases such as action triggers and collection triggers, single record object can be used by all nodes. -- Upstream node data: When executing any node, the result data of the previously completed nodes. -- Scope variables: When the node is in some special branch structures, scope variables specific to the corresponding branch can be used, such as in loop structures, where data objects for each round of the loop can be used. -- System variables: Some built-in system parameters, such as the current time, etc. - -We have used the function of variables many times in [Quick Start](./index), for example, in the calculation node, we can use variables to reference trigger context data for calculation: - -![Function and variable usage in the calculation node](https://static-docs.nocobase.com/837e4851a4c70a1932542caadef3431b.png) - -In the update node, use trigger context data as the filtering condition variable, and refer to the result of the calculation node as the field value variable to be updated: - -![Variable in update data node](https://static-docs.nocobase.com/2e147c93643e7ebc709b9b7ab4f3af8c.png) - -The internal of a variable is a JSON structure, which can usually be used to access specific parts of the data according to the path of JSON. Because many variables are based on the data collection of NocoBase, association data will be composed as a tree-like structure of objects, such as selecting the value of a field of related data that is queried. In addition, when association data is a to-many structure, the variable may be an array. - -Selecting variables will often need to select the value attribute at the last layer of the JSON path, usually a simple data type such as number, string, etc. However, when there is an array in the variable hierarchy, the attributes at the end level will also be mapped to an array, and only when the corresponding node supports array can the array data be correctly processed. For example, in the calculation node, some calculation engines have functions specially designed for arrays, and in the loop node, the loop object can directly select an array. - -For example, when a query node queries multiple data rows, the node result will be an array containing multiple rows of homogeneous data: - -```json -[ - { - "id": 1, - "title": "Title 1" - }, - { - "id": 2, - "title": "Title 2" - } -] -``` - -However, when it is used as a variable in subsequent nodes, if the selected variable is in the form of `Node Data / Query Node / Title`, it will be mapped to an flat array of corresponding field values: - -```json -["Title 1", "Title 2"] -``` - -If it is a multi-dimensional array (such as a many-to-many relationship field), it will be a one-dimensional array after the corresponding field is flattened. - -## Execution Plan (History) - -After each workflow is triggered, a corresponding execution plan will be created to track the process of this task. Each execution plan has a status value to indicate the current execution status, which can be viewed in the list and details of the execution history: - -![Execution plan status](https://static-docs.nocobase.com/d4440d92ccafac6fac85da4415bb2a26.png) - -When all nodes in the main branch of the process are executed to the end of the process with a "Succeeded" status, the entire execution plan will end with a "Succeeded" status. When nodes in the main branch of the process appear in final status such as "failed", "error", "canceled" or "rejected", etc., the entire execution plan will be terminated early with the corresponding status. When nodes in the main branch of the process are in a "pending" status, the entire execution plan will be paused, but still display an "On-going" status, until the waiting node is resumed and continues execution. Different node types have different ways of handling the "pending" status. For example, "Manual" nodes need to wait for manual processing, while "Delay" nodes need to wait until the time arrives to continue execution. - -The status of the execution plan is as follows: - -| Status | Corresponding Final Node status in the Main Process | Explanation | -| ------- | --------------------------------------------------- | ----------------------------------------------- | -| Queued | - | The process has been triggered and an execution plan has been generated, waiting in the queue for scheduling by the scheduler. | -| On-going | Pending | The node requests a pause, waiting for further input or callback to continue. | -| Succeeded | Succeeded | No problems encountered, all nodes executed as expected one by one and completed. | -| Failed | Failed | Failed due to unmet the logic of node configurations. | -| Error | Error | The node encountered an uncaught program error and terminated early. | -| Canceled | Canceled | The waiting node was externally canceled from execution by the administrator, and terminated early. | -| Rejected | Rejected | In nodes requiring manual processing, it was rejected by user and no longer continued with subsequent processes. | - -In the examples of [Quick Start](./index), we already know that checking the details of the execution history of a workflow can check whether all nodes in the execution are executed normally, and the status and result data of each executed node. In some advanced workflows and nodes, the executed results of the nodes may be multiple, such as the results of "Loop" nodes: - -![Results of nodes executed multiple times](https://static-docs.nocobase.com/bbda259fa2ddf62b0fc0f982efbedae9.png) - -:::info{title=Note} -Workflows can be triggered concurrently, but executed one by one in queue, even if multiple workflows are triggered simultaneously, they will be executed sequentially, not in parallel. So when the status shows "Queued," it means that one of the workflows is executing and need to wait. - -The "On-going" status only indicates that the execution plan has started and is usually paused due to the pending status of some node, and does not mean that the execution plan preemptively occupies the execution resources at the head of the queue. Therefore, when there are "On-going" execution plans, other "Queued" execution plans can still be scheduled and executed. -::: - -## Node Execution Status - -The status of the execution plan is determined by each node. In an execution plan after a trigger, each executed node will produce a node status, and the status will determine whether the subsequent process continues to process. Usually, after a node is executed successfully, the next node will continue to execute until all nodes are executed in sequence, or interrupted. When encountering process control nodes, such as "Branch", "Loop", "Parallel" and "Delay", etc., the next node's execution flow will be determined according to the control node's configured conditions and the runtime context data. - -The possible status that may be produced after each node is executed are following: - -| Status | Is a Final status? | Will it Terminates Early? | Explanation | -| ------ | :------------------------: | :-------------------------: | -------------------------------------------------------- | -| Pending | No | No | The node requests a pause, waiting for further input or callback to continue. | -| Succeeded | Yes | No | No problems encountered, executed successfully, and continue to execute the next node until the end. | -| Failed | Yes | Yes | Failed due to unmet node configurations. | -| Error | Yes | Yes | The node encountered an uncaught program error and terminated early. | -| Canceled | Yes | Yes | The pending node was canceled externally by the administrator, and terminated early. | -| Rejected | Yes | Yes | In nodes requiring manual processing, it was rejected by user and no longer continued with subsequent processes. | - -Except for the "Pending" status, all other status are final status of node execution. Only when the final status is "Succeeded" the process will continue to execute, otherwise the execution of the entire process will be terminated early. When a node is in a branch process ("Parallel branch", "Condition", "Loop", etc.), the final status generated by the node will be taken over and processed by the node that opens the branch, and so on, determining the entire process flow. - -For example, when we use a "Condition" node with the "continue if true" mode, if the result is "false" during execution, the entire process execution will be terminated early and exited with a failed status, as shown in the figure below: - -![Node execution failed](https://static-docs.nocobase.com/993aecfa1465894bb574444f0a44313e.png) - -:::info{title=Note} -All final status other than "Succeeded" can be regarded as failures, but the reasons for failure will be different, by checking the results of the nodes to know more about the failure. -::: - -## Execution Modes - -Workflow execution is based on the trigger type selected when creating, and can be executed in "Asynchronously" or "Synchronously" mode. "Asynchronously" mode means that after a specific event is triggered, it will enter the execution queue and be executed one by one by the background scheduler, while "synchronously" mode will not enter the scheduling queue after triggering, and will start execution directly, and will immediately provide feedback after execution. - -Collection events, post-action events, custom action events, schedule events and approval events will be executed asynchronously by default, while pre-action events will be executed synchronously by default. Among them, collection events, post-action events and custom action events support both modes, and you can choose when creating a workflow: - -![Synchronous mode: Creating synchronous workflow](https://static-docs.nocobase.com/39bc0821f50c1bde4729c531c6236795.png) - -:::info{title=Note} -Synchronously mode workflows are limited by their mode and cannot use nodes that generate a "pending" status, such as "manual process" etc. -::: - -## Automatically Delete History - -When workflows are triggered frequently, you can reduce interference and database storage pressure by configuring automatic deletion of historical executions. - -Similarly, in the pop-up for creating and editing workflows, you can configure whether the corresponding process automatically deletes history: - -![Configure automatic deletion of history](https://static-docs.nocobase.com/b2e4c08e7a01e213069912fe04baa7bd.png) - -Automatic deletion can be configured based on the status of the execution. In most cases, it is recommended to only select the "Succeeded" status, so that history of execution failures can be retained for subsequent troubleshooting. - -It is recommended not to enable automatic deletion of history when debugging workflows, so that the execution logic of the workflows can be reviewed in history. - -:::info{title=Note} -Deleting the history of workflows will not reduce the count of workflows already executed. -::: - -## Workflow Versions - -After a configured workflow is triggered at least once, if you want to modify the configuration of the workflow or its nodes, you need to create a new version and then modify it, which also ensures that when reviewing execution history of workflows that have been triggered, they are not affected by future modifications. - -On the configuration page of the workflow, you can view existing workflow versions in the version menu in the top right corner: - -![View workflow versions](https://static-docs.nocobase.com/ad93d2c08166b0e3e643fb148713a63f.png) - -In the more operations ("...") menu on the right side, you can do "copy to a new version" based on the current version being viewed: - -![Copy workflow to new version](https://static-docs.nocobase.com/2805798e6caca2af004893390a744256.png) - -After copying to a new version, click the "Enable"/"Disable" switch. After switching the corresponding version to the enabled status, the new workflow version will take effect. - -If you need to use an old version again, switch one from the version menu, and then switch to the enabled status by clicking the "Enable"/"Disable" switch again, then the current viewed version will take effect, and furtuer triggers will run on the corresponding version of the workflow. - -When need to disable a workflow, after clicking the "Enable"/"Disable" switch to the disabled status, the workflow will no longer be triggered. - -:::info{title=Note} -Different from duplicate a workflow in the workflow management list, the workflow copied to a new version will still be grouped in the same group of workflows, but can be distinguished by version. However, duplicating a workflow will be make a completely new workflow, unrelated to the previous versions of the workflow, and the execution count will also be reset to 0. -::: \ No newline at end of file diff --git a/docs/en-US/handbook/workflow/advanced/executions.md b/docs/en-US/handbook/workflow/advanced/executions.md new file mode 100644 index 000000000..4f9365ce3 --- /dev/null +++ b/docs/en-US/handbook/workflow/advanced/executions.md @@ -0,0 +1,54 @@ +# Execution Plan (History) + +After each workflow is triggered, a corresponding execution plan will be created to track the process of this task. Each execution plan has a status value to indicate the current execution status, which can be viewed in the list and details of the execution history: + +![Execution plan status](https://static-docs.nocobase.com/d4440d92ccafac6fac85da4415bb2a26.png) + +When all nodes in the main branch of the process are executed to the end of the process with a "Succeeded" status, the entire execution plan will end with a "Succeeded" status. When nodes in the main branch of the process appear in final status such as "failed", "error", "canceled" or "rejected", etc., the entire execution plan will be terminated early with the corresponding status. When nodes in the main branch of the process are in a "pending" status, the entire execution plan will be paused, but still display an "On-going" status, until the waiting node is resumed and continues execution. Different node types have different ways of handling the "pending" status. For example, "Manual" nodes need to wait for manual processing, while "Delay" nodes need to wait until the time arrives to continue execution. + +The status of the execution plan is as follows: + +| Status | Corresponding Final Node status in the Main Process | Explanation | +| ------- | --------------------------------------------------- | ----------------------------------------------- | +| Queued | - | The process has been triggered and an execution plan has been generated, waiting in the queue for scheduling by the scheduler. | +| On-going | Pending | The node requests a pause, waiting for further input or callback to continue. | +| Succeeded | Succeeded | No problems encountered, all nodes executed as expected one by one and completed. | +| Failed | Failed | Failed due to unmet the logic of node configurations. | +| Error | Error | The node encountered an uncaught program error and terminated early. | +| Canceled | Canceled | The waiting node was externally canceled from execution by the administrator, and terminated early. | +| Rejected | Rejected | In nodes requiring manual processing, it was rejected by user and no longer continued with subsequent processes. | + +In the examples of [Quick Start](../quick-start.md), we already know that checking the details of the execution history of a workflow can check whether all nodes in the execution are executed normally, and the status and result data of each executed node. In some advanced workflows and nodes, the executed results of the nodes may be multiple, such as the results of "Loop" nodes: + +![Results of nodes executed multiple times](https://static-docs.nocobase.com/bbda259fa2ddf62b0fc0f982efbedae9.png) + +:::info{title=Note} +Workflows can be triggered concurrently, but executed one by one in queue, even if multiple workflows are triggered simultaneously, they will be executed sequentially, not in parallel. So when the status shows "Queued," it means that one of the workflows is executing and need to wait. + +The "On-going" status only indicates that the execution plan has started and is usually paused due to the pending status of some node, and does not mean that the execution plan preemptively occupies the execution resources at the head of the queue. Therefore, when there are "On-going" execution plans, other "Queued" execution plans can still be scheduled and executed. +::: + +## Node Execution Status + +The status of the execution plan is determined by each node. In an execution plan after a trigger, each executed node will produce a node status, and the status will determine whether the subsequent process continues to process. Usually, after a node is executed successfully, the next node will continue to execute until all nodes are executed in sequence, or interrupted. When encountering process control nodes, such as "Branch", "Loop", "Parallel" and "Delay", etc., the next node's execution flow will be determined according to the control node's configured conditions and the runtime context data. + +The possible status that may be produced after each node is executed are following: + +| Status | Is a Final status? | Will it Terminates Early? | Explanation | +| ------ | :------------------------: | :-------------------------: | -------------------------------------------------------- | +| Pending | No | No | The node requests a pause, waiting for further input or callback to continue. | +| Succeeded | Yes | No | No problems encountered, executed successfully, and continue to execute the next node until the end. | +| Failed | Yes | Yes | Failed due to unmet node configurations. | +| Error | Yes | Yes | The node encountered an uncaught program error and terminated early. | +| Canceled | Yes | Yes | The pending node was canceled externally by the administrator, and terminated early. | +| Rejected | Yes | Yes | In nodes requiring manual processing, it was rejected by user and no longer continued with subsequent processes. | + +Except for the "Pending" status, all other status are final status of node execution. Only when the final status is "Succeeded" the process will continue to execute, otherwise the execution of the entire process will be terminated early. When a node is in a branch process ("Parallel branch", "Condition", "Loop", etc.), the final status generated by the node will be taken over and processed by the node that opens the branch, and so on, determining the entire process flow. + +For example, when we use a "Condition" node with the "continue if true" mode, if the result is "false" during execution, the entire process execution will be terminated early and exited with a failed status, as shown in the figure below: + +![Node execution failed](https://static-docs.nocobase.com/993aecfa1465894bb574444f0a44313e.png) + +:::info{title=Note} +All final status other than "Succeeded" can be regarded as failures, but the reasons for failure will be different, by checking the results of the nodes to know more about the failure. +::: diff --git a/docs/en-US/handbook/workflow/advanced/options.md b/docs/en-US/handbook/workflow/advanced/options.md new file mode 100644 index 000000000..1258022ca --- /dev/null +++ b/docs/en-US/handbook/workflow/advanced/options.md @@ -0,0 +1,29 @@ +# Advanced Options + +## Execution Modes + +Workflow execution is based on the trigger type selected when creating, and can be executed in "Asynchronously" or "Synchronously" mode. "Asynchronously" mode means that after a specific event is triggered, it will enter the execution queue and be executed one by one by the background scheduler, while "synchronously" mode will not enter the scheduling queue after triggering, and will start execution directly, and will immediately provide feedback after execution. + +Collection events, post-action events, custom action events, schedule events and approval events will be executed asynchronously by default, while pre-action events will be executed synchronously by default. Among them, collection events, post-action events and custom action events support both modes, and you can choose when creating a workflow: + +![Synchronous mode: Creating synchronous workflow](https://static-docs.nocobase.com/39bc0821f50c1bde4729c531c6236795.png) + +:::info{title=Note} +Synchronously mode workflows are limited by their mode and cannot use nodes that generate a "pending" status, such as "manual process" etc. +::: + +## Automatically Delete History + +When workflows are triggered frequently, you can reduce interference and database storage pressure by configuring automatic deletion of historical executions. + +Similarly, in the pop-up for creating and editing workflows, you can configure whether the corresponding process automatically deletes history: + +![Configure automatic deletion of history](https://static-docs.nocobase.com/b2e4c08e7a01e213069912fe04baa7bd.png) + +Automatic deletion can be configured based on the status of the execution. In most cases, it is recommended to only select the "Succeeded" status, so that history of execution failures can be retained for subsequent troubleshooting. + +It is recommended not to enable automatic deletion of history when debugging workflows, so that the execution logic of the workflows can be reviewed in history. + +:::info{title=Note} +Deleting the history of workflows will not reduce the count of workflows already executed. +::: diff --git a/docs/en-US/handbook/workflow/advanced/revisions.md b/docs/en-US/handbook/workflow/advanced/revisions.md new file mode 100644 index 000000000..be13af2a4 --- /dev/null +++ b/docs/en-US/handbook/workflow/advanced/revisions.md @@ -0,0 +1,21 @@ +# Revisions + +After a configured workflow is triggered at least once, if you want to modify the configuration of the workflow or its nodes, you need to create a new version and then modify it, which also ensures that when reviewing execution history of workflows that have been triggered, they are not affected by future modifications. + +On the configuration page of the workflow, you can view existing workflow versions in the version menu in the top right corner: + +![View workflow versions](https://static-docs.nocobase.com/ad93d2c08166b0e3e643fb148713a63f.png) + +In the more operations ("...") menu on the right side, you can do "copy to a new version" based on the current version being viewed: + +![Copy workflow to new version](https://static-docs.nocobase.com/2805798e6caca2af004893390a744256.png) + +After copying to a new version, click the "Enable"/"Disable" switch. After switching the corresponding version to the enabled status, the new workflow version will take effect. + +If you need to use an old version again, switch one from the version menu, and then switch to the enabled status by clicking the "Enable"/"Disable" switch again, then the current viewed version will take effect, and furtuer triggers will run on the corresponding version of the workflow. + +When need to disable a workflow, after clicking the "Enable"/"Disable" switch to the disabled status, the workflow will no longer be triggered. + +:::info{title=Note} +Different from duplicate a workflow in the workflow management list, the workflow copied to a new version will still be grouped in the same group of workflows, but can be distinguished by version. However, duplicating a workflow will be make a completely new workflow, unrelated to the previous versions of the workflow, and the execution count will also be reset to 0. +::: \ No newline at end of file diff --git a/docs/en-US/handbook/workflow/advanced/variables.md b/docs/en-US/handbook/workflow/advanced/variables.md new file mode 100644 index 000000000..aa690b306 --- /dev/null +++ b/docs/en-US/handbook/workflow/advanced/variables.md @@ -0,0 +1,61 @@ +# Using Variables + +## Core Conception + +Just like variables in programming languages, **variables** are important tools for connecting and organizing processes in workflows. + +When each node is executed after the workflow is triggered, variables can be used in some configuration options, and the source of the variables is from data result of upstream node, including the following categories: + +- Trigger context data: In cases such as action triggers and collection triggers, single record object can be used by all nodes. +- Upstream node data: When executing any node, the result data of the previously completed nodes. +- Scope variables: When the node is in some special branch structures, scope variables specific to the corresponding branch can be used, such as in loop structures, where data objects for each round of the loop can be used. +- System variables: Some built-in system parameters, such as the current time, etc. + +We have used the function of variables many times in [Quick Start](../quick-start.md), for example, in the calculation node, we can use variables to reference trigger context data for calculation: + +![Function and variable usage in the calculation node](https://static-docs.nocobase.com/837e4851a4c70a1932542caadef3431b.png) + +In the update node, use trigger context data as the filtering condition variable, and refer to the result of the calculation node as the field value variable to be updated: + +![Variable in update data node](https://static-docs.nocobase.com/2e147c93643e7ebc709b9b7ab4f3af8c.png) + +## Data Structure + +The internal of a variable is a JSON structure, which can usually be used to access specific parts of the data according to the path of JSON. Because many variables are based on the data collection of NocoBase, association data will be composed as a tree-like structure of objects, such as selecting the value of a field of related data that is queried. In addition, when association data is a to-many structure, the variable may be an array. + +Selecting variables will often need to select the value attribute at the last layer of the JSON path, usually a simple data type such as number, string, etc. However, when there is an array in the variable hierarchy, the attributes at the end level will also be mapped to an array, and only when the corresponding node supports array can the array data be correctly processed. For example, in the calculation node, some calculation engines have functions specially designed for arrays, and in the loop node, the loop object can directly select an array. + +For example, when a query node queries multiple data rows, the node result will be an array containing multiple rows of homogeneous data: + +```json +[ + { + "id": 1, + "title": "Title 1" + }, + { + "id": 2, + "title": "Title 2" + } +] +``` + +However, when it is used as a variable in subsequent nodes, if the selected variable is in the form of `Node Data / Query Node / Title`, it will be mapped to an flat array of corresponding field values: + +```json +["Title 1", "Title 2"] +``` + +If it is a multi-dimensional array (such as a many-to-many relationship field), it will be a one-dimensional array after the corresponding field is flattened. + +## Builtin System Variables + +### System Time + +Retrieve the system time at the moment of execution based on the node where it is executed. The time zone is determined by the server's settings. + +### Date Range Parameters + +This can be used for configuring date field filter conditions in query, update, and delete nodes. It only supports "Is" comparisons, and the start and end points of the date range are based on the server's time zone settings. + +![Date Range Parameters](https://static-docs.nocobase.com/20240817175354.png) \ No newline at end of file diff --git a/docs/en-US/handbook/workflow/nodes/aggregate.md b/docs/en-US/handbook/workflow/nodes/aggregate.md index d5e809084..5439ce1bf 100644 --- a/docs/en-US/handbook/workflow/nodes/aggregate.md +++ b/docs/en-US/handbook/workflow/nodes/aggregate.md @@ -1,3 +1,3 @@ # Aggregate Query - + diff --git a/docs/en-US/handbook/workflow/nodes/approval.md b/docs/en-US/handbook/workflow/nodes/approval.md index a5722ae70..0ad06ffa6 100644 --- a/docs/en-US/handbook/workflow/nodes/approval.md +++ b/docs/en-US/handbook/workflow/nodes/approval.md @@ -1,9 +1,9 @@ # Approval - + - + ## Related Content -Except for node configuration, there are also some related contents about approval that can be further understood through the [plugin documentation](../plugins/approval/index.md). +Except for node configuration, there are also some related contents about approval that can be further understood through the [plugin documentation](../../workflow-approval/index.md). diff --git a/docs/en-US/handbook/workflow/nodes/delay.md b/docs/en-US/handbook/workflow/nodes/delay.md index 8a1eee29d..368ed5414 100644 --- a/docs/en-US/handbook/workflow/nodes/delay.md +++ b/docs/en-US/handbook/workflow/nodes/delay.md @@ -1,3 +1,3 @@ # Delay - + diff --git a/docs/en-US/handbook/workflow/nodes/dynamic-calculation.md b/docs/en-US/handbook/workflow/nodes/dynamic-calculation.md index f4f557a78..71b98bb77 100644 --- a/docs/en-US/handbook/workflow/nodes/dynamic-calculation.md +++ b/docs/en-US/handbook/workflow/nodes/dynamic-calculation.md @@ -1,7 +1,7 @@ # Dynamic Calculation - + ## Related Content -Except for node configuration, there are also some related contents about dynamic calculation that can be further understood through the [plugin documentation](../plugins/dynamic-calculation/index.md). +Except for node configuration, there are also some related contents about dynamic calculation that can be further understood through the [plugin documentation](../../workflow-dynamic-calculation/index.md). diff --git a/docs/en-US/handbook/workflow/nodes/index.md b/docs/en-US/handbook/workflow/nodes/index.md index af892339b..6521823a1 100755 --- a/docs/en-US/handbook/workflow/nodes/index.md +++ b/docs/en-US/handbook/workflow/nodes/index.md @@ -9,13 +9,15 @@ Workflow triggers are not considered to be nodes but are displayed in the workfl From a functional perspective, the nodes implemented so far are in four categories (a total of 18 types of nodes): - Flow Control - - [Calculation](./calculation.md) - [Condition](./condition.md) - [Delay](./delay.md) (provided by plugin @nocobase/plugin-workflow-deley) - [End Process](./end.md) - [Loop](./loop.md) (provided by plugin @nocobase/plugin-workflow-loop) - [Parallel Branch](./parallel.md) (provided by plugin @nocobase/plugin-workflow-parallel) - [Custom Variable](./variable.md) (provided by plugin @nocobase/plugin-workflow-variable) +- Calculation + - [Calculation](./calculation.md) + - [Dynamic Expression Calculation](./dynamic-calculation.md) (provided by plugin @nocobase/plugin-workflow-dynamic-calculation) - Data Table Operations - [Create record](./create.md) - [Update record](./update.md) @@ -28,5 +30,4 @@ From a functional perspective, the nodes implemented so far are in four categori - [Approval](./approval.md) (provided by plugin @nocobase/plugin-workflow-approval) - Other Extensions - [HTTP Request](./request.md) (provided by plugin @nocobase/plugin-workflow-request) - - [Dynamic Expression Calculation](./dynamic-calculation.md) (provided by plugin @nocobase/plugin-workflow-dynamic-calculation) - [Response Message](./response-message.md) (provided by plugin @nocobase/plugin-workflow-response-message) diff --git a/docs/en-US/handbook/workflow/nodes/json-query.md b/docs/en-US/handbook/workflow/nodes/json-query.md index 8d60edea6..4d0773a43 100644 --- a/docs/en-US/handbook/workflow/nodes/json-query.md +++ b/docs/en-US/handbook/workflow/nodes/json-query.md @@ -1,3 +1,3 @@ # JSON Query - + diff --git a/docs/en-US/handbook/workflow/nodes/loop.md b/docs/en-US/handbook/workflow/nodes/loop.md index da81256ef..9b57df665 100644 --- a/docs/en-US/handbook/workflow/nodes/loop.md +++ b/docs/en-US/handbook/workflow/nodes/loop.md @@ -1,3 +1,3 @@ # Loop - + diff --git a/docs/en-US/handbook/workflow/nodes/manual.md b/docs/en-US/handbook/workflow/nodes/manual.md index 76709f38d..ac1235bb6 100644 --- a/docs/en-US/handbook/workflow/nodes/manual.md +++ b/docs/en-US/handbook/workflow/nodes/manual.md @@ -1,9 +1,9 @@ # Manual Process - + - + ## Related Content -Except for node configuration, there are also some related contents about manual process that can be further understood through the [plugin documentation](../plugins/manual/index.md). +Except for node configuration, there are also some related contents about manual process that can be further understood through the [plugin documentation](../../workflow-manual/index.md). diff --git a/docs/en-US/handbook/workflow/nodes/parallel.md b/docs/en-US/handbook/workflow/nodes/parallel.md index 412358a3c..13ac5a6c7 100644 --- a/docs/en-US/handbook/workflow/nodes/parallel.md +++ b/docs/en-US/handbook/workflow/nodes/parallel.md @@ -1,3 +1,3 @@ # Parallel Branch - + diff --git a/docs/en-US/handbook/workflow/nodes/request.md b/docs/en-US/handbook/workflow/nodes/request.md index 651ddb646..02c79587d 100644 --- a/docs/en-US/handbook/workflow/nodes/request.md +++ b/docs/en-US/handbook/workflow/nodes/request.md @@ -1,3 +1,3 @@ # HTTP Request - + diff --git a/docs/en-US/handbook/workflow/nodes/response-message.md b/docs/en-US/handbook/workflow/nodes/response-message.md index 383dc2ceb..ea1cd011a 100644 --- a/docs/en-US/handbook/workflow/nodes/response-message.md +++ b/docs/en-US/handbook/workflow/nodes/response-message.md @@ -1,3 +1,3 @@ # Response Message - + diff --git a/docs/en-US/handbook/workflow/nodes/sql.md b/docs/en-US/handbook/workflow/nodes/sql.md index 38df5d1ff..970f47014 100644 --- a/docs/en-US/handbook/workflow/nodes/sql.md +++ b/docs/en-US/handbook/workflow/nodes/sql.md @@ -1,3 +1,3 @@ # SQL Operation - + diff --git a/docs/en-US/handbook/workflow/nodes/variable.md b/docs/en-US/handbook/workflow/nodes/variable.md index 2e414c30c..a4956b91a 100644 --- a/docs/en-US/handbook/workflow/nodes/variable.md +++ b/docs/en-US/handbook/workflow/nodes/variable.md @@ -1,3 +1,3 @@ # Custom Variable - + diff --git a/docs/en-US/handbook/workflow/plugins/aggregate.md b/docs/en-US/handbook/workflow/plugins/aggregate.md index f816936ee..319268ff8 100644 --- a/docs/en-US/handbook/workflow/plugins/aggregate.md +++ b/docs/en-US/handbook/workflow/plugins/aggregate.md @@ -1,6 +1,6 @@ # Aggregate - + 用于对某个数据表的满足条件的数据进行聚合函数查询,并返回对应的统计结果。常用于处理报表相关的统计数据。 diff --git a/docs/en-US/handbook/workflow/plugins/delay.md b/docs/en-US/handbook/workflow/plugins/delay.md index 5ce5bfdb4..71d11b121 100644 --- a/docs/en-US/handbook/workflow/plugins/delay.md +++ b/docs/en-US/handbook/workflow/plugins/delay.md @@ -1,6 +1,6 @@ # Delay - + 延时节点可以在流程中增加一个延时,延时结束后,可根据配置是继续执行延时结束后的节点或是提前终止流程。 diff --git a/docs/en-US/handbook/workflow/plugins/json-query.md b/docs/en-US/handbook/workflow/plugins/json-query.md index 47dfedec2..6c541ce9c 100644 --- a/docs/en-US/handbook/workflow/plugins/json-query.md +++ b/docs/en-US/handbook/workflow/plugins/json-query.md @@ -1,10 +1,10 @@ # JSON Query - + 用于将一些节点产生的复杂 JSON 数据进行解析,以便后续节点使用。例如 SQL 操作和 HTTP 请求节点的结果,都可能是 JSON 格式的数据,可以通过该节点将其解析为需要的值和变量格式,以便后续节点使用。 - + ## 使用手册 diff --git a/docs/en-US/handbook/workflow/plugins/loop.md b/docs/en-US/handbook/workflow/plugins/loop.md index 5491e274f..3452585ad 100644 --- a/docs/en-US/handbook/workflow/plugins/loop.md +++ b/docs/en-US/handbook/workflow/plugins/loop.md @@ -1,6 +1,6 @@ # Loop - + 循环相当编程语言中的 `for`/`while`/`forEach` 等语法结构,当需要一定次数或针对某个数据集合(数组)重复执行一些操作时,可以使用循环节点。 diff --git a/docs/en-US/handbook/workflow/plugins/parallel.md b/docs/en-US/handbook/workflow/plugins/parallel.md index 3638d998d..50bee466c 100644 --- a/docs/en-US/handbook/workflow/plugins/parallel.md +++ b/docs/en-US/handbook/workflow/plugins/parallel.md @@ -32,4 +32,4 @@ ### 示例 -参考 [延时节点](/handbook/workflow/plugins/delay#示例) 中的例子。 +参考 [延时节点](/handbook/workflow-delay#示例) 中的例子。 diff --git a/docs/en-US/handbook/workflow/plugins/request.md b/docs/en-US/handbook/workflow/plugins/request.md index dcdb6a906..0b12f299d 100644 --- a/docs/en-US/handbook/workflow/plugins/request.md +++ b/docs/en-US/handbook/workflow/plugins/request.md @@ -1,6 +1,6 @@ # HTTP Request - + 当需要与另一个 web 系统进行交互时,可以使用 HTTP 请求节点。该节点在执行时会根据配置向对应的地址发出一个 HTTP 请求,可以携带 JSON 或 `application/x-www-form-urlencoded` 格式的数据,完成与外部系统的数据交互。 diff --git a/docs/en-US/handbook/workflow/plugins/response-message.md b/docs/en-US/handbook/workflow/plugins/response-message.md index 4199aa8a0..cb5eddcd8 100644 --- a/docs/en-US/handbook/workflow/plugins/response-message.md +++ b/docs/en-US/handbook/workflow/plugins/response-message.md @@ -1,6 +1,6 @@ # Response Message - + 响应消息节点用于在特定类型的流程中向提交操作的客户端反馈流程中自定义的消息。 @@ -8,7 +8,7 @@ 目前支持在同步模式的“自定义操作事件”、“操作后事件”和“操作前事件”类型的工作流中使用。 ::: - + ## 使用手册 diff --git a/docs/en-US/handbook/workflow/plugins/sql.md b/docs/en-US/handbook/workflow/plugins/sql.md index 703b8562a..fc7eb9871 100644 --- a/docs/en-US/handbook/workflow/plugins/sql.md +++ b/docs/en-US/handbook/workflow/plugins/sql.md @@ -8,7 +8,7 @@ ### SQL 节点的结果如何使用? -如果使用了 `SELECT` 语句,查询结果会以 Seqeulize 的 JSON 格式保存在节点中,可以通过 [JSON-query](/handbook/workflow/plugins/json-query) 插件进行解析并使用。 +如果使用了 `SELECT` 语句,查询结果会以 Seqeulize 的 JSON 格式保存在节点中,可以通过 [JSON-query](/handbook/workflow-json-query) 插件进行解析并使用。 ### SQL 操作是否会触发数据表事件? diff --git a/docs/en-US/handbook/workflow/plugins/variable.md b/docs/en-US/handbook/workflow/plugins/variable.md index 2b1138638..428952db8 100644 --- a/docs/en-US/handbook/workflow/plugins/variable.md +++ b/docs/en-US/handbook/workflow/plugins/variable.md @@ -1,10 +1,10 @@ # Custom Variable - + 可在流程中声明变量,或为已声明的变量赋值,通常用于在流程中保存一些临时数据。 - + ## 使用手册 diff --git a/docs/en-US/handbook/workflow/triggers/approval.md b/docs/en-US/handbook/workflow/triggers/approval.md index e17e2c4e2..f3ff5c97f 100644 --- a/docs/en-US/handbook/workflow/triggers/approval.md +++ b/docs/en-US/handbook/workflow/triggers/approval.md @@ -1,9 +1,9 @@ # Approval - + - + -## Related content +## Related Content -Except for trigger configuration, there are also some related contents about approval that can be further understood through the [plugin documentation](../plugins/approval/index.md). +Except for trigger configuration, there are also some related contents about approval that can be further understood through the [plugin documentation](../../workflow-approval/index.md). diff --git a/docs/en-US/handbook/workflow/triggers/custom-action.md b/docs/en-US/handbook/workflow/triggers/custom-action.md index 8d7082e6e..b6cfabc43 100644 --- a/docs/en-US/handbook/workflow/triggers/custom-action.md +++ b/docs/en-US/handbook/workflow/triggers/custom-action.md @@ -1,9 +1,9 @@ # Custom action event - + - + ## Related content -Except for trigger configuration, there are also some related contents about custom action trigger that can be further understood through the [plugin documentation](../plugins/custom-action-trigger/index.md). +Except for trigger configuration, there are also some related contents about custom action trigger that can be further understood through the [plugin documentation](../../workflow-custom-action-trigger/index.md). diff --git a/docs/en-US/handbook/workflow/triggers/post-action.md b/docs/en-US/handbook/workflow/triggers/post-action.md index 407d95c91..9a2896968 100644 --- a/docs/en-US/handbook/workflow/triggers/post-action.md +++ b/docs/en-US/handbook/workflow/triggers/post-action.md @@ -1,10 +1,10 @@ # Post-action event - + - + ## Related content -Except for trigger configuration, there are also some related contents about post-action trigger that can be further understood through the [plugin documentation](../plugins/action-trigger/index.md). +Except for trigger configuration, there are also some related contents about post-action trigger that can be further understood through the [plugin documentation](../../workflow-action-trigger/index.md). diff --git a/docs/en-US/handbook/workflow/triggers/pre-action.md b/docs/en-US/handbook/workflow/triggers/pre-action.md index 693c6b50c..03cf4a278 100644 --- a/docs/en-US/handbook/workflow/triggers/pre-action.md +++ b/docs/en-US/handbook/workflow/triggers/pre-action.md @@ -1,9 +1,9 @@ # Pre-action trigger - + - + ## Related content -Except for trigger configuration, there are also some related contents about pre-action trigger that can be further understood through the [plugin documentation](../plugins/request-interceptor/index.md). +Except for trigger configuration, there are also some related contents about pre-action trigger that can be further understood through the [plugin documentation](../../workflow-request-interceptor/index.md). diff --git a/docs/en-US/welcome/changelog/20240519.md b/docs/en-US/welcome/changelog/20240519.md index e892cc41f..d34ccaace 100644 --- a/docs/en-US/welcome/changelog/20240519.md +++ b/docs/en-US/welcome/changelog/20240519.md @@ -10,7 +10,7 @@ Supports users logging in to NocoBase using their LDAP server credentials. For m ### Workflow plugin: custom action trigger -When CRUD actions cannot satisfy your needs, you can use the custom action trigger of the workflow to orchestrate your own data processing logic. For more information, refer to the [Workflow / Custom action trigger](/handbook/workflow/plugins/custom-action-trigger) documentation. +When CRUD actions cannot satisfy your needs, you can use the custom action trigger of the workflow to orchestrate your own data processing logic. For more information, refer to the [Workflow / Custom action trigger](/handbook/workflow-custom-action-trigger) documentation. ![](https://static-docs.nocobase.com/202405191515770.png) diff --git a/docs/en-US/welcome/release/20240519-changelog.md b/docs/en-US/welcome/release/20240519-changelog.md index 44f68c0b1..b4b9162d1 100644 --- a/docs/en-US/welcome/release/20240519-changelog.md +++ b/docs/en-US/welcome/release/20240519-changelog.md @@ -42,7 +42,7 @@ Previously, the value input fields in the "Headers" and "Parameters" sections of ### Workflow Custom Action Event -The "Submit to Workflow" action button, originally bound to directly trigger type of the "Post-action Events", has been split and independently created as the "Trigger Workflow" action button for "Custom Action Events" (a commercial plugin). The previously added action buttons in the open-source version can still be used, but no longer supported for new additions. Please use the new "Custom Action Event" instead. See the [Usage Manual](https://docs-cn.nocobase.com/handbook/workflow/plugins/custom-action-trigger) for more information. +The "Submit to Workflow" action button, originally bound to directly trigger type of the "Post-action Events", has been split and independently created as the "Trigger Workflow" action button for "Custom Action Events" (a commercial plugin). The previously added action buttons in the open-source version can still be used, but no longer supported for new additions. Please use the new "Custom Action Event" instead. See the [Usage Manual](https://docs-cn.nocobase.com/handbook/workflow-custom-action-trigger) for more information. diff --git a/docs/zh-CN/api/server/plugin.md b/docs/zh-CN/api/server/plugin.md index 5c7e05eb8..0c957a4cc 100644 --- a/docs/zh-CN/api/server/plugin.md +++ b/docs/zh-CN/api/server/plugin.md @@ -90,29 +90,6 @@ export default PluginDemoServer; 插件移除后执行。 -### `onSync()` - -在分布式环境中,处理来自其他节点当前插件发布的同步事件。在插件使用了内存状态时,需要覆盖实现该事件的处理逻辑,以保证与其他节点的状态同步。 - -#### 签名 - -``` -onSync(message: SyncMessage): void | Promise -``` - -#### 参数 - -- `message` 同步消息。其他节点发送的消息内容,键值对的形式。 - -#### 示例 - -```ts -onSync(message: SyncMessage) { - console.log('onSync', message); - // this.reloadData(); -} -``` - ## 其他方法 ### `t()` @@ -127,14 +104,14 @@ onSync(message: SyncMessage) { 实现性方法。输出插件相关配置信息。 -### `sync()` +### `sendSyncMessage()` 发布同步消息。使用该方法发送的同步消息只会被其他节点的同一个插件接收,与其他插件无关。 #### 签名 ```ts -sync(data: SyncMessageData = {}): void | Promise +sendSyncMessage(message: any): Promise ``` #### 参数 @@ -144,7 +121,30 @@ sync(data: SyncMessageData = {}): void | Promise #### 示例 ```ts -this.sync({ +await this.sendSyncMessage({ key: 'value' }); ``` + +### `handleSyncMessage()` + +在分布式环境中,处理来自其他节点当前插件发布的同步事件。在插件使用了内存状态时,需要覆盖实现该事件的处理逻辑,以保证与其他节点的状态同步。 + +#### 签名 + +``` +handleSyncMessage(message: any): void | Promise +``` + +#### 参数 + +- `message` 同步消息。其他节点发送的消息内容。 + +#### 示例 + +```ts +handleSyncMessage(message) { + console.log('handleSyncMessage', message); + // this.reloadData(); +} +``` diff --git a/docs/zh-CN/api/server/sync-manager.md b/docs/zh-CN/api/server/sync-manager.md deleted file mode 100644 index 8aa629b0e..000000000 --- a/docs/zh-CN/api/server/sync-manager.md +++ /dev/null @@ -1,74 +0,0 @@ -# SyncManager - -用于管理多节点之间的同步信号。在分布式部署中,当内存状态改变时,需要通知其他节点进行同步。同步信号管理提供了一套通用的调用接口,可在任意模块中以统一的方式使用。 - -同步管理器内部不实现具体的同步功能,而是提供了一套统一的接口,具体的同步逻辑由基于其他中间件的适配器插件实现。例如,可以通过基于 Redis、Etcd、RabbitMQ、Kafak 等中间件实现的同步适配器插件。 - -## `SyncManager` - -### 成员 - -#### `constructor()` - -构造函数,创建一个同步管理器实例。应用初始化时会自动创建一个实例,并作为应用的全局可访问属性(`app.syncManager`),无需调用。 - -#### `available: Boolean` - -同步管理器是否可用。 - -当已初始化适配器,且适配器已连接相应的中间件后,会返回 `true`。否则返回 `false`。 - -#### `init(adapter: SyncAdapter)` - -初始化同步管理器。 - -该方法仅可调用一次,通常在加载相关适配器插件时,向同步管理器注册适配器实例。多次调用将抛出异常,将导致应用无法启动,需要管理员检查是否有不同的插件重复注入适配器。 - -#### `subscribe(namespace: string, callback: SyncEventCallback)` - -订阅同步事件。 - -- `namespace`:命名空间,用于区分不同的同步事件。 -- `callback`:事件回调函数,当同步事件发生时,会调用该函数。 - -#### `unsubscribe(namespace: string, callback: SyncEventCallback)` - -取消订阅同步事件。 - -#### `publish(namespace: string, data: SyncMessageData = {})` - -发布同步消息。 - -- `namespace`:命名空间,用于区分不同的同步事件。 -- `data`:同步消息数据。 - -:::warning{title=注意} -同步消息数据必须是键值对形式,键和值都是字符串类型。 -::: - -### 相关类型 - -```ts -export type SyncMessageData = Record; - -export type SyncEventCallback = (message: SyncMessageData) => void; - -export type SyncMessage = { - namespace: string; - nodeId: string; - appName: string; -} & SyncMessageData; -``` - -## `SyncAdapter` - -同步适配器抽象类,定义了同步适配器必须实现的接口,任何同步适配器的实现都必须继承该类。该类继承自 Node.js 的 `EventEmitter` 类。 - -### 相关类型 - -```ts -export abstract class SyncAdapter extends EventEmitter { - abstract get ready(): boolean; - public abstract publish(data: SyncMessage): void | Promise; -} -``` diff --git a/docs/zh-CN/api/server/sync-message-manager.md b/docs/zh-CN/api/server/sync-message-manager.md new file mode 100644 index 000000000..7cfa0c605 --- /dev/null +++ b/docs/zh-CN/api/server/sync-message-manager.md @@ -0,0 +1,37 @@ +# SyncMessageManager + +用于管理多节点之间的同步信号。在分布式部署中,当内存状态改变时,需要通知其他节点进行同步。同步信号管理提供了一套通用的调用接口,可在任意模块中以统一的方式使用。 + +同步管理器内部不实现具体的同步功能,而是提供了一套统一的接口,并调用底层的 pubSubManager 进行消息发送和接收。 + +## `SyncMessageManager` + +### 成员 + +#### `constructor()` + +构造函数,创建一个同步管理器实例。应用初始化时会自动创建一个实例,并作为应用的全局可访问属性(`app.syncManager`),无需调用。 + +#### `subscribe(channel: string, callback: PubSubCallback)` + +订阅同步事件。 + +- `channel`:频道名称,用于区分不同的同步事件。 +- `callback`:事件回调函数,当同步事件发生时,会调用该函数。 + +#### `unsubscribe(channel: string, callback: PubSubCallback)` + +取消订阅同步事件。 + +#### `publish(channel: string, message: any)` + +发布同步消息。 + +- `channel`:频道名称,用于区分不同的同步事件。 +- `message`:同步消息数据。 + +### 相关类型 + +```ts +export type PubSubCallback = (message: any) => Promise; +``` diff --git a/docs/zh-CN/handbook/ui/actions/types/trigger-workflow.md b/docs/zh-CN/handbook/ui/actions/types/trigger-workflow.md index d4cbf3874..aad3b77ff 100644 --- a/docs/zh-CN/handbook/ui/actions/types/trigger-workflow.md +++ b/docs/zh-CN/handbook/ui/actions/types/trigger-workflow.md @@ -1,5 +1,5 @@ # 触发工作流 - + - + diff --git a/docs/zh-CN/handbook/ui/blocks/other-blocks/workflow-approval.md b/docs/zh-CN/handbook/ui/blocks/other-blocks/workflow-approval.md index a446a4d17..b2a792a1b 100644 --- a/docs/zh-CN/handbook/ui/blocks/other-blocks/workflow-approval.md +++ b/docs/zh-CN/handbook/ui/blocks/other-blocks/workflow-approval.md @@ -1,3 +1,3 @@ # 工作流:审批相关区块 - \ No newline at end of file + diff --git a/docs/zh-CN/handbook/ui/blocks/other-blocks/workflow-manual-todos.md b/docs/zh-CN/handbook/ui/blocks/other-blocks/workflow-manual-todos.md index 99b2bb320..f7345bc7c 100644 --- a/docs/zh-CN/handbook/ui/blocks/other-blocks/workflow-manual-todos.md +++ b/docs/zh-CN/handbook/ui/blocks/other-blocks/workflow-manual-todos.md @@ -1,3 +1,3 @@ # 工作流:人工待办区块 - \ No newline at end of file + diff --git a/docs/zh-CN/handbook/workflow/plugins/action-trigger/action.md b/docs/zh-CN/handbook/workflow-action-trigger/action.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/action-trigger/action.md rename to docs/zh-CN/handbook/workflow-action-trigger/action.md diff --git a/docs/zh-CN/handbook/workflow/plugins/action-trigger/example.md b/docs/zh-CN/handbook/workflow-action-trigger/example.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/action-trigger/example.md rename to docs/zh-CN/handbook/workflow-action-trigger/example.md diff --git a/docs/zh-CN/handbook/workflow/plugins/action-trigger/http-api.md b/docs/zh-CN/handbook/workflow-action-trigger/http-api.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/action-trigger/http-api.md rename to docs/zh-CN/handbook/workflow-action-trigger/http-api.md diff --git a/docs/zh-CN/handbook/workflow/plugins/action-trigger/index.md b/docs/zh-CN/handbook/workflow-action-trigger/index.md similarity index 98% rename from docs/zh-CN/handbook/workflow/plugins/action-trigger/index.md rename to docs/zh-CN/handbook/workflow-action-trigger/index.md index 8ddc7b8fe..00a9fda28 100644 --- a/docs/zh-CN/handbook/workflow/plugins/action-trigger/index.md +++ b/docs/zh-CN/handbook/workflow-action-trigger/index.md @@ -1,6 +1,6 @@ # 概述 - + 系统中的所有用户产生的数据变动,通常都通过某项操作来完成,具体形式通常是点击某个按钮,按钮可能是表单中的提交按钮,也可能是数据区块中的操作按钮。操作后事件用于对这些按钮的操作绑定相关的工作流,以达成用户操作成功后触发特定流程的效果。 diff --git a/docs/zh-CN/handbook/workflow/plugins/action-trigger/trigger.md b/docs/zh-CN/handbook/workflow-action-trigger/trigger.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/action-trigger/trigger.md rename to docs/zh-CN/handbook/workflow-action-trigger/trigger.md diff --git a/docs/zh-CN/handbook/workflow-aggregate/index.md b/docs/zh-CN/handbook/workflow-aggregate/index.md new file mode 100644 index 000000000..ac9cb3fc9 --- /dev/null +++ b/docs/zh-CN/handbook/workflow-aggregate/index.md @@ -0,0 +1,67 @@ +# 聚合查询 + + + +用于对某个数据表的满足条件的数据进行聚合函数查询,并返回对应的统计结果。常用于处理报表相关的统计数据。 + +节点的实现上基于数据库的聚合函数,目前仅支持对一个数据表的单字段进行统计,统计结果的数值会保存在节点的结果中供后续其他节点使用。 + +## 安装 + +内置插件,无需安装。 + +## 使用手册 + +### 创建节点 + +在工作流配置界面中,点击流程中的加号(“+”)按钮,添加“聚合查询”节点: + +![创建聚合查询节点](https://static-docs.nocobase.com/7f9d806ebf5064f80c30f8b67f316f0f.png) + +### 节点配置 + +![聚合查询节点_节点配置](https://static-docs.nocobase.com/57362f747b9992230567c6bb5e986fd2.png) + +#### 聚合函数 + +支持 SQL 中的 `COUNT`、`SUM`、`AVG`、`MIN` 和 `MAX` 共 5 种聚合函数,选择其中一种对数据进行聚合查询。 + +#### 目标类型 + +聚合查询的目标可以通过两种模式选择,一种是直接选择目标数据表和其中的一个字段,另一种是通过流程上下文已有的数据对象,选择其对多的关系数据表及字段,进行聚合查询。 + +#### 去重 + +即 SQL 中的 `DISTINCT`,去重的字段与选择的数据表字段相同,暂时不支持两者选不同的字段。 + +#### 筛选条件 + +与普通的数据表查询时的筛选条件类似,可以使用流程的上下文变量。 + +### 示例 + +聚合目标为“数据表数据”比较容易理解,这里以“统计新增文章后该文章分类的总文章数”为例,介绍聚合目标为“关联数据表数据”的用法。 + +首先,创建两张数据表:“文章”和“分类”,其中文章有一个多对一关系字段指向分类表,同时创建反向关系字段分类一对多文章: + +| 字段名 | 类型 | +| -------- | -------------- | +| 标题 | 单行文本 | +| 所属分类 | 多对一(分类) | + +| 字段名 | 类型 | +| -------- | -------------- | +| 分类名称 | 单行文本 | +| 包含文章 | 一对多(文章) | + +接下来创建一个数据表事件触发的工作流,选择文章表新增数据后触发。 + +之后增加一个聚合查询节点,配置如下: + +![聚合查询节点_示例_节点配置](https://static-docs.nocobase.com/542272e638c6c0a567373d1b37ddda78.png) + +这样在工作流被触发后,聚合查询节点中将会统计新增文章的分类下所有文章的数量,并保存为节点的结果。 + +:::info{title=提示} +其中如需使用数据表事件触发器的关系数据,需要在触发器中配置“预加载关联数据”的相关字段,否则无法选择。 +::: diff --git a/docs/zh-CN/handbook/workflow/plugins/approval/action.md b/docs/zh-CN/handbook/workflow-approval/action.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/approval/action.md rename to docs/zh-CN/handbook/workflow-approval/action.md diff --git a/docs/zh-CN/handbook/workflow/plugins/approval/advanced.md b/docs/zh-CN/handbook/workflow-approval/advanced.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/approval/advanced.md rename to docs/zh-CN/handbook/workflow-approval/advanced.md diff --git a/docs/zh-CN/handbook/workflow/plugins/approval/block.md b/docs/zh-CN/handbook/workflow-approval/block.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/approval/block.md rename to docs/zh-CN/handbook/workflow-approval/block.md diff --git a/docs/zh-CN/handbook/workflow/plugins/approval/http-api.md b/docs/zh-CN/handbook/workflow-approval/http-api.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/approval/http-api.md rename to docs/zh-CN/handbook/workflow-approval/http-api.md diff --git a/docs/zh-CN/handbook/workflow/plugins/approval/index.md b/docs/zh-CN/handbook/workflow-approval/index.md similarity index 89% rename from docs/zh-CN/handbook/workflow/plugins/approval/index.md rename to docs/zh-CN/handbook/workflow-approval/index.md index 14a44ce9d..cc699bc5f 100644 --- a/docs/zh-CN/handbook/workflow/plugins/approval/index.md +++ b/docs/zh-CN/handbook/workflow-approval/index.md @@ -1,12 +1,12 @@ # 概述 - + 审批是一种专用于人工发起且由人工处理以决定相关数据状态的流程形式。通常用于办公自动化或其他人工决策事务的流程管理,例如可以创建并管理“请假申请”、“费用报销审批”和“原料采购审批”等场景的人工流程。 审批插件提供了专用的工作流类型(触发器)“审批(事件)”和专用于该流程的“审批”节点,结合 NocoBase 特有的自定义数据表和自定义区块,可以快速且灵活地创建与管理各类审批场景。 - + ## 使用手册 diff --git a/docs/zh-CN/handbook/workflow/plugins/approval/node.md b/docs/zh-CN/handbook/workflow-approval/node.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/approval/node.md rename to docs/zh-CN/handbook/workflow-approval/node.md diff --git a/docs/zh-CN/handbook/workflow/plugins/approval/trigger.md b/docs/zh-CN/handbook/workflow-approval/trigger.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/approval/trigger.md rename to docs/zh-CN/handbook/workflow-approval/trigger.md diff --git a/docs/zh-CN/handbook/workflow/plugins/custom-action-trigger/action.md b/docs/zh-CN/handbook/workflow-custom-action-trigger/action.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/custom-action-trigger/action.md rename to docs/zh-CN/handbook/workflow-custom-action-trigger/action.md diff --git a/docs/zh-CN/handbook/workflow/plugins/custom-action-trigger/example.md b/docs/zh-CN/handbook/workflow-custom-action-trigger/example.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/custom-action-trigger/example.md rename to docs/zh-CN/handbook/workflow-custom-action-trigger/example.md diff --git a/docs/zh-CN/handbook/workflow/plugins/custom-action-trigger/http-api.md b/docs/zh-CN/handbook/workflow-custom-action-trigger/http-api.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/custom-action-trigger/http-api.md rename to docs/zh-CN/handbook/workflow-custom-action-trigger/http-api.md diff --git a/docs/zh-CN/handbook/workflow/plugins/custom-action-trigger/index.md b/docs/zh-CN/handbook/workflow-custom-action-trigger/index.md similarity index 86% rename from docs/zh-CN/handbook/workflow/plugins/custom-action-trigger/index.md rename to docs/zh-CN/handbook/workflow-custom-action-trigger/index.md index a41649a3c..e6a4ba21a 100644 --- a/docs/zh-CN/handbook/workflow/plugins/custom-action-trigger/index.md +++ b/docs/zh-CN/handbook/workflow-custom-action-trigger/index.md @@ -1,6 +1,6 @@ # 概述 - + NocoBase 内置了常见的数据操作(增删改查等),而当这些操作无法满足复杂的业务需求时,可以通过在工作流中使用自定义操作事件,并将该该事件绑定到页面区块的“触发工作流”的按钮上实现自定义的数据操作。 @@ -8,7 +8,7 @@ NocoBase 内置了常见的数据操作(增删改查等),而当这些操 “自定义操作事件”是由原来“操作后事件”中的“提交至工作流”模式演变而来,自 `v1.0.0-alpha.7` 版本开始独立为单独的事件,并更名为“自定义操作事件”。 ::: - + ## 使用手册 diff --git a/docs/zh-CN/handbook/workflow/plugins/custom-action-trigger/trigger.md b/docs/zh-CN/handbook/workflow-custom-action-trigger/trigger.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/custom-action-trigger/trigger.md rename to docs/zh-CN/handbook/workflow-custom-action-trigger/trigger.md diff --git a/docs/zh-CN/handbook/workflow-delay/index.md b/docs/zh-CN/handbook/workflow-delay/index.md new file mode 100644 index 000000000..cdd75f4c8 --- /dev/null +++ b/docs/zh-CN/handbook/workflow-delay/index.md @@ -0,0 +1,37 @@ +# 延时 + + + +延时节点可以在流程中增加一个延时,延时结束后,可根据配置是继续执行延时结束后的节点或是提前终止流程。 + +通常配合并行分支节点一起使用,可以在其中一个分支中增加延时节点,以达到超时后相关处理的目的。例如并行分支中其中一个分支包含人工处理,另一个分支包含延时节点,当人工处理超时后,如果设置的是超时失败,则代表人工处理必须在限定时间内完成,如果设置的是超时继续,则代表到时间后可以忽略该人工处理。 + +## 安装 + +内置插件,无需安装。 + +## 使用手册 + +### 创建节点 + +在工作流配置界面中,点击流程中的加号(“+”)按钮,添加“延时”节点: + +![创建延时节点](https://static-docs.nocobase.com/d0816999c9f7acaec1c409bd8fb6cc36.png) + +### 节点配置 + +![延时节点_节点配置](https://static-docs.nocobase.com/5fe8a36535f20a087a0148ffa1cd2aea.png) + +#### 延时时间 + +延时时间可以填写一个数字,并选择时间单位,支持的时间单位有:秒、分钟、小时、天和周。 + +#### 到时状态 + +到时状态可以选择“通过并继续”和“失败并退出”,前者代表延时结束后,流程会继续执行延时结束后的节点,后者代表延时结束后,流程会以失败状态提前终止。 + +### 示例 + +以工单发起后需要在限时内答复的场景为例,我们需要在并行的两个分支中其一添加一个人工节点,另一个分支添加延时节点,如果人工处理未在 10 分钟内答复,则更新工单状态为超时未处理。 + +![延时节点_示例_流程组织](https://static-docs.nocobase.com/898c84adc376dc211b003a62e16e8e5b.png) diff --git a/docs/zh-CN/handbook/workflow/plugins/dynamic-calculation/collection.md b/docs/zh-CN/handbook/workflow-dynamic-calculation/collection.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/dynamic-calculation/collection.md rename to docs/zh-CN/handbook/workflow-dynamic-calculation/collection.md diff --git a/docs/zh-CN/handbook/workflow/plugins/dynamic-calculation/example.md b/docs/zh-CN/handbook/workflow-dynamic-calculation/example.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/dynamic-calculation/example.md rename to docs/zh-CN/handbook/workflow-dynamic-calculation/example.md diff --git a/docs/zh-CN/handbook/workflow/plugins/dynamic-calculation/index.md b/docs/zh-CN/handbook/workflow-dynamic-calculation/index.md similarity index 94% rename from docs/zh-CN/handbook/workflow/plugins/dynamic-calculation/index.md rename to docs/zh-CN/handbook/workflow-dynamic-calculation/index.md index e09fff644..ea1064995 100644 --- a/docs/zh-CN/handbook/workflow/plugins/dynamic-calculation/index.md +++ b/docs/zh-CN/handbook/workflow-dynamic-calculation/index.md @@ -1,6 +1,6 @@ # 概述 - + 区别于普通的运算节点只执行固定的表达式计算,动态表达式节点可以基于数据关联的表达式进行不同的计算。其解决的核心问题是由于普通的公式字段针对数据表所有数据行都只能使用同一个固定公式进行计算,而动态表达式可以针对数据行不同计算方式时,在工作流中进行处理以达成动态计算的目标。 diff --git a/docs/zh-CN/handbook/workflow/plugins/dynamic-calculation/node.md b/docs/zh-CN/handbook/workflow-dynamic-calculation/node.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/dynamic-calculation/node.md rename to docs/zh-CN/handbook/workflow-dynamic-calculation/node.md diff --git a/docs/zh-CN/handbook/workflow-json-query/index.md b/docs/zh-CN/handbook/workflow-json-query/index.md new file mode 100644 index 000000000..bdd593310 --- /dev/null +++ b/docs/zh-CN/handbook/workflow-json-query/index.md @@ -0,0 +1,140 @@ +# JSON 解析 + + + +用于将一些节点产生的复杂 JSON 数据进行解析,以便后续节点使用。例如 SQL 操作和 HTTP 请求节点的结果,都可能是 JSON 格式的数据,可以通过该节点将其解析为需要的值和变量格式,以便后续节点使用。 + + + +## 使用手册 + +### 创建节点 + +在工作流配置界面中,点击流程中的加号(“+”)按钮,添加“JSON 解析”节点: + +![创建节点](https://static-docs.nocobase.com/7de796517539ad9dfc88b7160f1d0dd7.png) + +:::info{title=提示} +通常会将 JSON 解析节点创建在其他数据节点的下方,以便对其进行解析。 +::: + +### 节点配置 + +#### 解析引擎 + +JSON 解析节点通过不同的解析引擎来支持不同的解析语法,可以根据自己的偏好和各个引擎的特色来进行选择。目前支持三种解析引擎: + +- [JMESPath](https://jmespath.org/) +- [JSONPath Plus](https://jsonpath-plus.github.io/JSONPath/docs/ts/) +- [JSONata](https://jsonata.org/) + +![解析引擎选择](https://static-docs.nocobase.com/29be3b92a62b7d20312d1673e749f2ec.png) + +#### 数据源 + +数据源可以是上游节点的结果,也可以是流程上下文中的数据对象,通常是一个没有内置结构化的数据对象,例如 SQL 节点的结果,或者 HTTP 请求节点的结果。 + +![数据源](https://static-docs.nocobase.com/f5a97e20693b3d30b3a994a576aa282d.png) + +:::info{title=提示} +通常数据表相关节点的数据对象都是通过数据表配置信息结构化过的,一般不需要通过 JSON 解析节点进行解析。 +::: + +#### 解析表达式 + +基于解析需求和解析引擎的不同,自定义的解析表达式。 + +![解析表达式](https://static-docs.nocobase.com/181abd162fd32c09b62f6aa1d1cb3ed4.png) + +:::info{title=提示} +不同解析引擎提供不同的解析语法,具体可以查阅链接中的文档。 +::: + +自 `v1.0.0-alpha.15` 版本起,表达式支持使用变量,变量会在具体的引擎执行前进行预解析,按照字符串模板的规则将变量替换为具体的字符串值,并与表达式的其他静态字符串拼接为最终的表达式。这个功能在需要动态构建表达式时非常有用,例如某些 JSON 内容需要动态 key 来解析的时候。 + +#### 属性映射 + +当解析的结果是一个对象(或对象数组)时,可以通过属性映射进一步将所需要的属性映射为子级变量,以供后续节点使用。 + +![属性映射](https://static-docs.nocobase.com/b876abe4ccf6b4709eb8748f21ef3527.png) + +:::info{title=提示} +对于对象(或对象数组)结果,如果不进行属性映射,则会将整个对象(或对象数组)作为一个变量保存在节点的结果中,无法以变量的方式直接使用对象的属性值。 +::: + +### 示例 + +假设需要解析的数据是前序的 SQL 节点用于查询数据,其结果为一组订单数据: + +```json +[ + [ + { + "id": 1, + "products": [ + { + "id": 1, + "title": "Product 1", + "price": 100, + "quantity": 1 + }, + { + "id": 2, + "title": "Product 2", + "price": 120, + "quantity": 2 + } + ] + }, + { + "id": 2, + "products": [ + { + "id": 3, + "title": "Product 3", + "price": 130, + "quantity": 1 + }, + { + "id": 4, + "title": "Product 4", + "price": 140, + "quantity": 2 + } + ] + } + ] +] +``` + +:::info{title=提示} +以上代码中外层的数组并非错误,而是 SQL 节点返回的正常结果,因为 SQL 节点的结果是一个二元数组,第一个元素是查询的结果行,第二个元素是查询的元信息。 +::: + +如果我们需要解析并计算出数据中两个订单分别的总价,并和对应的订单 ID 组装成对象,用于更新订单总价,可以按下面的配置: + +![示例-解析 SQL 配置](https://static-docs.nocobase.com/e62322a868b26ff98120bfcd6dcdb3bd.png) + +1. 选择 JSONata 解析引擎; +2. 选择 SQL 节点的结果作为数据源; +3. 使用 JSONata 表达式 `$[0].{"id": id, "total": products.(price * quantity)}` 解析; +4. 选择属性映射,将 `id` 和 `total` 映射为子级变量; + +最终的解析结果如下: + +```json +[ + { + "id": 1, + "total": 340 + }, + { + "id": 2, + "total": 410 + } +] +``` + +之后再循环取值完成的订单数组,更新订单的总价即可。 + +![更新对应订单的总价](https://static-docs.nocobase.com/b3329b0efe4471f5eed1f0673bef740e.png) diff --git a/docs/zh-CN/handbook/workflow-loop/index.md b/docs/zh-CN/handbook/workflow-loop/index.md new file mode 100644 index 000000000..168ae4119 --- /dev/null +++ b/docs/zh-CN/handbook/workflow-loop/index.md @@ -0,0 +1,85 @@ +# 循环 + + + +循环相当编程语言中的 `for`/`while`/`forEach` 等语法结构,当需要一定次数或针对某个数据集合(数组)重复执行一些操作时,可以使用循环节点。 + +## 安装 + +内置插件,无需安装。 + +## 使用手册 + +### 创建节点 + +在工作流配置界面中,点击流程中的加号(“+”)按钮,添加“循环”节点: + +![创建循环节点](https://static-docs.nocobase.com/b3c8061a66bfff037f4b9509ab0aad75.png) + +创建循环节点后,会生成一个循环内部的分支,可以在分支中增加任意多个节点,这些节点除了可以使用流程上下文的变量,还可以使用循环上下文的局部变量,例如循环集合中每次循环到的数据对象,或者是循环次数的索引(索引从 `0` 开始计数)。局部变量的作用域仅限于循环内部,如果有多层循环嵌套,可以按层使用具体循环的局部变量。 + +### 节点配置 + +#### 循环对象 + +循环会以循环对象不同数据类型做不同的处理: + +1. **数组**:最常见的情况,通常是可以选择流程上下文的变量,比如查询节点的多条数据结果,或者预加载的对多关系数据。如果选择的是数组,循环节点会遍历数组中的每个元素,每次循环都会将当前元素赋值给循环上下文的局部变量。 + +2. **数字**:当选择的变量是一个数字时,会以该数字为循环次数,局域变量中的循环次数的索引也即循环对象的值。 + +3. **字符串**:当选择的变量是一个字符串时,会以该字符串的长度为循环次数,每次按索引处理字符串中的每一个字符。 + +4. **其他**:其他类型的值(包括对象类型)都仅作为单次处理的循环对象,也只会循环一次,通常这种情况不需要使用循环。 + +除了选择变量,针对数字和字符串类型也可以直接输入常量,例如输入 `5`(数字类型),循环节点会循环 5 次,输入 `abc`(字符串类型),循环节点会循环 3 次,分别处理 `a`、`b`、`c` 三个字符。在选择变量的工具中选择希望使用常量的类型。 + +### 示例 + +例如在订单下单时,需要对订单中的每个商品进行库存检查,如果库存充足则扣减库存,否则订单明细内的商品更新为无效。 + +1. 创建三张表,商品表 <-(1:m)-- 订单明细表 --(m:1)-> 订单表,数据模型如下: + + | 字段名称 | 字段类型 | + | ------------ | -------------- | + | 订单商品明细 | 多对一(明细) | + | 订单总价 | 数字 | + + | 字段名称 | 字段类型 | + | -------- | -------------- | + | 商品 | 一对多(商品) | + | 数量 | 数字 | + + | 字段名称 | 字段类型 | + | -------- | -------- | + | 商品名称 | 单行文本 | + | 价格 | 数字 | + | 库存 | 整数 | + +2. 创建工作流,触发器选择“数据表事件”,选择“订单”表“新增数据时”触发,并且需要配置上预加载“订单明细”表和明细下的商品表的关系数据: + + ![循环节点_示例_触发器配置](https://static-docs.nocobase.com/0086601c2fc0e17a64d046a4c86b49b7.png) + +3. 创建循环节点,选择循环对象为“触发数据 / 订单明细”,即对订单明细表中的每一条数据: + + ![循环节点_示例_循环节点配置](https://static-docs.nocobase.com/2507becc32db5a9a0641c198605a20da.png) + +4. 循环节点内部创建一个“条件判断”节点,判断商品的库存是否充足: + + ![循环节点_示例_条件判断节点配置](https://static-docs.nocobase.com/a6d08d15786841e1a3512b38e4629852.png) + +5. 如果充足则在“是”的分支中创建一个“计算节点”和一个“更新数据”节点,将计算完扣减的库存更新至对应商品的记录: + + ![循环节点_示例_计算节点配置](https://static-docs.nocobase.com/8df3604c71f8f8705b1552d3ebfe3b50.png) + + ![循环节点_示例_更新库存节点配置](https://static-docs.nocobase.com/2d84baa9b3b01bd85fccda9eec992378.png) + +6. 否则在“否”的分支中创建一个“更新数据”节点,更新订单明细的状态为“无效”: + + ![循环节点_示例_更新订单明细节点配置](https://static-docs.nocobase.com/4996613090c254c69a1d80f3b3a7fae2.png) + +总的流程结构如下图: + +![循环节点_示例_流程结构](https://static-docs.nocobase.com/6f59ef246c1f19976344a7624c4c4151.png) + +配置完成并激活该流程后,当创建新订单时,会自动检查订单明细中的商品库存,如果库存充足则扣减库存,否则订单明细内的商品更新为无效(以便计算有效的订单总价)。 diff --git a/docs/zh-CN/handbook/workflow/plugins/manual/block.md b/docs/zh-CN/handbook/workflow-manual/block.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/manual/block.md rename to docs/zh-CN/handbook/workflow-manual/block.md diff --git a/docs/zh-CN/handbook/workflow/plugins/manual/example.md b/docs/zh-CN/handbook/workflow-manual/example.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/manual/example.md rename to docs/zh-CN/handbook/workflow-manual/example.md diff --git a/docs/zh-CN/handbook/workflow/plugins/manual/index.md b/docs/zh-CN/handbook/workflow-manual/index.md similarity index 87% rename from docs/zh-CN/handbook/workflow/plugins/manual/index.md rename to docs/zh-CN/handbook/workflow-manual/index.md index e8d85eae1..bc8af9943 100644 --- a/docs/zh-CN/handbook/workflow/plugins/manual/index.md +++ b/docs/zh-CN/handbook/workflow-manual/index.md @@ -1,6 +1,6 @@ # 概述 - + 当业务流程不能完全自动化决策时,可以通过人工节点,将部分决策权交给人工处理。 diff --git a/docs/zh-CN/handbook/workflow/plugins/manual/node.md b/docs/zh-CN/handbook/workflow-manual/node.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/manual/node.md rename to docs/zh-CN/handbook/workflow-manual/node.md diff --git a/docs/zh-CN/handbook/workflow-parallel/index.md b/docs/zh-CN/handbook/workflow-parallel/index.md new file mode 100644 index 000000000..a75a278e4 --- /dev/null +++ b/docs/zh-CN/handbook/workflow-parallel/index.md @@ -0,0 +1,35 @@ +# 并行分支 + +并行分支节点可以将流程分为多个分支,每个分支可以配置不同的节点,根据分支的模式不同,分支的执行方式也不同。在需要在同时执行多个操作的场景下,可以使用并行分支节点。 + +## 安装 + +内置插件,无需安装。 + +## 使用手册 + +### 创建节点 + +在工作流配置界面中,点击流程中的加号(“+”)按钮,添加“并行分支”节点: + +![并行分支_添加](https://static-docs.nocobase.com/9e0f3faa0b9335270647a30477559eac.png) + +在流程中增加并行分支节点后,会默认增加两个子分支,同时也可以点击增加分支的按钮增加任意多个分支,每个分支都可以增加任意的节点,不需要的分支可以点击分支开始处的删除按钮删除。 + +![并行分支_分支管理](https://static-docs.nocobase.com/36088a8b7970c8a1771eb3ee9bc2a757.png) + +### 节点配置 + +#### 分支模式 + +并行分支节点有以下三种模式: + +- **全部成功**:所有分支都执行成功,流程才会继续执行分支结束后的节点。否则任意分支提前终止,无论是失败、出错还是其他非成功状态,都导致整个并行分支节点以该状态提前终止,也称作“All 模式”。 +- **任意成功**:任意分支执行成功,流程就会继续执行分支结束后的节点。除非所有分支都提前终止,无论是失败、出错还是其他非成功状态,才会导致整个并行分支节点以该状态提前终止,也称作“Any 模式”。 +- **任意成功和失败**:任意分支执行成功后流程就会继续执行分支结束后的节点,但任意节点失败后,会导致整个并行以该状态提前终止,也称作“Race 模式”。 + +不论哪种模式,都会从左到右依次尝试执行每个分支,直到满足分支预设模式的相关条件后,继续执行后续节点或提前退出。 + +### 示例 + +参考 [延时节点](/handbook/workflow-delay#示例) 中的例子。 diff --git a/docs/zh-CN/handbook/workflow/plugins/request-interceptor/action.md b/docs/zh-CN/handbook/workflow-request-interceptor/action.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/request-interceptor/action.md rename to docs/zh-CN/handbook/workflow-request-interceptor/action.md diff --git a/docs/zh-CN/handbook/workflow/plugins/request-interceptor/advanced.md b/docs/zh-CN/handbook/workflow-request-interceptor/advanced.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/request-interceptor/advanced.md rename to docs/zh-CN/handbook/workflow-request-interceptor/advanced.md diff --git a/docs/zh-CN/handbook/workflow/plugins/request-interceptor/example.md b/docs/zh-CN/handbook/workflow-request-interceptor/example.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/request-interceptor/example.md rename to docs/zh-CN/handbook/workflow-request-interceptor/example.md diff --git a/docs/zh-CN/handbook/workflow/plugins/request-interceptor/http-api.md b/docs/zh-CN/handbook/workflow-request-interceptor/http-api.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/request-interceptor/http-api.md rename to docs/zh-CN/handbook/workflow-request-interceptor/http-api.md diff --git a/docs/zh-CN/handbook/workflow/plugins/request-interceptor/index.md b/docs/zh-CN/handbook/workflow-request-interceptor/index.md similarity index 88% rename from docs/zh-CN/handbook/workflow/plugins/request-interceptor/index.md rename to docs/zh-CN/handbook/workflow-request-interceptor/index.md index 8a008920a..5919d9671 100644 --- a/docs/zh-CN/handbook/workflow/plugins/request-interceptor/index.md +++ b/docs/zh-CN/handbook/workflow-request-interceptor/index.md @@ -1,10 +1,10 @@ # 概述 - + 操作前事件插件提供了一种可以对表单的操作请求进行拦截的机制,拦截事件会在对应的表单操作提交后且被处理之前触发。如果在触发后的流程中有“结束流程”节点被执行,或者其他节点执行失败(出错或其他未能执行完成的情况),则该表单操作将被拦截,否则预定操作将被正常执行。搭配使用“响应消息”节点可以为该流程配置返回客户端的响应消息,以对客户端给出相应的提示信息。操作前事件可用于进行业务验证或逻辑检查,以通过或拦截客户端提交的创建、更新和删除等操作请求。 - + ## 使用手册 diff --git a/docs/zh-CN/handbook/workflow/plugins/request-interceptor/trigger.md b/docs/zh-CN/handbook/workflow-request-interceptor/trigger.md similarity index 100% rename from docs/zh-CN/handbook/workflow/plugins/request-interceptor/trigger.md rename to docs/zh-CN/handbook/workflow-request-interceptor/trigger.md diff --git a/docs/zh-CN/handbook/workflow-request/index.md b/docs/zh-CN/handbook/workflow-request/index.md new file mode 100644 index 000000000..eca3b5353 --- /dev/null +++ b/docs/zh-CN/handbook/workflow-request/index.md @@ -0,0 +1,87 @@ +# HTTP 请求 + + + +当需要与另一个 web 系统进行交互时,可以使用 HTTP 请求节点。该节点在执行时会根据配置向对应的地址发出一个 HTTP 请求,可以携带 JSON 或 `application/x-www-form-urlencoded` 格式的数据,完成与外部系统的数据交互。 + +如果对 Postman 这类请求发送工具比较熟悉,那么可以很快掌握 HTTP 请求节点的用法。与这些工具不同的是,HTTP 请求节点中各项参数均可使用当前流程中的上下文变量,可以与当前系统的业务处理有机结合起来。 + +## 安装 + +内置插件,无需安装。 + +## 使用手册 + +### 创建节点 + +在工作流配置界面中,点击流程中的加号(“+”)按钮,添加“HTTP 请求”节点: + +![HTTP 请求_添加](https://static-docs.nocobase.com/46f2a6fc3f6869c80f8fbd362a54e644.png) + +### 节点配置 + +![HTTP请求节点_节点配置](https://static-docs.nocobase.com/2fcb29af66b892fa704add52e2974a52.png) + +#### 请求方法 + +可选的 HTTP 请求方法:`GET`、`POST`、`PUT`、`PATCH` 和 `DELETE`。 + +#### 请求地址 + +HTTP 服务的 URL,需要包含协议部分(`http://` 或 `https://`),推荐使用 `https://`。 + +#### 请求数据格式 + +即请求头中的 `Content-Type`,支持 `application/json` 和 `application/x-www-form-urlencoded` 两种格式。 + +#### 请求头配置 + +请求 Header 部分的键值对,相关值可以使用流程上下文的变量。 + +:::info{title=提示} +对 `Content-Type` 请求头,已通过请求数据格式配置,无需填写,覆盖无效。 +::: + +#### 请求参数 + +请求 query 部分的键值对,相关值可以使用流程上下文的变量。 + +#### 请求体 + +请求的 Body 部分,目前仅支持标准的 JSON 格式,可以通过文本编辑框右上角的变量按钮插入流程上下文中的变量。 + +:::info{title=提示} +注:变量必须在 JSON 的字符串中使用,例如:`"a": "{{$context.data.a}}"`。 +::: + +#### 超时设置 + +当请求长时间未响应时,通过超时设置取消该请求的执行。请求超时后会以失败状态提前终止当前流程。 + +#### 忽略失败 + +请求节点会以标准 HTTP 状态码的 `200`~`299` 之间(含)的状态认为是成功状态,其他的均认为是失败。如勾选了“忽略失败的请求并继续工作流”选项,则当请求失败后仍继续执行后续的其他流程节点。 + +### 使用响应结果 + +HTTP 请求的响应结果可以通过 [JSON 解析](./plugins/json-query.md) 节点进行解析,以便后续节点使用。 + +自 `v1.0.0-alpha.16` 版本起,请求节点结果响应中的三个部分可以分别作为变量使用: + +* 响应状态码 +* 响应头 +* 响应数据 + +![HTTP请求节点_响应结果使用](https://static-docs.nocobase.com/20240529110610.png) + +其中响应状态码通常是数字形式的标准的 HTTP 状态码,如 `200`、`403` 等(具体由服务提供方给出)。 + +响应头(Response headers)为 JSON 格式,包括 JSON 格式的响应数据,仍需要使用 JSON 节点节点解析后使用。 + +### 示例 + +例如我们可以使用请求节点来对接云平台发送通知短信,以阿里云发送短信接口为例配置如下(相关参数需自行查阅文档适配): + +![HTTP请求节点_节点配置](https://static-docs.nocobase.com/20240515124004.png) + +工作流触发该节点执行时会以配置的内容调用阿里云的短信接口,请求成功的话将通过短信云服务发送一条短信。 diff --git a/docs/zh-CN/handbook/workflow-response-message/index.md b/docs/zh-CN/handbook/workflow-response-message/index.md new file mode 100644 index 000000000..3c3f60387 --- /dev/null +++ b/docs/zh-CN/handbook/workflow-response-message/index.md @@ -0,0 +1,45 @@ +# 响应消息 + + + +响应消息节点用于在特定类型的流程中向提交操作的客户端反馈流程中自定义的消息。 + +:::info{title=提示} +目前支持在同步模式的“自定义操作事件”、“操作后事件”和“操作前事件”类型的工作流中使用。 +::: + + + +## 使用手册 + +### 创建节点 + +在支持的工作流类型中,可以在流程中的任意位置中添加“响应消息”节点,点击流程中的加号(“+”)按钮,添加“响应消息”节点: + +![添加节点](https://static-docs.nocobase.com/eac2b3565e95e4ce59f340624062ed3d.png) + +响应消息会在整个请求过程中以数组的形式存在,在流程中执行到任意响应消息节点时均会将新的消息内容追加至数组中,在服务端发送响应内容时,会将所有消息一并发送至客户端。 + +### 节点配置 + +消息内容整体是一个模板字符串,其中可以插入变量,在节点配置中可以任意组织该模板内容: + +![节点配置](https://static-docs.nocobase.com/d5fa5f4002d50baf3ba16048818fddfc.png) + +在流程执行到该节点时,会对模板进行解析,并生成出消息内容的结果,上面的配置中,变量“局域变量 / 循环所有产品 / 循环对象 / 产品 / 标题”会在实际流程中被替换为特定的值,例如: + +``` +产品 “iPhone 14 pro” 的库存不足 +``` + +![消息内容](https://static-docs.nocobase.com/06bd4a6b6ec499c853f0c39987f63a6a.png) + +### 使用场景 + +#### “操作前事件”流程 + +“操作前事件”流程中使用响应消息可以在流程结束后向客户端发送对应的消息反馈,具体参考[请求拦截](../triggers/pre-action.md)。 + +#### “操作后事件”流程 + +在同步模式的“操作后事件”中,响应消息会在流程执行完毕后向客户端提示,与“操作前事件”流程不同的是,不管操作后事件的工作流以何种状态退出(成功、失败等),展示的提示信息均为“成功”状态的提示,这是因为发起流程的操作已正常完成,而绑定的工作流是否执行成功,并不影响之前的操作的结果。 diff --git a/docs/zh-CN/handbook/workflow-sql/index.md b/docs/zh-CN/handbook/workflow-sql/index.md new file mode 100644 index 000000000..c1eb37397 --- /dev/null +++ b/docs/zh-CN/handbook/workflow-sql/index.md @@ -0,0 +1,33 @@ +# SQL 操作 + +在一些特殊场景里,上面简单的数据表操作节点可能无法复杂的操作,则可以直接使用 SQL 节点,使数据库直接执行复杂的 SQL 语句进行数据操作。 + +与在应用外部直接连接数据库进行 SQL 操作的区别是,在工作流内可以使用流程上下文的变量,作为 SQL 语句中的部分参数。 + +## FAQ + +### SQL 节点的结果如何使用? + +如果使用了 `SELECT` 语句,查询结果会以 Seqeulize 的 JSON 格式保存在节点中,可以通过 [JSON-query](/handbook/workflow-json-query) 插件进行解析并使用。 + +### SQL 操作是否会触发数据表事件? + +**不会**。SQL 操作是直接将 SQL 语句发送到数据库进行处理,相关的 `CREATE` / `UPDATE` / `DELETE` 操作都发生在数据库中,而数据表事件发生在 Node.js 的应用层(ORM 处理),所以不会触发数据表的事件。 + +## 安装 + +内置插件,无需安装。 + +## 使用手册 + +### 创建节点 + +在工作流配置界面中,点击流程中的加号(“+”)按钮,添加“SQL 操作”节点: + +![SQL 操作_添加](https://static-docs.nocobase.com/0ce40a226d7a5bf3717813e27da40e62.png) + +### 节点配置 + +通过编辑框右上角的变量按钮插入需要的变量,会在执行前通过文本替换为对应变量的值: + +![SQL节点_节点配置](https://static-docs.nocobase.com/98611dc13bcda04348bd0856561a7b04.png) diff --git a/docs/zh-CN/handbook/workflow-variable/index.md b/docs/zh-CN/handbook/workflow-variable/index.md new file mode 100644 index 000000000..cb459a770 --- /dev/null +++ b/docs/zh-CN/handbook/workflow-variable/index.md @@ -0,0 +1,80 @@ +# 自定义变量 + + + +可在流程中声明变量,或为已声明的变量赋值,通常用于在流程中保存一些临时数据。 + + + +## 使用手册 + +### 创建节点 + +在工作流配置界面中,点击流程中的加号(“+”)按钮,添加“变量”节点: + +![添加变量节点](https://static-docs.nocobase.com/53b1e48e777bfff7f2a08271526ef3ee.png) + +### 配置节点 + +#### 模式 + +变量节点与程序中的变量类似,需要先声明,之后才能使用和被赋值。所以在创建变量节点时,需要选择变量的模式,有两种模式可供选择: + +![选择模式](https://static-docs.nocobase.com/49d8b7b501de6faef6f303262aa14550.png) + +- 声明新变量:创建一个新变量。 +- 对已有变量赋值:对之前流程已声明的变量进行赋值,相当于修改变量的值。 + +当创建的节点是流程中的首个变量节点时,仅可以选择声明模式,因为此时还没有任何变量可供赋值。 + +选择为已声明的变量赋值时,还需要选择目标变量,即声明变量的节点: + +![选择要赋值的变量](https://static-docs.nocobase.com/1ce8911548d7347e693d8cc8ac1953eb.png) + +#### 值 + +变量的值可以是任意类型,可以是常量,如字符串、数字、逻辑值和日期等,也可以是流程中的其他变量。 + +在声明模式下,设置变量值相当于为变量赋初始值。 + +![声明初始值](https://static-docs.nocobase.com/4ce2c508986565ad537343013758c6a4.png) + +在赋值模式下,设置变量值相当于修改已声明的目标变量的值为一个新值,在后续使用中取值也将取得这个新值。 + +![为已声明变量赋值为触发器变量](https://static-docs.nocobase.com/858bae180712ad279ae6a964a77a7659.png) + +### 使用变量的值 + +在变量节点的后续节点中,从“节点变量”分组中选择已声明的变量,即可使用该变量的值。例如在查询节点中,使用变量的值作为查询条件: + +![使用变量值作为查询过滤条件](https://static-docs.nocobase.com/1ca91c295254ff85999a1751499f14bc.png) + +### 示例 + +变量节点更有用的场景是在一些分支中,将某些新值与之前的值计算或合并(类似编程中的 `reduce`/`concat` 等),在分支结束后再使用。以下用循环分支和变量节点实现一个拼接收件人字符串的示例。 + +首先创建一个数据表触发的工作流,在“文章”数据更新时触发,并预加载相关的“作者”关系数据(用于获取收件人): + +![配置触发器](https://static-docs.nocobase.com/93327530a93c695c637d74cdfdcd5cde.png) + +然后创建一个变量节点,用于储存收件人字符串: + +![收件人变量节点](https://static-docs.nocobase.com/d26fa4a7e7ee4f34e0d8392a51c6666e.png) + +接下来创建一个循环分支节点,用于遍历文章的作者,将其收件人拼接到收件人变量中: + +![循环文章中的作者](https://static-docs.nocobase.com/083fe62c943c17a643dc47ec2872e07c.png) + +在循环分支中,先创建一个计算节点,用于将当前作者与已储存的作者字符串进行拼接: + +![拼接收件人字符串](https://static-docs.nocobase.com/5d21a990162f32cb8818d27b16fd1bcd.png) + +在计算节点后再创建一个变量节点,选择赋值模式,赋值目标选择收件人变量节点,值选择计算节点的结果: + +![赋值拼接后的收件人字符串给收件人节点](https://static-docs.nocobase.com/fc40ed95dd9b61d924b7ca11b23f9482.png) + +这样在循环分支结束后,收件人变量中就储存了所有文章作者的收件人字符串。然后就可以在循环后使用 HTTP 请求节点调用邮件发送接口,将收件人变量的值作为收件人参数传递给接口: + +![通过请求节点对收件人发送邮寄](https://static-docs.nocobase.com/37f71aa1a63e172bcb2dce10a250947e.png) + +至此,一个简单的邮件群发功能就通过循环和变量节点实现了。 diff --git a/docs/zh-CN/handbook/workflow/advanced.md b/docs/zh-CN/handbook/workflow/advanced.md deleted file mode 100644 index e59fd1f09..000000000 --- a/docs/zh-CN/handbook/workflow/advanced.md +++ /dev/null @@ -1,154 +0,0 @@ -# 进阶使用 - -从 [快速开始](./index) 中我们已经了解了工作流最基本的用法,本篇进一步介绍其中一些更深入的概念。 - -## 使用变量 - -正如程序语言中的变量,在工作流中**变量**是用于串接和组织流程的重要工具。 - -在工作流触发后执行每个节点时,一些配置项可以选择使用变量,变量的来源即该节点的上游节点数据,包括以下几类: - -- 触发上下文数据:操作触发、数据表触发等情况下,单行数据对象可以被所有节点使用。 -- 上游节点数据:流程进行到任意节点时,之前已完成的节点的结果数据。 -- 局域变量:当节点处在一些特殊分支结构内时,可以使用对应分支内特有的局域变量,例如循环结构中可以使用每轮循环的数据对象。 -- 系统变量:一些内置的系统参数,如当前时间等。 - -我们在 [快速开始](./index) 中已经多次使用了变量的功能,例如在运算节点中,我们可以使用变量来引用触发上下文数据,来进行计算: - -![运算节点使用函数及变量](https://static-docs.nocobase.com/837e4851a4c70a1932542caadef3431b.png) - -在更新节点中,使用触发上下文数据作为筛选条件的变量,并引用运算节点的结果作为更新数据的字段值变量: - -![更新数据节点变量](https://static-docs.nocobase.com/2e147c93643e7ebc709b9b7ab4f3af8c.png) - -变量的内部是一个 JSON 结构,通常可以按 JSON 的路径使用数据的特定部分。由于很多变量基于 NocoBase 的数据表结构,关系数据将会作为对象的属性按层级组成类似树的结构,例如我们可以选择查询到数据的关系数据的某个字段的值。另外当关系数据是对多的结构时,变量可能会是一个数组。 - -选择变量在大多数时候会需要选到最后一层值属性,通常是简单数据类型,如数字、字符串等。但当变量层级中有数组时,末级的属性也会被映射成一个数组,只有对应的节点支持数组的情况下,才能正确处理数组数据。例如在运算节点中,一些计算引擎有专门处理数组的函数,又比如在循环节点中,循环对象也可以直接选择一个数组。 - -举个例子,当一个查询节点查询了多条数据时,节点结果将会是一个包含多行同构数据的数组: - -```json -[ - { - "id": 1, - "title": "标题1" - }, - { - "id": 2, - "title": "标题2" - } -] -``` - -但是在后续节点中将其作为变量使用时,如果选择的变量是 `节点数据/查询节点/标题` 的形式,将会得到一个被映射后是对应字段值的数组: - -```json -["标题1", "标题2"] -``` - -如果是多维数组(如多对多关系字段),将会得到一个对应字段被拍平后的一维数组。 - -## 执行计划(历史记录) - -每个工作流触发后,会创建对应的执行计划,以跟踪此次任务的执行过程。每个执行计划都有一个状态值用于表示当前的执行状态,该状态在执行历史的列表和详情中都可以查看到: - -![执行计划状态](https://static-docs.nocobase.com/d4440d92ccafac6fac85da4415bb2a26.png) - -当主流程分支中的节点全部都以“完成”状态执行到流程终点时,整个执行计划将以“完成”状态结束。当主流程分支中的节点出现“失败”、“出错”、“取消”、“拒绝”等终态时,整个执行计划将以对应的状态**提前终止**。当主流程分支中的节点出现“等待”状态时,整个执行计划将暂停执行,但仍显示“执行中”的状态,直到等待的节点被恢复后继续执行。不同的节点类型对等待状态的处理方式不同,比如人工节点需要等待人工处理,而延时节点需要等待时间到达后继续执行。 - -执行计划的状态如下表: - -| 状态 | 对应主流程最后执行的节点状态 | 含义 | -| ------ | ---------------------------- | ------------------------------------------------ | -| 队列中 | - | 流程已触发并生成执行计划,排队等待调度器安排执行 | -| 进行中 | 等待 | 节点要求暂停,等待进一步输入或回调再继续 | -| 完成 | 完成 | 未遇到任何问题,所有节点按预期逐个执行完成。 | -| 失败 | 失败 | 由于未满足节点配置,导致失败。 | -| 出错 | 出错 | 节点遇到未捕获的程序错误,提前结束。 | -| 取消 | 取消 | 等待中的节点被流程管理者从外部取消执行,提前结束 | -| 拒绝 | 拒绝 | 在人工处理的节点中,被人工拒绝不再继续后续流程 | - -在 [快速开始](./index) 的例子中,我们已经知道查看工作流的执行历史的详情可以检查执行过程中所有节点的执行是否正常,以及每个已执行的节点的执行状态和结果数据,在一些高级的流程和节点中,节点的结果还可能有多个,例如循环节点的结果: - -![多次执行的节点结果](https://static-docs.nocobase.com/bbda259fa2ddf62b0fc0f982efbedae9.png) - -:::info{title=提示} -工作流可以被并发的触发,但执行是逐个排队执行的,即使同时触发多个工作流,也会依次执行,不会并行执行。所以出现“队列中”的情况时,代表有其他工作流正在执行,需要等待。 - -“进行中”的状态只代表该执行计划已经开始,且通常由于内部节点的等待状态而暂停,并不代表该执行计划抢占了队头的执行资源。所以存在“进行中”的执行计划时,其他“队列中”的执行计划仍可被调度开始执行。 -::: - -## 节点执行状态 - -执行计划的状态是由其中每个节点的执行决定的,在一次触发后的执行计划中,每个节点执行后会产生一个执行状态,状态则会决定后续流程是否继续执行。通常情况下,节点执行成功后,会继续执行下一个节点,直到所有节点依次执行完成,或者被中断。当遇到流程控制相关节点时,如分支、循环、并行、延时等,会根据节点配置的条件,以及运行时的上下文数据,决定下一个节点的执行流向。 - -每个节点执行后可能产生的状态如下表: - -| 状态 | 是否是终态 | 是否提前终止 | 含义 | -| ---- | :--------: | :----------: | ------------------------------------------------------ | -| 等待 | 否 | 否 | 节点要求暂停,等待进一步输入或回调再继续 | -| 完成 | 是 | 否 | 未遇到任何问题,执行成功,继续执行下一个节点直至结束。 | -| 失败 | 是 | 是 | 由于未满足节点配置,导致失败。 | -| 出错 | 是 | 是 | 节点遇到未捕获的程序错误,提前结束。 | -| 取消 | 是 | 是 | 等待中的节点被流程管理者从外部取消执行,提前结束 | -| 拒绝 | 是 | 是 | 在人工处理的节点中,被人工拒绝不再继续后续流程 | - -除等待状态外,其他状态都是节点执行的终态,只有终态是“完成”的状态,才会继续执行,否则都会提前终止整个流程的执行。当节点处在分支流程中时(并行分支、条件判断、循环等),节点执行产生的终态会由开启分支的节点接管处理,并以此类推决定整个流程的流转。 - -例如当我们使用了“‘是’则继续”模式的条件节点时,当执行时如果结果为“否”,则会提前终止整个流程的执行,并已失败状态退出,不再执行后续节点,如下图所示: - -![节点执行失败](https://static-docs.nocobase.com/993aecfa1465894bb574444f0a44313e.png) - -:::info{title=提示} -所有非“完成”的终止状态都可以被视为失败,但失败的原因不同,可以通过查看节点的执行结果来进一步了解失败的原因。 -::: - -## 执行模式 - -工作流基于创建时所选择的触发类型,会以“异步”或“同步”的方式执行。异步模式代表在特定事件触发后会进入工作流的队列,被后台调度逐个执行,而同步模式在触发后不会进入调度队列,而是直接开始执行,并且会在执行完后立即反馈。 - -数据表事件、操作后事件、自定义操作事件、定时任务事件和审批事件将默认以异步的方式执行,操作前事件则默认以同步的方式执行。其中数据表事件和表单事件两种模式都支持,在创建工作流时可以进行选择: - -![同步模式_创建同步工作流](https://static-docs.nocobase.com/39bc0821f50c1bde4729c531c6236795.png) - -:::info{title=提示} -同步模式的工作流受限于其模式,内部不能使用会产生“等待”状态的节点,例如“人工处理”等。 -::: - -## 自动删除历史记录 - -当工作流的触发较为频繁时,可以通过配置自动删除历史记录来减少干扰,同时也将降低数据库的存储压力。 - -同样在工作流的新建和编辑弹窗中可以配置对应流程是否自动删除历史记录: - -![自动删除历史记录配置](https://static-docs.nocobase.com/b2e4c08e7a01e213069912fe04baa7bd.png) - -自动删除可以根据执行结果的状态来进行配置,大部分情况下,建议仅勾选“完成”状态,这样可以保留执行失败的记录,以便后续排查问题。 - -建议在调试工作流时不要开启自动删除历史记录,以便通过历史记录来检查工作流的执行逻辑是否符合预期。 - -:::info{title=提示} -删除工作流的历史并不会减少工作流已执行过的计数。 -::: - -## 工作流的版本 - -在已配置的工作流触发至少一次以后,如希望修改工作流的配置或其中的节点,需要通过创建新版本后再修改,这样同时也保证了当回顾已触发过的工作流历史执行记录时不受未来修改的影响。 - -在工作流的配置页面,可以在右上角的版本菜单查看已有的工作流版本: - -![查看工作流版本](https://static-docs.nocobase.com/ad93d2c08166b0e3e643fb148713a63f.png) - -在其右侧的更多操作(“…”)菜单中,可以选择基于当前查看的版本复制到新版本: - -![复制工作流为新版本](https://static-docs.nocobase.com/2805798e6caca2af004893390a744256.png) - -复制到新版本之后,点击“启用”/“停用”开关,将对应版本切换到启用状态后,新的工作流版本将会生效。 - -如需重新选择旧版本,从版本菜单中切换后,再次点击“启用”/“停用”开关切换至启用状态后,当前查看的版本将生效,后续触发将执行对应版本的流程。 - -当需要停用工作流时,点击“启用”/“停用”开关切换至停用状态后,该工作流将不再会被触发。 - -:::info{title=提示} -与工作流管理列表中的“复制”工作流不同,“复制到新版本”的工作流仍会归集在同一组工作流中,只是可以通过版本区分。但复制工作流则会被视为一个全新的工作流,与之前工作流的版本无关,且执行次数也会归零。 -::: diff --git a/docs/zh-CN/handbook/workflow/advanced/executions.md b/docs/zh-CN/handbook/workflow/advanced/executions.md new file mode 100644 index 000000000..ef015ba02 --- /dev/null +++ b/docs/zh-CN/handbook/workflow/advanced/executions.md @@ -0,0 +1,54 @@ +# 执行计划(历史记录) + +每个工作流触发后,会创建对应的执行计划,以跟踪此次任务的执行过程。每个执行计划都有一个状态值用于表示当前的执行状态,该状态在执行历史的列表和详情中都可以查看到: + +![执行计划状态](https://static-docs.nocobase.com/d4440d92ccafac6fac85da4415bb2a26.png) + +当主流程分支中的节点全部都以“完成”状态执行到流程终点时,整个执行计划将以“完成”状态结束。当主流程分支中的节点出现“失败”、“出错”、“取消”、“拒绝”等终态时,整个执行计划将以对应的状态**提前终止**。当主流程分支中的节点出现“等待”状态时,整个执行计划将暂停执行,但仍显示“执行中”的状态,直到等待的节点被恢复后继续执行。不同的节点类型对等待状态的处理方式不同,比如人工节点需要等待人工处理,而延时节点需要等待时间到达后继续执行。 + +执行计划的状态如下表: + +| 状态 | 对应主流程最后执行的节点状态 | 含义 | +| ------ | ---------------------------- | ------------------------------------------------ | +| 队列中 | - | 流程已触发并生成执行计划,排队等待调度器安排执行 | +| 进行中 | 等待 | 节点要求暂停,等待进一步输入或回调再继续 | +| 完成 | 完成 | 未遇到任何问题,所有节点按预期逐个执行完成。 | +| 失败 | 失败 | 由于未满足节点配置,导致失败。 | +| 出错 | 出错 | 节点遇到未捕获的程序错误,提前结束。 | +| 取消 | 取消 | 等待中的节点被流程管理者从外部取消执行,提前结束 | +| 拒绝 | 拒绝 | 在人工处理的节点中,被人工拒绝不再继续后续流程 | + +在 [快速开始](../quick-start.md) 的例子中,我们已经知道查看工作流的执行历史的详情可以检查执行过程中所有节点的执行是否正常,以及每个已执行的节点的执行状态和结果数据,在一些高级的流程和节点中,节点的结果还可能有多个,例如循环节点的结果: + +![多次执行的节点结果](https://static-docs.nocobase.com/bbda259fa2ddf62b0fc0f982efbedae9.png) + +:::info{title=提示} +工作流可以被并发的触发,但执行是逐个排队执行的,即使同时触发多个工作流,也会依次执行,不会并行执行。所以出现“队列中”的情况时,代表有其他工作流正在执行,需要等待。 + +“进行中”的状态只代表该执行计划已经开始,且通常由于内部节点的等待状态而暂停,并不代表该执行计划抢占了队头的执行资源。所以存在“进行中”的执行计划时,其他“队列中”的执行计划仍可被调度开始执行。 +::: + +## 节点执行状态 + +执行计划的状态是由其中每个节点的执行决定的,在一次触发后的执行计划中,每个节点执行后会产生一个执行状态,状态则会决定后续流程是否继续执行。通常情况下,节点执行成功后,会继续执行下一个节点,直到所有节点依次执行完成,或者被中断。当遇到流程控制相关节点时,如分支、循环、并行、延时等,会根据节点配置的条件,以及运行时的上下文数据,决定下一个节点的执行流向。 + +每个节点执行后可能产生的状态如下表: + +| 状态 | 是否是终态 | 是否提前终止 | 含义 | +| ---- | :--------: | :----------: | ------------------------------------------------------ | +| 等待 | 否 | 否 | 节点要求暂停,等待进一步输入或回调再继续 | +| 完成 | 是 | 否 | 未遇到任何问题,执行成功,继续执行下一个节点直至结束。 | +| 失败 | 是 | 是 | 由于未满足节点配置,导致失败。 | +| 出错 | 是 | 是 | 节点遇到未捕获的程序错误,提前结束。 | +| 取消 | 是 | 是 | 等待中的节点被流程管理者从外部取消执行,提前结束 | +| 拒绝 | 是 | 是 | 在人工处理的节点中,被人工拒绝不再继续后续流程 | + +除等待状态外,其他状态都是节点执行的终态,只有终态是“完成”的状态,才会继续执行,否则都会提前终止整个流程的执行。当节点处在分支流程中时(并行分支、条件判断、循环等),节点执行产生的终态会由开启分支的节点接管处理,并以此类推决定整个流程的流转。 + +例如当我们使用了“‘是’则继续”模式的条件节点时,当执行时如果结果为“否”,则会提前终止整个流程的执行,并已失败状态退出,不再执行后续节点,如下图所示: + +![节点执行失败](https://static-docs.nocobase.com/993aecfa1465894bb574444f0a44313e.png) + +:::info{title=提示} +所有非“完成”的终止状态都可以被视为失败,但失败的原因不同,可以通过查看节点的执行结果来进一步了解失败的原因。 +::: diff --git a/docs/zh-CN/handbook/workflow/advanced/options.md b/docs/zh-CN/handbook/workflow/advanced/options.md new file mode 100644 index 000000000..bb75798f9 --- /dev/null +++ b/docs/zh-CN/handbook/workflow/advanced/options.md @@ -0,0 +1,29 @@ +# 高级配置 + +## 执行模式 + +工作流基于创建时所选择的触发类型,会以“异步”或“同步”的方式执行。异步模式代表在特定事件触发后会进入工作流的队列,被后台调度逐个执行,而同步模式在触发后不会进入调度队列,而是直接开始执行,并且会在执行完后立即反馈。 + +数据表事件、操作后事件、自定义操作事件、定时任务事件和审批事件将默认以异步的方式执行,操作前事件则默认以同步的方式执行。其中数据表事件和表单事件两种模式都支持,在创建工作流时可以进行选择: + +![同步模式_创建同步工作流](https://static-docs.nocobase.com/39bc0821f50c1bde4729c531c6236795.png) + +:::info{title=提示} +同步模式的工作流受限于其模式,内部不能使用会产生“等待”状态的节点,例如“人工处理”等。 +::: + +## 自动删除历史记录 + +当工作流的触发较为频繁时,可以通过配置自动删除历史记录来减少干扰,同时也将降低数据库的存储压力。 + +同样在工作流的新建和编辑弹窗中可以配置对应流程是否自动删除历史记录: + +![自动删除历史记录配置](https://static-docs.nocobase.com/b2e4c08e7a01e213069912fe04baa7bd.png) + +自动删除可以根据执行结果的状态来进行配置,大部分情况下,建议仅勾选“完成”状态,这样可以保留执行失败的记录,以便后续排查问题。 + +建议在调试工作流时不要开启自动删除历史记录,以便通过历史记录来检查工作流的执行逻辑是否符合预期。 + +:::info{title=提示} +删除工作流的历史并不会减少工作流已执行过的计数。 +::: diff --git a/docs/zh-CN/handbook/workflow/advanced/revisions.md b/docs/zh-CN/handbook/workflow/advanced/revisions.md new file mode 100644 index 000000000..98c939a51 --- /dev/null +++ b/docs/zh-CN/handbook/workflow/advanced/revisions.md @@ -0,0 +1,21 @@ +# 版本管理 + +在已配置的工作流触发至少一次以后,如希望修改工作流的配置或其中的节点,需要通过创建新版本后再修改,这样同时也保证了当回顾已触发过的工作流历史执行记录时不受未来修改的影响。 + +在工作流的配置页面,可以在右上角的版本菜单查看已有的工作流版本: + +![查看工作流版本](https://static-docs.nocobase.com/ad93d2c08166b0e3e643fb148713a63f.png) + +在其右侧的更多操作(“…”)菜单中,可以选择基于当前查看的版本复制到新版本: + +![复制工作流为新版本](https://static-docs.nocobase.com/2805798e6caca2af004893390a744256.png) + +复制到新版本之后,点击“启用”/“停用”开关,将对应版本切换到启用状态后,新的工作流版本将会生效。 + +如需重新选择旧版本,从版本菜单中切换后,再次点击“启用”/“停用”开关切换至启用状态后,当前查看的版本将生效,后续触发将执行对应版本的流程。 + +当需要停用工作流时,点击“启用”/“停用”开关切换至停用状态后,该工作流将不再会被触发。 + +:::info{title=提示} +与工作流管理列表中的“复制”工作流不同,“复制到新版本”的工作流仍会归集在同一组工作流中,只是可以通过版本区分。但复制工作流则会被视为一个全新的工作流,与之前工作流的版本无关,且执行次数也会归零。 +::: diff --git a/docs/zh-CN/handbook/workflow/advanced/variables.md b/docs/zh-CN/handbook/workflow/advanced/variables.md new file mode 100644 index 000000000..52fb22169 --- /dev/null +++ b/docs/zh-CN/handbook/workflow/advanced/variables.md @@ -0,0 +1,61 @@ +# 使用变量 + +## 核心概念 + +正如程序语言中的变量,在工作流中**变量**是用于串接和组织流程的重要工具。 + +在工作流触发后执行每个节点时,一些配置项可以选择使用变量,变量的来源即该节点的上游节点数据,包括以下几类: + +- 触发上下文数据:操作触发、数据表触发等情况下,单行数据对象可以作为变量被所有节点使用,具体依据各个触发器实现各有不同。 +- 上游节点数据:流程进行到任意节点时,之前已完成的节点的结果数据。 +- 局域变量:当节点处在一些特殊分支结构内时,可以使用对应分支内特有的局域变量,例如循环结构中可以使用每轮循环的数据对象。 +- 系统变量:一些内置的系统参数,如当前时间等。 + +我们在 [快速开始](../quick-start.md) 中已经多次使用了变量的功能,例如在运算节点中,我们可以使用变量来引用触发上下文数据,来进行计算: + +![运算节点使用函数及变量](https://static-docs.nocobase.com/837e4851a4c70a1932542caadef3431b.png) + +在更新节点中,使用触发上下文数据作为筛选条件的变量,并引用运算节点的结果作为更新数据的字段值变量: + +![更新数据节点变量](https://static-docs.nocobase.com/2e147c93643e7ebc709b9b7ab4f3af8c.png) + +## 数据结构 + +变量的内部是一个 JSON 结构,通常可以按 JSON 的路径使用数据的特定部分。由于很多变量基于 NocoBase 的数据表结构,关系数据将会作为对象的属性按层级组成类似树的结构,例如我们可以选择查询到数据的关系数据的某个字段的值。另外当关系数据是对多的结构时,变量可能会是一个数组。 + +选择变量在大多数时候会需要选到最后一层值属性,通常是简单数据类型,如数字、字符串等。但当变量层级中有数组时,末级的属性也会被映射成一个数组,只有对应的节点支持数组的情况下,才能正确处理数组数据。例如在运算节点中,一些计算引擎有专门处理数组的函数,又比如在循环节点中,循环对象也可以直接选择一个数组。 + +举个例子,当一个查询节点查询了多条数据时,节点结果将会是一个包含多行同构数据的数组: + +```json +[ + { + "id": 1, + "title": "标题1" + }, + { + "id": 2, + "title": "标题2" + } +] +``` + +但是在后续节点中将其作为变量使用时,如果选择的变量是 `节点数据/查询节点/标题` 的形式,将会得到一个被映射后是对应字段值的数组: + +```json +["标题1", "标题2"] +``` + +如果是多维数组(如多对多关系字段),将会得到一个对应字段被拍平后的一维数组。 + +## 系统内置变量 + +### 系统时间 + +根据执行到的节点,获取执行当时的系统时间,该时间的时区是服务器设定的时区。 + +### 日期范围参数 + +在查询、更新和删除节点中,配置日期字段筛选条件时可以使用。仅支持“等于”比较时使用,日期范围的起止时间点均基于服务器设定的时区。 + +![日期范围参数](https://static-docs.nocobase.com/20240817175354.png) diff --git a/docs/zh-CN/handbook/workflow/nodes/aggregate.md b/docs/zh-CN/handbook/workflow/nodes/aggregate.md index 1f76fac23..ae430e454 100644 --- a/docs/zh-CN/handbook/workflow/nodes/aggregate.md +++ b/docs/zh-CN/handbook/workflow/nodes/aggregate.md @@ -1,3 +1,3 @@ # 聚合查询 - + diff --git a/docs/zh-CN/handbook/workflow/nodes/approval.md b/docs/zh-CN/handbook/workflow/nodes/approval.md index f843c45ce..1541024b5 100644 --- a/docs/zh-CN/handbook/workflow/nodes/approval.md +++ b/docs/zh-CN/handbook/workflow/nodes/approval.md @@ -1,9 +1,9 @@ # 审批 - + - + ## 相关内容 -除节点配置外,审批还有一些相关的内容可以通过 [插件文档](../plugins/approval/index.md) 进一步了解。 +除节点配置外,审批还有一些相关的内容可以通过 [插件文档](../../workflow-approval/index.md) 进一步了解。 diff --git a/docs/zh-CN/handbook/workflow/nodes/delay.md b/docs/zh-CN/handbook/workflow/nodes/delay.md index 2d3f369d3..50195399d 100644 --- a/docs/zh-CN/handbook/workflow/nodes/delay.md +++ b/docs/zh-CN/handbook/workflow/nodes/delay.md @@ -1,3 +1,3 @@ # 延时 - + diff --git a/docs/zh-CN/handbook/workflow/nodes/dynamic-calculation.md b/docs/zh-CN/handbook/workflow/nodes/dynamic-calculation.md index aa2c9f75c..35972d2b0 100644 --- a/docs/zh-CN/handbook/workflow/nodes/dynamic-calculation.md +++ b/docs/zh-CN/handbook/workflow/nodes/dynamic-calculation.md @@ -1,7 +1,7 @@ # 动态表达式运算 - + ## 相关内容 -除节点配置外,动态表达式运算节点还有一些相关的内容可以通过 [插件文档](../plugins/dynamic-calculation/index.md) 进一步了解。 +除节点配置外,动态表达式运算节点还有一些相关的内容可以通过 [插件文档](../../workflow-dynamic-calculation/index.md) 进一步了解。 diff --git a/docs/zh-CN/handbook/workflow/nodes/index.md b/docs/zh-CN/handbook/workflow/nodes/index.md index 6ad017764..71a91b3f6 100755 --- a/docs/zh-CN/handbook/workflow/nodes/index.md +++ b/docs/zh-CN/handbook/workflow/nodes/index.md @@ -9,13 +9,15 @@ 从功能角度,目前已实现的节点可以分为四大类(共 18 种节点): - 流程控制类 - - [运算](./calculation.md) - [条件判断](./condition.md) - [延时](./delay.md)(插件 @nocobase/plugin-workflow-deley 提供) - [结束流程](./end.md) - [循环](./loop.md)(插件 @nocobase/plugin-workflow-loop 提供) - [并行分支](./parallel.md)(插件 @nocobase/plugin-workflow-parallel 提供) - [自定义变量](./variable.md)(插件 @nocobase/plugin-workflow-variable 提供) +- 运算类 + - [运算](./calculation.md) + - [动态表达式运算](./dynamic-calculation.md)(插件 @nocobase/plugin-workflow-dynamic-calculation 提供) - 数据表操作 - [新增数据](./create.md) - [更新数据](./update.md) @@ -28,5 +30,4 @@ - [审批](./approval.md)(插件 @nocobase/plugin-workflow-approval 提供) - 其他扩展 - [HTTP 请求](./request.md)(插件 @nocobase/plugin-workflow-request 提供) - - [动态表达式运算](./dynamic-calculation.md)(插件 @nocobase/plugin-workflow-dynamic-calculation 提供) - [响应消息](./response-message.md)(插件 @nocobase/plugin-workflow-response-message 提供) diff --git a/docs/zh-CN/handbook/workflow/nodes/json-query.md b/docs/zh-CN/handbook/workflow/nodes/json-query.md index dacb98025..a4c6530a6 100644 --- a/docs/zh-CN/handbook/workflow/nodes/json-query.md +++ b/docs/zh-CN/handbook/workflow/nodes/json-query.md @@ -1,3 +1,3 @@ # JSON 解析 - + diff --git a/docs/zh-CN/handbook/workflow/nodes/loop.md b/docs/zh-CN/handbook/workflow/nodes/loop.md index 64c8adf17..80ba01089 100644 --- a/docs/zh-CN/handbook/workflow/nodes/loop.md +++ b/docs/zh-CN/handbook/workflow/nodes/loop.md @@ -1,3 +1,3 @@ # 循环 - + diff --git a/docs/zh-CN/handbook/workflow/nodes/manual.md b/docs/zh-CN/handbook/workflow/nodes/manual.md index e587f1e98..cd17f6f34 100644 --- a/docs/zh-CN/handbook/workflow/nodes/manual.md +++ b/docs/zh-CN/handbook/workflow/nodes/manual.md @@ -1,9 +1,9 @@ # 人工处理 - + - + ## 相关内容 -除节点配置外,人工节点还有一些相关的内容可以通过 [插件文档](../plugins/manual/index.md) 进一步了解。 +除节点配置外,人工节点还有一些相关的内容可以通过 [插件文档](../../workflow-manual/index.md) 进一步了解。 diff --git a/docs/zh-CN/handbook/workflow/nodes/parallel.md b/docs/zh-CN/handbook/workflow/nodes/parallel.md index 9e4081d41..8936f0ad2 100644 --- a/docs/zh-CN/handbook/workflow/nodes/parallel.md +++ b/docs/zh-CN/handbook/workflow/nodes/parallel.md @@ -1,3 +1,3 @@ # 并行分支 - + diff --git a/docs/zh-CN/handbook/workflow/nodes/request.md b/docs/zh-CN/handbook/workflow/nodes/request.md index b5f83c73c..e0054f236 100644 --- a/docs/zh-CN/handbook/workflow/nodes/request.md +++ b/docs/zh-CN/handbook/workflow/nodes/request.md @@ -1,3 +1,3 @@ # HTTP 请求 - + diff --git a/docs/zh-CN/handbook/workflow/nodes/response-message.md b/docs/zh-CN/handbook/workflow/nodes/response-message.md index d8e40d651..9488feaad 100644 --- a/docs/zh-CN/handbook/workflow/nodes/response-message.md +++ b/docs/zh-CN/handbook/workflow/nodes/response-message.md @@ -1,3 +1,3 @@ # 响应消息 - + diff --git a/docs/zh-CN/handbook/workflow/nodes/sql.md b/docs/zh-CN/handbook/workflow/nodes/sql.md index 20727e0ba..3cdb7f535 100644 --- a/docs/zh-CN/handbook/workflow/nodes/sql.md +++ b/docs/zh-CN/handbook/workflow/nodes/sql.md @@ -1,3 +1,3 @@ # SQL 操作 - + diff --git a/docs/zh-CN/handbook/workflow/nodes/variable.md b/docs/zh-CN/handbook/workflow/nodes/variable.md index daa3d8e54..11b3deb68 100644 --- a/docs/zh-CN/handbook/workflow/nodes/variable.md +++ b/docs/zh-CN/handbook/workflow/nodes/variable.md @@ -1,3 +1,3 @@ # 自定义变量 - + diff --git a/docs/zh-CN/handbook/workflow/quick-start.md b/docs/zh-CN/handbook/workflow/quick-start.md index 5307760b7..c47f8a481 100644 --- a/docs/zh-CN/handbook/workflow/quick-start.md +++ b/docs/zh-CN/handbook/workflow/quick-start.md @@ -85,6 +85,10 @@ 更深入的使用可以进一步参考以下内容: -- [进阶使用](./advanced.md) +- 进阶理解 + - [使用变量](./advanced/variables.md) + - [执行计划](./advanced/executions.md) + - [版本管理](./advanced/revisions.md) + - [高级配置](./advanced/options.md) - [触发器介绍](./triggers/index.md) - [节点介绍](./nodes/index.md) diff --git a/docs/zh-CN/handbook/workflow/triggers/approval.md b/docs/zh-CN/handbook/workflow/triggers/approval.md index f5ab41f17..65437ca7b 100644 --- a/docs/zh-CN/handbook/workflow/triggers/approval.md +++ b/docs/zh-CN/handbook/workflow/triggers/approval.md @@ -1,9 +1,9 @@ # 审批 - + - + ## 相关内容 -除触发器配置外,审批还有一些相关的内容可以通过 [插件文档](../plugins/approval/index.md) 进一步了解。 +除触发器配置外,审批还有一些相关的内容可以通过 [插件文档](../../workflow-approval/index.md) 进一步了解。 diff --git a/docs/zh-CN/handbook/workflow/triggers/custom-action.md b/docs/zh-CN/handbook/workflow/triggers/custom-action.md index efed0958a..4c50a5314 100644 --- a/docs/zh-CN/handbook/workflow/triggers/custom-action.md +++ b/docs/zh-CN/handbook/workflow/triggers/custom-action.md @@ -1,9 +1,9 @@ # 自定义操作事件 - + - + ## 相关内容 -除触发器配置外,审批还有一些相关的内容可以通过 [插件文档](../plugins/custom-action-trigger/index.md) 进一步了解。 +除触发器配置外,审批还有一些相关的内容可以通过 [插件文档](../../workflow-custom-action-trigger/index.md) 进一步了解。 diff --git a/docs/zh-CN/handbook/workflow/triggers/post-action.md b/docs/zh-CN/handbook/workflow/triggers/post-action.md index 0b6897145..afb1d4d23 100644 --- a/docs/zh-CN/handbook/workflow/triggers/post-action.md +++ b/docs/zh-CN/handbook/workflow/triggers/post-action.md @@ -1,9 +1,9 @@ # 操作后事件 - + - + ## 相关内容 -除触发器配置外,操作后事件还有一些相关的内容可以通过 [插件文档](../plugins/action-trigger/index.md) 进一步了解。 +除触发器配置外,操作后事件还有一些相关的内容可以通过 [插件文档](../../workflow-action-trigger/index.md) 进一步了解。 diff --git a/docs/zh-CN/handbook/workflow/triggers/pre-action.md b/docs/zh-CN/handbook/workflow/triggers/pre-action.md index 12134279a..d72fb1607 100644 --- a/docs/zh-CN/handbook/workflow/triggers/pre-action.md +++ b/docs/zh-CN/handbook/workflow/triggers/pre-action.md @@ -1,9 +1,9 @@ # 操作前事件 - + - + ## 相关内容 -除触发器配置外,操作前事件还有一些相关的内容可以通过 [插件文档](../plugins/request-interceptor/index.md) 进一步了解。 +除触发器配置外,操作前事件还有一些相关的内容可以通过 [插件文档](../../workflow-request-interceptor/index.md) 进一步了解。 diff --git a/docs/zh-CN/welcome/changelog/20240519.md b/docs/zh-CN/welcome/changelog/20240519.md index bd100bc68..118cf7dd2 100644 --- a/docs/zh-CN/welcome/changelog/20240519.md +++ b/docs/zh-CN/welcome/changelog/20240519.md @@ -10,7 +10,7 @@ ### 工作流插件:自定义操作事件 -当常规的增删改操作无法满足需求时,可以使用工作流的自定义操作事件,自行编排数据处理逻辑,详情参考 [工作流 / 自定义操作事件](/handbook/workflow/plugins/custom-action-trigger) 文档。 +当常规的增删改操作无法满足需求时,可以使用工作流的自定义操作事件,自行编排数据处理逻辑,详情参考 [工作流 / 自定义操作事件](/handbook/workflow-custom-action-trigger) 文档。 ![](https://static-docs.nocobase.com/202405191515770.png) diff --git a/docs/zh-CN/welcome/getting-started/env.md b/docs/zh-CN/welcome/getting-started/env.md index 295741ae5..094f4e7ec 100644 --- a/docs/zh-CN/welcome/getting-started/env.md +++ b/docs/zh-CN/welcome/getting-started/env.md @@ -56,7 +56,7 @@ API_BASE_PATH=/api/ 默认值为空,代表不开启。 :::warning{title="注意"} -该模式需要配合集群模式相关的插件使用,如 `@nocobase/plugin-sync-adapter-redis` 等。否则应用的功能可能出现异常。 +该模式需要配合集群模式相关的插件使用,否则应用的功能可能出现异常。 ::: ### PLUGIN_PACKAGE_PREFIX diff --git a/docs/zh-CN/welcome/release/20240519-changelog.md b/docs/zh-CN/welcome/release/20240519-changelog.md index 7f2154892..54de6bbf0 100644 --- a/docs/zh-CN/welcome/release/20240519-changelog.md +++ b/docs/zh-CN/welcome/release/20240519-changelog.md @@ -10,7 +10,7 @@ ### 新插件:工作流自定义操作事件 -当常规的增删改操作无法满足需求时,可以使用工作流的自定义操作事件自己编排数据处理逻辑,详情参考 [工作流 / 自定义操作事件](/handbook/workflow/plugins/custom-action-trigger) 文档。 +当常规的增删改操作无法满足需求时,可以使用工作流的自定义操作事件自己编排数据处理逻辑,详情参考 [工作流 / 自定义操作事件](/handbook/workflow-custom-action-trigger) 文档。 ![](https://static-docs.nocobase.com/202405191515770.png)