@nocobase/plugin-workflow-manual 0.21.0-alpha.15 → 0.21.0-alpha.16
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/dist/externalVersion.js
CHANGED
|
@@ -3,18 +3,18 @@ module.exports = {
|
|
|
3
3
|
"antd": "5.12.8",
|
|
4
4
|
"dayjs": "1.11.10",
|
|
5
5
|
"react": "18.2.0",
|
|
6
|
-
"@nocobase/client": "0.21.0-alpha.
|
|
7
|
-
"@nocobase/plugin-workflow": "0.21.0-alpha.
|
|
6
|
+
"@nocobase/client": "0.21.0-alpha.16",
|
|
7
|
+
"@nocobase/plugin-workflow": "0.21.0-alpha.16",
|
|
8
8
|
"@ant-design/icons": "5.2.6",
|
|
9
9
|
"react-i18next": "11.18.6",
|
|
10
|
-
"@nocobase/utils": "0.21.0-alpha.
|
|
11
|
-
"@nocobase/server": "0.21.0-alpha.
|
|
12
|
-
"@nocobase/actions": "0.21.0-alpha.
|
|
13
|
-
"@nocobase/resourcer": "0.21.0-alpha.
|
|
14
|
-
"@nocobase/plugin-workflow-test": "0.21.0-alpha.
|
|
15
|
-
"@nocobase/test": "0.21.0-alpha.
|
|
10
|
+
"@nocobase/utils": "0.21.0-alpha.16",
|
|
11
|
+
"@nocobase/server": "0.21.0-alpha.16",
|
|
12
|
+
"@nocobase/actions": "0.21.0-alpha.16",
|
|
13
|
+
"@nocobase/resourcer": "0.21.0-alpha.16",
|
|
14
|
+
"@nocobase/plugin-workflow-test": "0.21.0-alpha.16",
|
|
15
|
+
"@nocobase/test": "0.21.0-alpha.16",
|
|
16
16
|
"@formily/core": "2.3.0",
|
|
17
17
|
"@formily/antd-v5": "1.1.9",
|
|
18
|
-
"@nocobase/database": "0.21.0-alpha.
|
|
18
|
+
"@nocobase/database": "0.21.0-alpha.16",
|
|
19
19
|
"lodash": "4.17.21"
|
|
20
20
|
};
|
|
@@ -102,12 +102,15 @@ class ManualInstruction_default extends import_plugin_workflow.Instruction {
|
|
|
102
102
|
const { mode, ...config } = node.config;
|
|
103
103
|
const assignees = [...new Set(processor.getParsedValue(config.assignees, node.id).flat().filter(Boolean))];
|
|
104
104
|
const job = await processor.saveJob({
|
|
105
|
-
status: import_plugin_workflow.JOB_STATUS.PENDING,
|
|
105
|
+
status: assignees.length ? import_plugin_workflow.JOB_STATUS.PENDING : import_plugin_workflow.JOB_STATUS.RESOLVED,
|
|
106
106
|
result: mode ? [] : null,
|
|
107
107
|
nodeId: node.id,
|
|
108
108
|
nodeKey: node.key,
|
|
109
109
|
upstreamId: (prevJob == null ? void 0 : prevJob.id) ?? null
|
|
110
110
|
});
|
|
111
|
+
if (!assignees.length) {
|
|
112
|
+
return job;
|
|
113
|
+
}
|
|
111
114
|
const UserJobModel = this.workflow.app.db.getModel("users_jobs");
|
|
112
115
|
await UserJobModel.bulkCreate(
|
|
113
116
|
assignees.map((userId) => ({
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流:人工处理节点",
|
|
5
5
|
"description": "Could be used for workflows which some of decisions are made by users.",
|
|
6
6
|
"description.zh-CN": "用于人工控制部分决策的流程。",
|
|
7
|
-
"version": "0.21.0-alpha.
|
|
7
|
+
"version": "0.21.0-alpha.16",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/workflow-manual",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@nocobase/test": "0.x",
|
|
31
31
|
"@nocobase/utils": "0.x"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "2914500f14e4454cc5702a49371230865660ca33",
|
|
34
34
|
"keywords": [
|
|
35
35
|
"Workflow"
|
|
36
36
|
]
|
|
@@ -96,13 +96,17 @@ export default class extends Instruction {
|
|
|
96
96
|
const assignees = [...new Set(processor.getParsedValue(config.assignees, node.id).flat().filter(Boolean))];
|
|
97
97
|
|
|
98
98
|
const job = await processor.saveJob({
|
|
99
|
-
status: JOB_STATUS.PENDING,
|
|
99
|
+
status: assignees.length ? JOB_STATUS.PENDING : JOB_STATUS.RESOLVED,
|
|
100
100
|
result: mode ? [] : null,
|
|
101
101
|
nodeId: node.id,
|
|
102
102
|
nodeKey: node.key,
|
|
103
103
|
upstreamId: prevJob?.id ?? null,
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
+
if (!assignees.length) {
|
|
107
|
+
return job;
|
|
108
|
+
}
|
|
109
|
+
|
|
106
110
|
// NOTE: batch create users jobs
|
|
107
111
|
const UserJobModel = this.workflow.app.db.getModel('users_jobs');
|
|
108
112
|
await UserJobModel.bulkCreate(
|
|
@@ -50,6 +50,32 @@ describe('workflow > instructions > manual > assignees', () => {
|
|
|
50
50
|
|
|
51
51
|
afterEach(() => app.destroy());
|
|
52
52
|
|
|
53
|
+
describe('no', () => {
|
|
54
|
+
it('empty assignees', async () => {
|
|
55
|
+
const n1 = await workflow.createNode({
|
|
56
|
+
type: 'manual',
|
|
57
|
+
config: {
|
|
58
|
+
assignees: [],
|
|
59
|
+
forms: {
|
|
60
|
+
f1: {
|
|
61
|
+
actions: [{ status: JOB_STATUS.RESOLVED, key: 'resolve' }],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const post = await PostRepo.create({
|
|
68
|
+
values: { title: 't1', category: { title: 'c1' } },
|
|
69
|
+
context: { state: { currentUser: users[0] } },
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
await sleep(500);
|
|
73
|
+
|
|
74
|
+
const [pending] = await workflow.getExecutions();
|
|
75
|
+
expect(pending.status).toBe(EXECUTION_STATUS.RESOLVED);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
53
79
|
describe('multiple', () => {
|
|
54
80
|
it('assignees from nested array', async () => {
|
|
55
81
|
const n1 = await workflow.createNode({
|