@nocobase/plugin-workflow 0.10.1-alpha.1 → 0.11.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.d.ts +2 -3
- package/client.js +1 -30
- package/lib/client/AddButton.js +13 -11
- package/lib/client/Branch.js +10 -8
- package/lib/client/CanvasContent.js +12 -10
- package/lib/client/ExecutionCanvas.js +37 -33
- package/lib/client/ExecutionPage.js +4 -9
- package/lib/client/WorkflowCanvas.js +18 -15
- package/lib/client/WorkflowPage.js +4 -9
- package/lib/client/WorkflowProvider.js +1 -40
- package/lib/client/components/CollectionBlockInitializer.js +3 -3
- package/lib/client/components/CollectionFieldset.d.ts +1 -1
- package/lib/client/components/CollectionFieldset.js +15 -16
- package/lib/client/components/Duration.js +5 -5
- package/lib/client/components/DynamicExpression.d.ts +3 -3
- package/lib/client/components/FieldsSelect.d.ts +1 -1
- package/lib/client/components/FieldsSelect.js +10 -7
- package/lib/client/components/NodeDescription.js +45 -31
- package/lib/client/components/RadioWithTooltip.js +13 -20
- package/lib/client/components/ValueBlock.js +14 -21
- package/lib/client/components/renderEngineReference.js +1 -8
- package/lib/client/index.d.ts +12 -4
- package/lib/client/index.js +78 -15
- package/lib/client/locale/zh-CN.d.ts +5 -1
- package/lib/client/locale/zh-CN.js +6 -2
- package/lib/client/nodes/aggregate.d.ts +8 -3
- package/lib/client/nodes/aggregate.js +5 -4
- package/lib/client/nodes/calculation.d.ts +6 -4
- package/lib/client/nodes/calculation.js +22 -28
- package/lib/client/nodes/condition.d.ts +2 -10
- package/lib/client/nodes/condition.js +19 -37
- package/lib/client/nodes/create.d.ts +5 -6
- package/lib/client/nodes/create.js +1 -3
- package/lib/client/nodes/destroy.d.ts +1 -1
- package/lib/client/nodes/index.d.ts +2 -3
- package/lib/client/nodes/index.js +95 -102
- package/lib/client/nodes/loop.d.ts +1 -1
- package/lib/client/nodes/loop.js +46 -54
- package/lib/client/nodes/manual/FormBlockInitializer.js +6 -5
- package/lib/client/nodes/manual/ModeConfig.js +23 -30
- package/lib/client/nodes/manual/SchemaConfig.d.ts +4 -5
- package/lib/client/nodes/manual/SchemaConfig.js +180 -25
- package/lib/client/nodes/manual/WorkflowTodo.js +95 -110
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +2 -5
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +6 -5
- package/lib/client/nodes/manual/forms/create.js +8 -1
- package/lib/client/nodes/manual/forms/custom.js +22 -22
- package/lib/client/nodes/manual/forms/update.js +8 -1
- package/lib/client/nodes/manual/index.d.ts +6 -1
- package/lib/client/nodes/manual/index.js +5 -4
- package/lib/client/nodes/parallel.js +23 -20
- package/lib/client/nodes/query.d.ts +3 -5
- package/lib/client/nodes/query.js +1 -3
- package/lib/client/nodes/request.d.ts +2 -2
- package/lib/client/nodes/request.js +7 -7
- package/lib/client/nodes/sql.d.ts +26 -0
- package/lib/client/{triggers/schedule/DateFieldsSelect.js → nodes/sql.js} +37 -46
- package/lib/client/nodes/update.d.ts +2 -2
- package/lib/client/nodes/update.js +1 -1
- package/lib/client/schemas/collection.d.ts +3 -4
- package/lib/client/schemas/collection.js +11 -17
- package/lib/client/style.d.ts +18 -13
- package/lib/client/style.js +315 -292
- package/lib/client/triggers/collection.d.ts +13 -13
- package/lib/client/triggers/collection.js +5 -1
- package/lib/client/triggers/index.d.ts +3 -4
- package/lib/client/triggers/index.js +51 -53
- package/lib/client/triggers/schedule/EndsByField.js +11 -11
- package/lib/client/triggers/schedule/OnField.js +45 -33
- package/lib/client/triggers/schedule/RepeatField.js +4 -4
- package/lib/client/triggers/schedule/ScheduleConfig.js +24 -31
- package/lib/client/triggers/schedule/index.d.ts +1 -1
- package/lib/client/triggers/schedule/index.js +32 -20
- package/lib/client/variable.d.ts +31 -13
- package/lib/client/variable.js +44 -29
- package/lib/server/Plugin.d.ts +3 -6
- package/lib/server/Plugin.js +15 -12
- package/lib/server/Processor.d.ts +3 -5
- package/lib/server/Processor.js +2 -2
- package/lib/server/actions/nodes.js +7 -7
- package/lib/server/fields/expression-field.d.ts +1 -2
- package/lib/server/fields/expression-field.js +1 -8
- package/lib/server/functions/index.d.ts +2 -3
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +12 -0
- package/lib/server/instructions/aggregate.d.ts +1 -1
- package/lib/server/instructions/aggregate.js +5 -5
- package/lib/server/instructions/condition.d.ts +2 -1
- package/lib/server/instructions/create.d.ts +2 -2
- package/lib/server/instructions/create.js +13 -13
- package/lib/server/instructions/delay.d.ts +3 -3
- package/lib/server/instructions/delay.js +66 -64
- package/lib/server/instructions/destroy.d.ts +1 -1
- package/lib/server/instructions/index.d.ts +5 -5
- package/lib/server/instructions/index.js +1 -1
- package/lib/server/instructions/loop.d.ts +1 -2
- package/lib/server/instructions/manual/actions.js +19 -7
- package/lib/server/instructions/manual/forms/create.js +7 -1
- package/lib/server/instructions/manual/forms/index.d.ts +1 -1
- package/lib/server/instructions/manual/forms/update.js +7 -1
- package/lib/server/instructions/manual/index.d.ts +1 -1
- package/lib/server/instructions/parallel.d.ts +1 -2
- package/lib/server/instructions/query.d.ts +1 -1
- package/lib/server/instructions/query.js +8 -1
- package/lib/server/instructions/request.d.ts +3 -3
- package/lib/server/instructions/request.js +5 -2
- package/lib/server/instructions/sql.d.ts +12 -0
- package/lib/server/instructions/sql.js +34 -0
- package/lib/server/instructions/update.d.ts +1 -1
- package/lib/server/migrations/20230221071831-calculation-expression.js +1 -1
- package/lib/server/migrations/20230221121203-condition-calculation.js +1 -1
- package/lib/server/migrations/20230221162902-jsonb-to-json.js +7 -7
- package/lib/server/migrations/20230411034722-manual-multi-form.js +1 -8
- package/lib/server/migrations/20230710115902-manual-action-values.d.ts +4 -0
- package/lib/server/migrations/20230710115902-manual-action-values.js +97 -0
- package/lib/server/triggers/collection.d.ts +1 -1
- package/lib/server/triggers/collection.js +15 -13
- package/lib/server/triggers/index.d.ts +1 -1
- package/lib/server/triggers/schedule.d.ts +1 -1
- package/lib/server/triggers/schedule.js +18 -18
- package/lib/server/{models → types}/Execution.d.ts +2 -3
- package/lib/server/{models → types}/FlowNode.d.ts +1 -2
- package/lib/server/{models → types}/Job.d.ts +1 -2
- package/lib/server/{models → types}/Workflow.d.ts +1 -2
- package/lib/server/types/index.d.ts +4 -0
- package/lib/server/types/index.js +5 -0
- package/lib/server/utils.d.ts +2 -0
- package/lib/server/utils.js +21 -0
- package/package.json +39 -18
- package/server.d.ts +2 -3
- package/server.js +1 -30
- package/src/client/AddButton.tsx +111 -0
- package/src/client/Branch.tsx +37 -0
- package/src/client/CanvasContent.tsx +25 -0
- package/src/client/ExecutionCanvas.tsx +166 -0
- package/src/client/ExecutionLink.tsx +16 -0
- package/src/client/ExecutionPage.tsx +45 -0
- package/src/client/ExecutionResourceProvider.tsx +21 -0
- package/src/client/FlowContext.ts +7 -0
- package/src/client/WorkflowCanvas.tsx +221 -0
- package/src/client/WorkflowLink.tsx +16 -0
- package/src/client/WorkflowPage.tsx +52 -0
- package/src/client/WorkflowProvider.tsx +84 -0
- package/src/client/components/CollectionBlockInitializer.tsx +71 -0
- package/src/client/components/CollectionFieldset.tsx +160 -0
- package/src/client/components/Duration.tsx +45 -0
- package/src/client/components/DynamicExpression.tsx +53 -0
- package/src/client/components/FieldsSelect.tsx +32 -0
- package/src/client/components/FilterDynamicComponent.tsx +15 -0
- package/src/client/components/NodeDescription.tsx +51 -0
- package/src/client/components/NullRender.tsx +3 -0
- package/src/client/components/OpenDrawer.tsx +24 -0
- package/src/client/components/RadioWithTooltip.tsx +38 -0
- package/src/client/components/ValueBlock.tsx +67 -0
- package/src/client/components/renderEngineReference.tsx +30 -0
- package/src/client/constants.tsx +91 -0
- package/src/client/index.tsx +51 -0
- package/src/client/interfaces/expression.tsx +25 -0
- package/src/client/locale/en-US.ts +136 -0
- package/src/client/locale/es-ES.ts +129 -0
- package/src/client/locale/index.ts +18 -0
- package/src/client/locale/ja-JP.ts +90 -0
- package/src/client/locale/pt-BR.ts +136 -0
- package/src/client/locale/ru-RU.ts +90 -0
- package/src/client/locale/tr-TR.ts +90 -0
- package/src/client/locale/zh-CN.ts +248 -0
- package/src/client/nodes/aggregate.tsx +327 -0
- package/src/client/nodes/calculation.tsx +216 -0
- package/src/client/nodes/condition.tsx +463 -0
- package/src/client/nodes/create.tsx +85 -0
- package/src/client/nodes/delay.tsx +37 -0
- package/src/client/nodes/destroy.tsx +34 -0
- package/src/client/nodes/index.tsx +485 -0
- package/src/client/nodes/loop.tsx +144 -0
- package/src/client/nodes/manual/AssigneesSelect.tsx +33 -0
- package/src/client/nodes/manual/DetailsBlockProvider.tsx +80 -0
- package/src/client/nodes/manual/FormBlockInitializer.tsx +69 -0
- package/src/client/nodes/manual/FormBlockProvider.tsx +75 -0
- package/src/client/nodes/manual/ModeConfig.tsx +84 -0
- package/src/client/nodes/manual/SchemaConfig.tsx +509 -0
- package/src/client/nodes/manual/WorkflowTodo.tsx +607 -0
- package/src/client/nodes/manual/WorkflowTodoBlockInitializer.tsx +28 -0
- package/src/client/nodes/manual/forms/create.tsx +92 -0
- package/src/client/nodes/manual/forms/custom.tsx +392 -0
- package/src/client/nodes/manual/forms/update.tsx +134 -0
- package/src/client/nodes/manual/index.tsx +162 -0
- package/src/client/nodes/manual/utils.ts +28 -0
- package/src/client/nodes/parallel.tsx +138 -0
- package/src/client/nodes/query.tsx +88 -0
- package/src/client/nodes/request.tsx +185 -0
- package/src/client/nodes/sql.tsx +37 -0
- package/src/client/nodes/update.tsx +99 -0
- package/src/client/schemas/collection.ts +75 -0
- package/src/client/schemas/executions.tsx +169 -0
- package/src/client/schemas/workflows.ts +364 -0
- package/src/client/style.tsx +347 -0
- package/src/client/triggers/collection.tsx +190 -0
- package/src/client/triggers/index.tsx +311 -0
- package/src/client/triggers/schedule/EndsByField.tsx +40 -0
- package/src/client/triggers/schedule/OnField.tsx +64 -0
- package/src/client/triggers/schedule/RepeatField.tsx +116 -0
- package/src/client/triggers/schedule/ScheduleConfig.tsx +227 -0
- package/src/client/triggers/schedule/constants.ts +4 -0
- package/src/client/triggers/schedule/index.tsx +78 -0
- package/src/client/triggers/schedule/locale/Cron.zh-CN.ts +79 -0
- package/src/client/utils.ts +36 -0
- package/src/client/variable.tsx +318 -0
- package/src/index.ts +1 -0
- package/src/server/Plugin.ts +355 -0
- package/src/server/Processor.ts +354 -0
- package/src/server/__tests__/Plugin.test.ts +398 -0
- package/src/server/__tests__/Processor.test.ts +474 -0
- package/src/server/__tests__/actions/workflows.test.ts +419 -0
- package/src/server/__tests__/collections/categories.ts +27 -0
- package/src/server/__tests__/collections/comments.ts +24 -0
- package/src/server/__tests__/collections/posts.ts +42 -0
- package/src/server/__tests__/collections/replies.ts +9 -0
- package/src/server/__tests__/collections/tags.ts +15 -0
- package/src/server/__tests__/index.ts +89 -0
- package/src/server/__tests__/instructions/aggregate.test.ts +294 -0
- package/src/server/__tests__/instructions/calculation.test.ts +265 -0
- package/src/server/__tests__/instructions/condition.test.ts +335 -0
- package/src/server/__tests__/instructions/create.test.ts +129 -0
- package/src/server/__tests__/instructions/delay.test.ts +182 -0
- package/src/server/__tests__/instructions/destroy.test.ts +58 -0
- package/src/server/__tests__/instructions/loop.test.ts +331 -0
- package/src/server/__tests__/instructions/manual.test.ts +1173 -0
- package/src/server/__tests__/instructions/parallel.test.ts +445 -0
- package/src/server/__tests__/instructions/query.test.ts +359 -0
- package/src/server/__tests__/instructions/request.test.ts +247 -0
- package/src/server/__tests__/instructions/sql.test.ts +162 -0
- package/src/server/__tests__/instructions/update.test.ts +189 -0
- package/src/server/__tests__/triggers/collection.test.ts +333 -0
- package/src/server/__tests__/triggers/schedule.test.ts +369 -0
- package/src/server/actions/index.ts +25 -0
- package/src/server/actions/nodes.ts +214 -0
- package/src/server/actions/workflows.ts +178 -0
- package/src/server/collections/executions.ts +35 -0
- package/src/server/collections/flow_nodes.ts +54 -0
- package/src/server/collections/jobs.ts +31 -0
- package/src/server/collections/workflows.ts +88 -0
- package/src/server/constants.ts +26 -0
- package/src/server/fields/expression-field.ts +11 -0
- package/src/server/fields/index.ts +7 -0
- package/src/server/functions/index.ts +16 -0
- package/src/server/index.ts +6 -0
- package/src/server/instructions/aggregate.ts +42 -0
- package/src/server/instructions/calculation.ts +41 -0
- package/src/server/instructions/condition.ts +172 -0
- package/src/server/instructions/create.ts +39 -0
- package/src/server/instructions/delay.ts +105 -0
- package/src/server/instructions/destroy.ts +23 -0
- package/src/server/instructions/index.ts +64 -0
- package/src/server/instructions/loop.ts +99 -0
- package/src/server/instructions/manual/actions.ts +91 -0
- package/src/server/instructions/manual/collecions/jobs.ts +17 -0
- package/src/server/instructions/manual/collecions/users.ts +15 -0
- package/src/server/instructions/manual/collecions/users_jobs.ts +50 -0
- package/src/server/instructions/manual/forms/create.ts +23 -0
- package/src/server/instructions/manual/forms/index.ts +12 -0
- package/src/server/instructions/manual/forms/update.ts +23 -0
- package/src/server/instructions/manual/index.ts +184 -0
- package/src/server/instructions/parallel.ts +121 -0
- package/src/server/instructions/query.ts +42 -0
- package/src/server/instructions/request.ts +88 -0
- package/src/server/instructions/sql.ts +25 -0
- package/src/server/instructions/update.ts +24 -0
- package/src/server/migrations/20221129153547-calculation-variables.ts +64 -0
- package/src/server/migrations/20230221032941-change-request-body-type.ts +76 -0
- package/src/server/migrations/20230221071831-calculation-expression.ts +102 -0
- package/src/server/migrations/20230221121203-condition-calculation.ts +82 -0
- package/src/server/migrations/20230221162902-jsonb-to-json.ts +51 -0
- package/src/server/migrations/20230411034722-manual-multi-form.ts +282 -0
- package/src/server/migrations/20230612021134-manual-collection-block.ts +138 -0
- package/src/server/migrations/20230710115902-manual-action-values.ts +78 -0
- package/src/server/triggers/collection.ts +146 -0
- package/src/server/triggers/index.ts +22 -0
- package/src/server/triggers/schedule.ts +567 -0
- package/src/server/types/Execution.ts +26 -0
- package/src/server/types/FlowNode.ts +21 -0
- package/src/server/types/Job.ts +18 -0
- package/src/server/types/Workflow.ts +36 -0
- package/src/server/types/index.ts +4 -0
- package/src/server/utils.ts +17 -0
- package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +0 -2
- /package/lib/server/{models → types}/Execution.js +0 -0
- /package/lib/server/{models → types}/FlowNode.js +0 -0
- /package/lib/server/{models → types}/Job.js +0 -0
- /package/lib/server/{models → types}/Workflow.js +0 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { ISchema } from '@formily/react';
|
|
2
|
+
import { message } from 'antd';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { useRecord, useResourceActionContext, useResourceContext } from '@nocobase/client';
|
|
5
|
+
import { NAMESPACE } from '../locale';
|
|
6
|
+
import { triggers } from '../triggers';
|
|
7
|
+
import { executionSchema } from './executions';
|
|
8
|
+
|
|
9
|
+
const collection = {
|
|
10
|
+
name: 'workflows',
|
|
11
|
+
fields: [
|
|
12
|
+
{
|
|
13
|
+
type: 'string',
|
|
14
|
+
name: 'title',
|
|
15
|
+
interface: 'input',
|
|
16
|
+
uiSchema: {
|
|
17
|
+
title: '{{t("Name")}}',
|
|
18
|
+
type: 'string',
|
|
19
|
+
'x-component': 'Input',
|
|
20
|
+
required: true,
|
|
21
|
+
} as ISchema,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: 'string',
|
|
25
|
+
name: 'type',
|
|
26
|
+
interface: 'select',
|
|
27
|
+
uiSchema: {
|
|
28
|
+
title: `{{t("Trigger type", { ns: "${NAMESPACE}" })}}`,
|
|
29
|
+
type: 'string',
|
|
30
|
+
'x-component': 'Select',
|
|
31
|
+
'x-decorator': 'FormItem',
|
|
32
|
+
enum: Array.from(triggers.getEntities()).map(([value, { title }]) => ({
|
|
33
|
+
value,
|
|
34
|
+
label: title,
|
|
35
|
+
color: 'gold',
|
|
36
|
+
})),
|
|
37
|
+
required: true,
|
|
38
|
+
} as ISchema,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'string',
|
|
42
|
+
name: 'description',
|
|
43
|
+
interface: 'textarea',
|
|
44
|
+
uiSchema: {
|
|
45
|
+
title: '{{t("Description")}}',
|
|
46
|
+
type: 'string',
|
|
47
|
+
'x-component': 'Input.TextArea',
|
|
48
|
+
} as ISchema,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
name: 'enabled',
|
|
53
|
+
interface: 'radio',
|
|
54
|
+
uiSchema: {
|
|
55
|
+
title: `{{t("Status", { ns: "${NAMESPACE}" })}}`,
|
|
56
|
+
type: 'string',
|
|
57
|
+
enum: [
|
|
58
|
+
{ label: `{{t("On", { ns: "${NAMESPACE}" })}}`, value: true, color: '#52c41a' },
|
|
59
|
+
{ label: `{{t("Off", { ns: "${NAMESPACE}" })}}`, value: false },
|
|
60
|
+
],
|
|
61
|
+
'x-component': 'Radio.Group',
|
|
62
|
+
'x-decorator': 'FormItem',
|
|
63
|
+
default: false,
|
|
64
|
+
} as ISchema,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'number',
|
|
68
|
+
name: 'allExecuted',
|
|
69
|
+
interface: 'integer',
|
|
70
|
+
uiSchema: {
|
|
71
|
+
title: `{{t("Executed", { ns: "${NAMESPACE}" })}}`,
|
|
72
|
+
type: 'number',
|
|
73
|
+
'x-component': 'InputNumber',
|
|
74
|
+
'x-decorator': 'FormItem',
|
|
75
|
+
} as ISchema,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const workflowSchema: ISchema = {
|
|
81
|
+
type: 'void',
|
|
82
|
+
properties: {
|
|
83
|
+
provider: {
|
|
84
|
+
type: 'void',
|
|
85
|
+
'x-decorator': 'ResourceActionProvider',
|
|
86
|
+
'x-decorator-props': {
|
|
87
|
+
collection,
|
|
88
|
+
resourceName: 'workflows',
|
|
89
|
+
request: {
|
|
90
|
+
resource: 'workflows',
|
|
91
|
+
action: 'list',
|
|
92
|
+
params: {
|
|
93
|
+
pageSize: 20,
|
|
94
|
+
filter: {
|
|
95
|
+
current: true,
|
|
96
|
+
},
|
|
97
|
+
sort: ['-createdAt'],
|
|
98
|
+
except: ['config'],
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
'x-component': 'CollectionProvider',
|
|
103
|
+
'x-component-props': {
|
|
104
|
+
collection,
|
|
105
|
+
},
|
|
106
|
+
properties: {
|
|
107
|
+
actions: {
|
|
108
|
+
type: 'void',
|
|
109
|
+
'x-component': 'ActionBar',
|
|
110
|
+
'x-component-props': {
|
|
111
|
+
style: {
|
|
112
|
+
marginBottom: 16,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
properties: {
|
|
116
|
+
delete: {
|
|
117
|
+
type: 'void',
|
|
118
|
+
title: '{{t("Delete")}}',
|
|
119
|
+
'x-component': 'Action',
|
|
120
|
+
'x-component-props': {
|
|
121
|
+
useAction: '{{ cm.useBulkDestroyAction }}',
|
|
122
|
+
confirm: {
|
|
123
|
+
title: "{{t('Delete record')}}",
|
|
124
|
+
content: "{{t('Are you sure you want to delete it?')}}",
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
create: {
|
|
129
|
+
type: 'void',
|
|
130
|
+
title: '{{t("Add new")}}',
|
|
131
|
+
'x-component': 'Action',
|
|
132
|
+
'x-component-props': {
|
|
133
|
+
type: 'primary',
|
|
134
|
+
},
|
|
135
|
+
properties: {
|
|
136
|
+
drawer: {
|
|
137
|
+
type: 'void',
|
|
138
|
+
'x-component': 'Action.Drawer',
|
|
139
|
+
'x-decorator': 'Form',
|
|
140
|
+
'x-decorator-props': {
|
|
141
|
+
initialValue: {
|
|
142
|
+
current: true,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
title: '{{t("Add new")}}',
|
|
146
|
+
properties: {
|
|
147
|
+
title: {
|
|
148
|
+
'x-component': 'CollectionField',
|
|
149
|
+
'x-decorator': 'FormItem',
|
|
150
|
+
},
|
|
151
|
+
type: {
|
|
152
|
+
'x-component': 'CollectionField',
|
|
153
|
+
'x-decorator': 'FormItem',
|
|
154
|
+
},
|
|
155
|
+
description: {
|
|
156
|
+
'x-component': 'CollectionField',
|
|
157
|
+
'x-decorator': 'FormItem',
|
|
158
|
+
},
|
|
159
|
+
footer: {
|
|
160
|
+
type: 'void',
|
|
161
|
+
'x-component': 'Action.Drawer.Footer',
|
|
162
|
+
properties: {
|
|
163
|
+
cancel: {
|
|
164
|
+
title: '{{ t("Cancel") }}',
|
|
165
|
+
'x-component': 'Action',
|
|
166
|
+
'x-component-props': {
|
|
167
|
+
useAction: '{{ cm.useCancelAction }}',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
submit: {
|
|
171
|
+
title: '{{ t("Submit") }}',
|
|
172
|
+
'x-component': 'Action',
|
|
173
|
+
'x-component-props': {
|
|
174
|
+
type: 'primary',
|
|
175
|
+
useAction: '{{ cm.useCreateAction }}',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
table: {
|
|
187
|
+
type: 'void',
|
|
188
|
+
'x-component': 'Table.Void',
|
|
189
|
+
'x-component-props': {
|
|
190
|
+
rowKey: 'id',
|
|
191
|
+
rowSelection: {
|
|
192
|
+
type: 'checkbox',
|
|
193
|
+
},
|
|
194
|
+
useDataSource: '{{ cm.useDataSourceFromRAC }}',
|
|
195
|
+
},
|
|
196
|
+
properties: {
|
|
197
|
+
title: {
|
|
198
|
+
type: 'void',
|
|
199
|
+
'x-decorator': 'Table.Column.Decorator',
|
|
200
|
+
'x-component': 'Table.Column',
|
|
201
|
+
properties: {
|
|
202
|
+
title: {
|
|
203
|
+
type: 'string',
|
|
204
|
+
'x-component': 'CollectionField',
|
|
205
|
+
'x-read-pretty': true,
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
type: {
|
|
210
|
+
type: 'void',
|
|
211
|
+
'x-decorator': 'Table.Column.Decorator',
|
|
212
|
+
'x-component': 'Table.Column',
|
|
213
|
+
properties: {
|
|
214
|
+
type: {
|
|
215
|
+
type: 'string',
|
|
216
|
+
'x-component': 'CollectionField',
|
|
217
|
+
'x-read-pretty': true,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
enabled: {
|
|
222
|
+
type: 'void',
|
|
223
|
+
'x-decorator': 'Table.Column.Decorator',
|
|
224
|
+
'x-component': 'Table.Column',
|
|
225
|
+
properties: {
|
|
226
|
+
enabled: {
|
|
227
|
+
type: 'boolean',
|
|
228
|
+
'x-component': 'CollectionField',
|
|
229
|
+
'x-read-pretty': true,
|
|
230
|
+
default: false,
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
allExecuted: {
|
|
235
|
+
type: 'void',
|
|
236
|
+
'x-decorator': 'Table.Column.Decorator',
|
|
237
|
+
'x-component': 'Table.Column',
|
|
238
|
+
properties: {
|
|
239
|
+
allExecuted: {
|
|
240
|
+
type: 'number',
|
|
241
|
+
'x-decorator': 'OpenDrawer',
|
|
242
|
+
'x-decorator-props': {
|
|
243
|
+
component: 'a',
|
|
244
|
+
},
|
|
245
|
+
'x-component': 'CollectionField',
|
|
246
|
+
'x-read-pretty': true,
|
|
247
|
+
properties: {
|
|
248
|
+
drawer: executionSchema,
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
actions: {
|
|
254
|
+
type: 'void',
|
|
255
|
+
title: '{{ t("Actions") }}',
|
|
256
|
+
'x-component': 'Table.Column',
|
|
257
|
+
properties: {
|
|
258
|
+
actions: {
|
|
259
|
+
type: 'void',
|
|
260
|
+
'x-component': 'Space',
|
|
261
|
+
'x-component-props': {
|
|
262
|
+
split: '|',
|
|
263
|
+
},
|
|
264
|
+
properties: {
|
|
265
|
+
config: {
|
|
266
|
+
type: 'void',
|
|
267
|
+
'x-component': 'WorkflowLink',
|
|
268
|
+
},
|
|
269
|
+
update: {
|
|
270
|
+
type: 'void',
|
|
271
|
+
title: '{{ t("Edit") }}',
|
|
272
|
+
'x-component': 'Action.Link',
|
|
273
|
+
'x-component-props': {
|
|
274
|
+
type: 'primary',
|
|
275
|
+
},
|
|
276
|
+
properties: {
|
|
277
|
+
drawer: {
|
|
278
|
+
type: 'void',
|
|
279
|
+
'x-component': 'Action.Drawer',
|
|
280
|
+
'x-decorator': 'Form',
|
|
281
|
+
'x-decorator-props': {
|
|
282
|
+
useValues: '{{ cm.useValuesFromRecord }}',
|
|
283
|
+
},
|
|
284
|
+
title: '{{ t("Edit") }}',
|
|
285
|
+
properties: {
|
|
286
|
+
title: {
|
|
287
|
+
'x-component': 'CollectionField',
|
|
288
|
+
'x-decorator': 'FormItem',
|
|
289
|
+
},
|
|
290
|
+
enabled: {
|
|
291
|
+
'x-component': 'CollectionField',
|
|
292
|
+
'x-decorator': 'FormItem',
|
|
293
|
+
},
|
|
294
|
+
description: {
|
|
295
|
+
'x-component': 'CollectionField',
|
|
296
|
+
'x-decorator': 'FormItem',
|
|
297
|
+
},
|
|
298
|
+
footer: {
|
|
299
|
+
type: 'void',
|
|
300
|
+
'x-component': 'Action.Drawer.Footer',
|
|
301
|
+
properties: {
|
|
302
|
+
cancel: {
|
|
303
|
+
title: '{{ t("Cancel") }}',
|
|
304
|
+
'x-component': 'Action',
|
|
305
|
+
'x-component-props': {
|
|
306
|
+
useAction: '{{ cm.useCancelAction }}',
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
submit: {
|
|
310
|
+
title: '{{ t("Submit") }}',
|
|
311
|
+
'x-component': 'Action',
|
|
312
|
+
'x-component-props': {
|
|
313
|
+
type: 'primary',
|
|
314
|
+
useAction: '{{ cm.useUpdateAction }}',
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
revision: {
|
|
324
|
+
type: 'void',
|
|
325
|
+
title: `{{t("Duplicate", { ns: "${NAMESPACE}" })}}`,
|
|
326
|
+
'x-component': 'Action.Link',
|
|
327
|
+
'x-component-props': {
|
|
328
|
+
useAction() {
|
|
329
|
+
const { t } = useTranslation();
|
|
330
|
+
const { refresh } = useResourceActionContext();
|
|
331
|
+
const { resource, targetKey } = useResourceContext();
|
|
332
|
+
const { [targetKey]: filterByTk } = useRecord();
|
|
333
|
+
return {
|
|
334
|
+
async run() {
|
|
335
|
+
await resource.revision({ filterByTk });
|
|
336
|
+
message.success(t('Operation succeeded'));
|
|
337
|
+
refresh();
|
|
338
|
+
},
|
|
339
|
+
};
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
// delete: {
|
|
344
|
+
// type: 'void',
|
|
345
|
+
// title: '{{ t("Delete") }}',
|
|
346
|
+
// 'x-component': 'Action.Link',
|
|
347
|
+
// 'x-component-props': {
|
|
348
|
+
// confirm: {
|
|
349
|
+
// title: "{{t('Delete record')}}",
|
|
350
|
+
// content: "{{t('Are you sure you want to delete it?')}}",
|
|
351
|
+
// },
|
|
352
|
+
// useAction: '{{ cm.useDestroyActionAndRefreshCM }}',
|
|
353
|
+
// },
|
|
354
|
+
// },
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
};
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { createStyles } from '@nocobase/client';
|
|
2
|
+
|
|
3
|
+
const useStyles = createStyles(({ css, token }) => {
|
|
4
|
+
return {
|
|
5
|
+
workflowPageClass: css`
|
|
6
|
+
flex-grow: 1;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
|
|
11
|
+
.workflow-toolbar {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
position: relative;
|
|
16
|
+
padding: 0.5rem 1rem;
|
|
17
|
+
background: ${token.colorBgContainer};
|
|
18
|
+
border-bottom: 1px solid ${token.colorBorder};
|
|
19
|
+
|
|
20
|
+
header {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
min-height: 2rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
aside {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
gap: 0.5em;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.workflow-versions {
|
|
33
|
+
label {
|
|
34
|
+
margin-right: 0.5em;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.workflow-canvas {
|
|
40
|
+
flex-grow: 1;
|
|
41
|
+
overflow: auto;
|
|
42
|
+
width: 100%;
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
align-items: center;
|
|
46
|
+
padding: 2em;
|
|
47
|
+
|
|
48
|
+
.end {
|
|
49
|
+
cursor: default;
|
|
50
|
+
|
|
51
|
+
&:hover {
|
|
52
|
+
box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`,
|
|
57
|
+
|
|
58
|
+
workflowVersionDropdownClass: css`
|
|
59
|
+
.ant-dropdown-menu-item {
|
|
60
|
+
.ant-dropdown-menu-title-content {
|
|
61
|
+
text-align: right;
|
|
62
|
+
|
|
63
|
+
time {
|
|
64
|
+
margin-left: 0.5rem;
|
|
65
|
+
color: ${token.colorText};
|
|
66
|
+
font-size: 80%;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
strong {
|
|
70
|
+
font-weight: normal;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
> .enabled {
|
|
74
|
+
strong {
|
|
75
|
+
font-weight: bold;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
> .unexecuted {
|
|
80
|
+
strong {
|
|
81
|
+
font-style: italic;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
`,
|
|
87
|
+
|
|
88
|
+
branchBlockClass: css`
|
|
89
|
+
display: flex;
|
|
90
|
+
position: relative;
|
|
91
|
+
|
|
92
|
+
:before {
|
|
93
|
+
content: '';
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 0;
|
|
96
|
+
bottom: 0;
|
|
97
|
+
left: calc(50% - 0.5px);
|
|
98
|
+
width: 1px;
|
|
99
|
+
background-color: ${token.colorBorder};
|
|
100
|
+
}
|
|
101
|
+
`,
|
|
102
|
+
|
|
103
|
+
branchClass: css`
|
|
104
|
+
display: flex;
|
|
105
|
+
flex-direction: column;
|
|
106
|
+
align-items: center;
|
|
107
|
+
position: relative;
|
|
108
|
+
min-width: 20em;
|
|
109
|
+
padding: 0 2em;
|
|
110
|
+
|
|
111
|
+
.workflow-node-list {
|
|
112
|
+
flex-grow: 1;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.workflow-branch-lines {
|
|
116
|
+
position: absolute;
|
|
117
|
+
top: 0;
|
|
118
|
+
bottom: 0;
|
|
119
|
+
width: 1px;
|
|
120
|
+
background-color: ${token.colorBorder};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:before,
|
|
124
|
+
:after {
|
|
125
|
+
content: '';
|
|
126
|
+
position: absolute;
|
|
127
|
+
height: 1px;
|
|
128
|
+
background-color: ${token.colorBorder};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
:before {
|
|
132
|
+
top: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
:after {
|
|
136
|
+
bottom: 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
:not(:first-child):not(:last-child) {
|
|
140
|
+
:before,
|
|
141
|
+
:after {
|
|
142
|
+
left: 0;
|
|
143
|
+
width: 100%;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
:last-child:not(:first-child) {
|
|
148
|
+
:before,
|
|
149
|
+
:after {
|
|
150
|
+
right: 50%;
|
|
151
|
+
width: 50%;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
:first-child:not(:last-child) {
|
|
156
|
+
:before,
|
|
157
|
+
:after {
|
|
158
|
+
left: 50%;
|
|
159
|
+
width: 50%;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
`,
|
|
163
|
+
|
|
164
|
+
nodeBlockClass: css`
|
|
165
|
+
flex-grow: 1;
|
|
166
|
+
flex-shrink: 0;
|
|
167
|
+
display: flex;
|
|
168
|
+
flex-direction: column;
|
|
169
|
+
align-items: center;
|
|
170
|
+
position: relative;
|
|
171
|
+
`,
|
|
172
|
+
|
|
173
|
+
nodeClass: css`
|
|
174
|
+
flex-shrink: 0;
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-direction: column;
|
|
177
|
+
align-items: center;
|
|
178
|
+
`,
|
|
179
|
+
|
|
180
|
+
nodeCardClass: css`
|
|
181
|
+
position: relative;
|
|
182
|
+
width: 20em;
|
|
183
|
+
background: ${token.colorBgContainer};
|
|
184
|
+
padding: 1em;
|
|
185
|
+
box-shadow: ${token.boxShadowTertiary};
|
|
186
|
+
border-radius: ${token.borderRadiusLG}px;
|
|
187
|
+
cursor: pointer;
|
|
188
|
+
transition: box-shadow 0.3s ease;
|
|
189
|
+
|
|
190
|
+
&:hover {
|
|
191
|
+
box-shadow: ${token.boxShadow};
|
|
192
|
+
|
|
193
|
+
.workflow-node-remove-button {
|
|
194
|
+
opacity: 1;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&.configuring {
|
|
199
|
+
box-shadow: ${token.boxShadow};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.workflow-node-remove-button {
|
|
203
|
+
position: absolute;
|
|
204
|
+
right: 0.5em;
|
|
205
|
+
top: 0.5em;
|
|
206
|
+
color: ${token.colorText};
|
|
207
|
+
opacity: 0;
|
|
208
|
+
transition: opacity 0.3s ease;
|
|
209
|
+
|
|
210
|
+
&[disabled] {
|
|
211
|
+
display: none;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&:hover {
|
|
215
|
+
color: ${token.colorErrorHover};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.ant-input {
|
|
220
|
+
font-weight: bold;
|
|
221
|
+
|
|
222
|
+
&:not(:focus) {
|
|
223
|
+
transition: background-color 0.3s ease, border-color 0.3s ease;
|
|
224
|
+
border-color: ${token.colorBorderBg};
|
|
225
|
+
background-color: ${token.colorBgContainerDisabled};
|
|
226
|
+
|
|
227
|
+
&:not(:disabled):hover {
|
|
228
|
+
border-color: ${token.colorPrimaryBorderHover};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
&:disabled:hover {
|
|
232
|
+
border-color: ${token.colorBorderBg};
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.workflow-node-config-button {
|
|
238
|
+
padding: 0;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&:hover {
|
|
242
|
+
box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.25);
|
|
243
|
+
|
|
244
|
+
.workflow-node-remove-button {
|
|
245
|
+
opacity: 1;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
`,
|
|
249
|
+
|
|
250
|
+
nodeJobButtonClass: css`
|
|
251
|
+
display: flex;
|
|
252
|
+
position: absolute;
|
|
253
|
+
top: calc(1em - 1px);
|
|
254
|
+
right: 1em;
|
|
255
|
+
justify-content: center;
|
|
256
|
+
align-items: center;
|
|
257
|
+
color: ${token.colorText};
|
|
258
|
+
|
|
259
|
+
&[type='button'] {
|
|
260
|
+
border: none;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
&.inner {
|
|
264
|
+
position: static;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.ant-tag {
|
|
268
|
+
padding: 0;
|
|
269
|
+
width: ${token.sizeLG}px;
|
|
270
|
+
height: ${token.sizeLG}px;
|
|
271
|
+
line-height: ${token.sizeLG}px;
|
|
272
|
+
margin-right: 0;
|
|
273
|
+
border-radius: 50%;
|
|
274
|
+
text-align: center;
|
|
275
|
+
}
|
|
276
|
+
`,
|
|
277
|
+
|
|
278
|
+
nodeHeaderClass: css`
|
|
279
|
+
position: relative;
|
|
280
|
+
`,
|
|
281
|
+
|
|
282
|
+
nodeMetaClass: css`
|
|
283
|
+
margin-bottom: 0.5em;
|
|
284
|
+
|
|
285
|
+
.workflow-node-id {
|
|
286
|
+
color: ${token.colorTextDescription};
|
|
287
|
+
|
|
288
|
+
&:before {
|
|
289
|
+
content: '#';
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
`,
|
|
293
|
+
|
|
294
|
+
nodeTitleClass: css`
|
|
295
|
+
display: flex;
|
|
296
|
+
align-items: center;
|
|
297
|
+
font-weight: normal;
|
|
298
|
+
.workflow-node-id {
|
|
299
|
+
color: ${token.colorTextDescription};
|
|
300
|
+
}
|
|
301
|
+
`,
|
|
302
|
+
|
|
303
|
+
nodeSubtreeClass: css`
|
|
304
|
+
display: flex;
|
|
305
|
+
flex-direction: column-reverse;
|
|
306
|
+
align-items: center;
|
|
307
|
+
`,
|
|
308
|
+
|
|
309
|
+
addButtonClass: css`
|
|
310
|
+
flex-shrink: 0;
|
|
311
|
+
padding: 2em 0;
|
|
312
|
+
|
|
313
|
+
> .ant-btn {
|
|
314
|
+
&:disabled {
|
|
315
|
+
visibility: hidden;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
`,
|
|
319
|
+
|
|
320
|
+
conditionClass: css`
|
|
321
|
+
position: relative;
|
|
322
|
+
height: 2em;
|
|
323
|
+
overflow: visible;
|
|
324
|
+
|
|
325
|
+
> span {
|
|
326
|
+
position: absolute;
|
|
327
|
+
top: calc(1.5em - 1px);
|
|
328
|
+
line-height: 1em;
|
|
329
|
+
color: ${token.colorTextSecondary};
|
|
330
|
+
padding: 1px;
|
|
331
|
+
}
|
|
332
|
+
`,
|
|
333
|
+
|
|
334
|
+
loopLineClass: css`
|
|
335
|
+
display: flex;
|
|
336
|
+
justify-content: center;
|
|
337
|
+
align-items: center;
|
|
338
|
+
position: absolute;
|
|
339
|
+
top: 50%;
|
|
340
|
+
transform: translateY(-50%);
|
|
341
|
+
width: 2em;
|
|
342
|
+
height: 6em;
|
|
343
|
+
`,
|
|
344
|
+
};
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
export default useStyles;
|