@nocobase/plugin-workflow 1.9.0-beta.5 → 1.9.0-beta.6
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/client/36f08ae9bbcb32e0.js +10 -0
- package/dist/client/{98ae71d4cff2436b.js → c3c4e4590e36c7a1.js} +1 -1
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +11 -11
- package/dist/locale/zh-CN.json +1 -1
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/server/Plugin.js +5 -4
- package/dist/server/Processor.d.ts +4 -4
- package/dist/server/Processor.js +55 -13
- package/dist/server/actions/executions.js +2 -2
- package/dist/server/instructions/ConditionInstruction.js +0 -1
- package/dist/server/instructions/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/client/256475f279fb46d1.js +0 -10
package/dist/externalVersion.js
CHANGED
|
@@ -11,8 +11,8 @@ module.exports = {
|
|
|
11
11
|
"react": "18.2.0",
|
|
12
12
|
"@formily/core": "2.3.0",
|
|
13
13
|
"@formily/react": "2.3.0",
|
|
14
|
-
"@nocobase/client": "1.9.0-beta.
|
|
15
|
-
"@nocobase/utils": "1.9.0-beta.
|
|
14
|
+
"@nocobase/client": "1.9.0-beta.6",
|
|
15
|
+
"@nocobase/utils": "1.9.0-beta.6",
|
|
16
16
|
"antd": "5.24.2",
|
|
17
17
|
"@ant-design/icons": "5.6.1",
|
|
18
18
|
"react-router-dom": "6.28.1",
|
|
@@ -20,17 +20,17 @@ module.exports = {
|
|
|
20
20
|
"lodash": "4.17.21",
|
|
21
21
|
"@dnd-kit/core": "6.1.0",
|
|
22
22
|
"@formily/shared": "2.3.2",
|
|
23
|
-
"@nocobase/plugin-mobile": "1.9.0-beta.
|
|
23
|
+
"@nocobase/plugin-mobile": "1.9.0-beta.6",
|
|
24
24
|
"sequelize": "6.35.2",
|
|
25
|
-
"@nocobase/database": "1.9.0-beta.
|
|
26
|
-
"@nocobase/server": "1.9.0-beta.
|
|
27
|
-
"@nocobase/data-source-manager": "1.9.0-beta.
|
|
28
|
-
"@nocobase/logger": "1.9.0-beta.
|
|
29
|
-
"@nocobase/evaluators": "1.9.0-beta.
|
|
25
|
+
"@nocobase/database": "1.9.0-beta.6",
|
|
26
|
+
"@nocobase/server": "1.9.0-beta.6",
|
|
27
|
+
"@nocobase/data-source-manager": "1.9.0-beta.6",
|
|
28
|
+
"@nocobase/logger": "1.9.0-beta.6",
|
|
29
|
+
"@nocobase/evaluators": "1.9.0-beta.6",
|
|
30
30
|
"@formily/antd-v5": "1.2.3",
|
|
31
31
|
"@formily/reactive": "2.3.0",
|
|
32
|
-
"@nocobase/actions": "1.9.0-beta.
|
|
32
|
+
"@nocobase/actions": "1.9.0-beta.6",
|
|
33
33
|
"dayjs": "1.11.13",
|
|
34
|
-
"@nocobase/plugin-workflow-test": "1.9.0-beta.
|
|
35
|
-
"@nocobase/test": "1.9.0-beta.
|
|
34
|
+
"@nocobase/plugin-workflow-test": "1.9.0-beta.6",
|
|
35
|
+
"@nocobase/test": "1.9.0-beta.6"
|
|
36
36
|
};
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
"Move all downstream nodes to": "将所有下游节点移至",
|
|
242
242
|
"After end of branches": "分支结束后",
|
|
243
243
|
"Inside of branch": "分支内",
|
|
244
|
-
|
|
244
|
+
"Workflow tasks": "流程待办",
|
|
245
245
|
"Workflow todos": "流程待办",
|
|
246
246
|
"New version enabled": "已启用新版本",
|
|
247
247
|
"Workflow is not exists": "工作流不存在",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2025-
|
|
1
|
+
{"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2025-08-22T09:52:54.392Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2025-
|
|
1
|
+
{"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2025-08-22T09:52:54.022Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"nodejs-snowflake","collaborators":["Utkarsh Srivastava <utkarsh@sagacious.dev>"],"description":"Generate time sortable 64 bits unique ids for distributed systems (inspired from twitter snowflake)","version":"2.0.1","license":"Apache 2.0","repository":{"type":"git","url":"https://github.com/utkarsh-pro/nodejs-snowflake.git"},"files":["nodejs_snowflake_bg.wasm","nodejs_snowflake.js","nodejs_snowflake.d.ts"],"main":"nodejs_snowflake.js","types":"nodejs_snowflake.d.ts","_lastModified":"2025-
|
|
1
|
+
{"name":"nodejs-snowflake","collaborators":["Utkarsh Srivastava <utkarsh@sagacious.dev>"],"description":"Generate time sortable 64 bits unique ids for distributed systems (inspired from twitter snowflake)","version":"2.0.1","license":"Apache 2.0","repository":{"type":"git","url":"https://github.com/utkarsh-pro/nodejs-snowflake.git"},"files":["nodejs_snowflake_bg.wasm","nodejs_snowflake.js","nodejs_snowflake.d.ts"],"main":"nodejs_snowflake.js","types":"nodejs_snowflake.d.ts","_lastModified":"2025-08-22T09:52:53.821Z"}
|
package/dist/server/Plugin.js
CHANGED
|
@@ -577,7 +577,9 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
577
577
|
this.pending.push([execution]);
|
|
578
578
|
} else {
|
|
579
579
|
logger.info(`local pending list is not empty, sending execution (${execution.id}) to queue`);
|
|
580
|
-
|
|
580
|
+
if (this.ready) {
|
|
581
|
+
this.app.backgroundJobManager.publish(`${this.name}.pendingExecution`, { executionId: execution.id });
|
|
582
|
+
}
|
|
581
583
|
}
|
|
582
584
|
}
|
|
583
585
|
} catch (error) {
|
|
@@ -746,9 +748,8 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
746
748
|
});
|
|
747
749
|
}
|
|
748
750
|
if (userId) {
|
|
749
|
-
this.app.emit("ws:
|
|
750
|
-
|
|
751
|
-
tagValue: `${userId}`,
|
|
751
|
+
this.app.emit("ws:sendToUser", {
|
|
752
|
+
userId,
|
|
752
753
|
message: { type: "workflow:tasks:updated", payload: record.get() }
|
|
753
754
|
});
|
|
754
755
|
}
|
|
@@ -43,7 +43,7 @@ export default class Processor {
|
|
|
43
43
|
/**
|
|
44
44
|
* @experimental
|
|
45
45
|
*/
|
|
46
|
-
nodesMap: Map<number, FlowNodeModel>;
|
|
46
|
+
nodesMap: Map<string | number, FlowNodeModel>;
|
|
47
47
|
private jobsMapByNodeKey;
|
|
48
48
|
private jobResultsMapByNodeKey;
|
|
49
49
|
private jobsToSave;
|
|
@@ -61,7 +61,7 @@ export default class Processor {
|
|
|
61
61
|
run(node: any, input?: any): any;
|
|
62
62
|
end(node: any, job: JobModel): Promise<any>;
|
|
63
63
|
private recall;
|
|
64
|
-
exit(s?: number): Promise<any>;
|
|
64
|
+
exit(s?: number | true): Promise<any>;
|
|
65
65
|
/**
|
|
66
66
|
* @experimental
|
|
67
67
|
*/
|
|
@@ -95,7 +95,7 @@ export default class Processor {
|
|
|
95
95
|
/**
|
|
96
96
|
* @experimental
|
|
97
97
|
*/
|
|
98
|
-
getScope(sourceNodeId
|
|
98
|
+
getScope(sourceNodeId?: number | string, includeSelfScope?: boolean): {
|
|
99
99
|
$context: any;
|
|
100
100
|
$jobsMapByNodeKey: {
|
|
101
101
|
[key: string]: any;
|
|
@@ -107,7 +107,7 @@ export default class Processor {
|
|
|
107
107
|
/**
|
|
108
108
|
* @experimental
|
|
109
109
|
*/
|
|
110
|
-
getParsedValue(value: any, sourceNodeId
|
|
110
|
+
getParsedValue(value: any, sourceNodeId?: number | string, { additionalScope, includeSelfScope }?: {
|
|
111
111
|
additionalScope?: {};
|
|
112
112
|
includeSelfScope?: boolean;
|
|
113
113
|
}): any;
|
package/dist/server/Processor.js
CHANGED
|
@@ -39,6 +39,7 @@ __export(Processor_exports, {
|
|
|
39
39
|
default: () => Processor
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(Processor_exports);
|
|
42
|
+
var import_sequelize = require("sequelize");
|
|
42
43
|
var import_database = require("@nocobase/database");
|
|
43
44
|
var import_evaluators = require("@nocobase/evaluators");
|
|
44
45
|
var import_utils = require("@nocobase/utils");
|
|
@@ -120,7 +121,20 @@ class Processor {
|
|
|
120
121
|
const nodes = await execution.workflow.getNodes({ transaction });
|
|
121
122
|
execution.workflow.nodes = nodes;
|
|
122
123
|
this.makeNodes(nodes);
|
|
124
|
+
const JobDBModel = plugin.db.getModel("jobs");
|
|
125
|
+
const jobIds = await JobDBModel.findAll({
|
|
126
|
+
attributes: ["executionId", "nodeId", [(0, import_sequelize.fn)("MAX", (0, import_sequelize.col)("id")), "id"]],
|
|
127
|
+
group: ["executionId", "nodeId"],
|
|
128
|
+
where: {
|
|
129
|
+
executionId: execution.id
|
|
130
|
+
},
|
|
131
|
+
raw: true,
|
|
132
|
+
transaction
|
|
133
|
+
});
|
|
123
134
|
const jobs = await execution.getJobs({
|
|
135
|
+
where: {
|
|
136
|
+
id: jobIds.map((item) => item.id)
|
|
137
|
+
},
|
|
124
138
|
order: [["id", "ASC"]],
|
|
125
139
|
transaction
|
|
126
140
|
});
|
|
@@ -154,12 +168,14 @@ class Processor {
|
|
|
154
168
|
async exec(instruction, node, prevJob) {
|
|
155
169
|
let job;
|
|
156
170
|
try {
|
|
157
|
-
this.logger.info(`execution (${this.execution.id}) run instruction [${node.type}] for node (${node.id})`);
|
|
158
171
|
this.logger.debug(`config of node`, { data: node.config });
|
|
159
172
|
job = await instruction(node, prevJob, this);
|
|
160
|
-
if (
|
|
173
|
+
if (job === null) {
|
|
161
174
|
return this.exit();
|
|
162
175
|
}
|
|
176
|
+
if (!job) {
|
|
177
|
+
return this.exit(true);
|
|
178
|
+
}
|
|
163
179
|
} catch (err) {
|
|
164
180
|
this.logger.error(
|
|
165
181
|
`execution (${this.execution.id}) run instruction [${node.type}] for node (${node.id}) failed: `,
|
|
@@ -201,6 +217,7 @@ class Processor {
|
|
|
201
217
|
if (typeof instruction.run !== "function") {
|
|
202
218
|
return Promise.reject(new Error("`run` should be implemented for customized execution of the node"));
|
|
203
219
|
}
|
|
220
|
+
this.logger.info(`execution (${this.execution.id}) run instruction [${node.type}] for node (${node.id})`);
|
|
204
221
|
return this.exec(instruction.run.bind(instruction), node, input);
|
|
205
222
|
}
|
|
206
223
|
// parent node should take over the control
|
|
@@ -225,16 +242,35 @@ class Processor {
|
|
|
225
242
|
new Error(`"resume" method should be implemented for [${node.type}] instruction of node (#${node.id})`)
|
|
226
243
|
);
|
|
227
244
|
}
|
|
245
|
+
this.logger.info(`execution (${this.execution.id}) resume instruction [${node.type}] for node (${node.id})`);
|
|
228
246
|
return this.exec(instruction.resume.bind(instruction), node, job);
|
|
229
247
|
}
|
|
230
248
|
async exit(s) {
|
|
249
|
+
if (s === true) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
231
252
|
if (this.jobsToSave.size) {
|
|
232
253
|
const newJobs = [];
|
|
233
254
|
for (const job of this.jobsToSave.values()) {
|
|
234
255
|
if (job.isNewRecord) {
|
|
235
256
|
newJobs.push(job);
|
|
236
257
|
} else {
|
|
237
|
-
|
|
258
|
+
const JobCollection = this.options.plugin.db.getCollection("jobs");
|
|
259
|
+
const changes = [];
|
|
260
|
+
if (job.changed("status")) {
|
|
261
|
+
changes.push([`status`, job.status]);
|
|
262
|
+
job.changed("status", false);
|
|
263
|
+
}
|
|
264
|
+
if (job.changed("result")) {
|
|
265
|
+
changes.push([`result`, JSON.stringify(job.result ?? null)]);
|
|
266
|
+
job.changed("result", false);
|
|
267
|
+
}
|
|
268
|
+
if (changes.length) {
|
|
269
|
+
await this.options.plugin.db.sequelize.query(
|
|
270
|
+
`UPDATE ${JobCollection.quotedTableName()} SET ${changes.map(([key]) => `${key} = ?`)} WHERE id='${job.id}'`,
|
|
271
|
+
{ replacements: changes.map(([, value]) => value), transaction: this.mainTransaction }
|
|
272
|
+
);
|
|
273
|
+
}
|
|
238
274
|
}
|
|
239
275
|
}
|
|
240
276
|
if (newJobs.length) {
|
|
@@ -273,18 +309,24 @@ class Processor {
|
|
|
273
309
|
job = payload;
|
|
274
310
|
job.set("updatedAt", /* @__PURE__ */ new Date());
|
|
275
311
|
} else {
|
|
276
|
-
job = model.build(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
312
|
+
job = model.build(
|
|
313
|
+
{
|
|
314
|
+
...payload,
|
|
315
|
+
id: this.options.plugin.snowflake.getUniqueID().toString(),
|
|
316
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
317
|
+
updatedAt: /* @__PURE__ */ new Date(),
|
|
318
|
+
executionId: this.execution.id
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
isNewRecord: true
|
|
322
|
+
}
|
|
323
|
+
);
|
|
283
324
|
}
|
|
284
325
|
this.jobsToSave.set(job.id, job);
|
|
285
326
|
this.lastSavedJob = job;
|
|
286
327
|
this.jobsMapByNodeKey[job.nodeKey] = job;
|
|
287
328
|
this.jobResultsMapByNodeKey[job.nodeKey] = job.result;
|
|
329
|
+
this.logger.debug(`job added to save list: ${JSON.stringify(job)}`);
|
|
288
330
|
return job;
|
|
289
331
|
}
|
|
290
332
|
/**
|
|
@@ -349,7 +391,7 @@ class Processor {
|
|
|
349
391
|
for (let n = this.findBranchEndNode(node); n && n !== node.upstream; n = n.upstream) {
|
|
350
392
|
branchJobs.push(...allJobs.filter((item) => item.nodeId === n.id));
|
|
351
393
|
}
|
|
352
|
-
branchJobs.sort((a, b) => a.
|
|
394
|
+
branchJobs.sort((a, b) => a.id - b.id);
|
|
353
395
|
return branchJobs[branchJobs.length - 1] || null;
|
|
354
396
|
}
|
|
355
397
|
/**
|
|
@@ -362,8 +404,8 @@ class Processor {
|
|
|
362
404
|
execution: this.execution,
|
|
363
405
|
node
|
|
364
406
|
};
|
|
365
|
-
for (const [name,
|
|
366
|
-
(0, import_set.default)(systemFns, name,
|
|
407
|
+
for (const [name, fn2] of this.options.plugin.functions.getEntities()) {
|
|
408
|
+
(0, import_set.default)(systemFns, name, fn2.bind(scope));
|
|
367
409
|
}
|
|
368
410
|
const $scopes = {};
|
|
369
411
|
for (let n = includeSelfScope ? node : this.findBranchParentNode(node); n; n = this.findBranchParentNode(n)) {
|
|
@@ -70,14 +70,14 @@ async function cancel(context, next) {
|
|
|
70
70
|
await context.db.sequelize.transaction(async (transaction) => {
|
|
71
71
|
await execution.update(
|
|
72
72
|
{
|
|
73
|
-
status: import_constants.EXECUTION_STATUS.
|
|
73
|
+
status: import_constants.EXECUTION_STATUS.ABORTED
|
|
74
74
|
},
|
|
75
75
|
{ transaction }
|
|
76
76
|
);
|
|
77
77
|
const pendingJobs = execution.jobs.filter((job) => job.status === import_constants.JOB_STATUS.PENDING);
|
|
78
78
|
await JobRepo.update({
|
|
79
79
|
values: {
|
|
80
|
-
status: import_constants.JOB_STATUS.
|
|
80
|
+
status: import_constants.JOB_STATUS.ABORTED
|
|
81
81
|
},
|
|
82
82
|
filter: {
|
|
83
83
|
id: pendingJobs.map((job) => job.id)
|
|
@@ -75,7 +75,6 @@ class ConditionInstruction extends import__.Instruction {
|
|
|
75
75
|
}
|
|
76
76
|
const savedJob = processor.saveJob(job);
|
|
77
77
|
await processor.run(branchNode, savedJob);
|
|
78
|
-
return null;
|
|
79
78
|
}
|
|
80
79
|
async resume(node, branchJob, processor) {
|
|
81
80
|
const job = processor.findBranchParentJob(branchJob, node);
|
|
@@ -15,7 +15,7 @@ export interface IJob {
|
|
|
15
15
|
result?: unknown;
|
|
16
16
|
[key: string]: unknown;
|
|
17
17
|
}
|
|
18
|
-
export type InstructionResult = IJob | Promise<IJob> | null;
|
|
18
|
+
export type InstructionResult = IJob | Promise<IJob> | Promise<void> | null | void;
|
|
19
19
|
export type Runner = (node: FlowNodeModel, input: any, processor: Processor) => InstructionResult;
|
|
20
20
|
export type InstructionInterface = {
|
|
21
21
|
run: Runner;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流",
|
|
5
5
|
"description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
|
|
6
6
|
"description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
|
|
7
|
-
"version": "1.9.0-beta.
|
|
7
|
+
"version": "1.9.0-beta.6",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/workflow",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@nocobase/test": "1.x",
|
|
46
46
|
"@nocobase/utils": "1.x"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "ada5e359a91135cb9baf605c04c5c380f067a046",
|
|
49
49
|
"keywords": [
|
|
50
50
|
"Workflow"
|
|
51
51
|
]
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_workflow=self.webpackChunk_nocobase_plugin_workflow||[]).push([["610"],{7291:function(e,t,r){r.d(t,{g:function(){return k}});var n=r(2721),o=r(8156),a=r.n(o);let l=(0,o.createContext)(null),i={didCatch:!1,error:null};class c extends o.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=i}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(null!==e){for(var t,r,n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];null==(t=(r=this.props).onReset)||t.call(r,{args:o,reason:"imperative-api"}),this.setState(i)}}componentDidCatch(e,t){var r,n;null==(r=(n=this.props).onError)||r.call(n,e,t)}componentDidUpdate(e,t){let{didCatch:r}=this.state,{resetKeys:n}=this.props;if(r&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)){var o,a;null==(o=(a=this.props).onReset)||o.call(a,{next:n,prev:e.resetKeys,reason:"keys"}),this.setState(i)}}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:a,error:i}=this.state,c=e;if(a){let e={error:i,resetErrorBoundary:this.resetErrorBoundary};if((0,o.isValidElement)(n))c=n;else if("function"==typeof t)c=t(e);else if(r)c=(0,o.createElement)(r,e);else throw i}return(0,o.createElement)(l.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},c)}}var s=r(3772),u=r(8490),d=r(2748),f=r(1784),p=r(7967),m=r(3540),v=r(7996);function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function b(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function h(){var e=b(["\n margin-top: 0 !important;\n "]);return h=function(){return e},e}function w(){var e=b(["\n margin-bottom: 1em;\n "]);return w=function(){return e},e}function g(){var e=b(["\n margin-top: 0 !important;\n "]);return g=function(){return e},e}function k(e){var t,r=e.entry,o=(0,f.Z)().styles,l=(0,v.RY)(),i=(t=a().useState(100),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(t,2)||function(e,t){if(e){if("string"==typeof e)return y(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),b=i[0],k=i[1];return a().createElement("div",{className:"workflow-canvas-wrapper"},a().createElement(c,{FallbackComponent:s.ErrorFallback,onError:console.error},a().createElement(m.E1,null,a().createElement("div",{className:"workflow-canvas",style:{zoom:b/100}},a().createElement("div",{className:(0,s.cx)(o.branchBlockClass,(0,s.css)(h()))},a().createElement("div",{className:o.branchClass},l?a().createElement(n.Alert,{type:"warning",message:(0,d.KQ)("Executed workflow cannot be modified. Could be copied to a new version to modify."),showIcon:!0,className:(0,s.css)(w())}):null,a().createElement(p.Gk,null),a().createElement("div",{className:(0,s.cx)(o.branchBlockClass,(0,s.css)(g()))},a().createElement(u.I,{entry:r})),a().createElement("div",{className:o.terminalClass},(0,d.KQ)("End"))))))),a().createElement("div",{className:"workflow-canvas-zoomer"},a().createElement(n.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:b,onChange:k})))}},2842:function(e,t,r){r.r(t),r.d(t,{WorkflowPage:function(){return G}});var n=r(3772),o=r(8156),a=r.n(o),l=r(6128),i=r(1784),c=r(3238),s=r(2721),u=r(482),d=r(3505),f=r(7584),p=r(7291),m=r(5352),v=r(6920),y=r(5680),b=r(2748),h=r(5519),w=r(5292),g=r(1113),k=r(5494),E=r(7967),x=r(3377),A=r(2072),C=r(7996);function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function S(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function P(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){S(a,n,o,l,i,"next",e)}function i(e){S(a,n,o,l,i,"throw",e)}l(void 0)})}}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function T(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function R(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function K(e,t){var r,n,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var c=[a,i];if(r)throw TypeError("Generator is already executing.");for(;l;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,n=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function N(){var e,t,r=(e=["\n margin-bottom: 1em;\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return N=function(){return r},r}function B(e){var t,r=e.request,o=(e.filter,R(e,["request","filter"])),l=(0,y.G2)().workflow,i=T(j({},o),{request:T(j({},r),{params:T(j({},null==r?void 0:r.params),{filter:T(j({},null==r||null==(t=r.params)?void 0:t.filter),{key:l.key})})})});return a().createElement(n.ResourceActionProvider,i)}function F(e){var t=e.data,r=e.option,o=(0,n.useCompile)()(r.label);return a().createElement(c.Trans,{ns:b.A7,values:{statusText:o}},"Workflow executed, the result status is ",a().createElement(s.Tag,{color:r.color},"{{statusText}}"),a().createElement(l.Link,{to:"/admin/workflow/executions/".concat(t.id)},"View the execution"))}function Q(){var e=(0,y.G2)().workflow,t=(0,d.useForm)(),r=(0,n.useResourceContext)().resource,o=(0,n.useActionContext)(),l=(0,n.useNavigateNoUpdate)(),i=s.App.useApp().message,c=(0,C.RY)();return{run:function(){return P(function(){var n,s,u,d;return K(this,function(f){switch(f.label){case 0:return s=(n=t.values).autoRevision,u=R(n,["autoRevision"]),[4,t.submit()];case 1:return f.sent(),[4,r.execute(j({filterByTk:e.id,values:u},!c&&s?{autoRevision:1}:{}))];case 2:var p,m,v,y;return d=f.sent().data.data,t.reset(),o.setFormValueChanged(!1),o.setVisible(!1),null==i||i.open((m=(p=d.execution).id,v=p.status,(y=x.uy[v])?{type:"info",content:a().createElement(F,{data:{id:m},option:y})}:null)),d.newVersionId&&l("/admin/workflow/workflows/".concat(d.newVersionId)),[2]}})})()}}}function D(e){var t=e.children,r=(0,d.useField)(),n=(0,y.G2)().workflow,o=(0,E.cC)(),l=o.validate(n.config),i="";switch(!0){case!l:i=(0,b.KQ)("The trigger is not configured correctly, please check the trigger configuration.");break;case!o.triggerFieldset:i=(0,b.KQ)("This type of trigger has not been supported to be executed manually.")}return r.setPattern(i?"disabled":"editable"),i?a().createElement(s.Tooltip,{title:i},t):t}function I(){var e,t=(0,y.G2)().workflow,r=(0,C.RY)(),o=(0,E.cC)();return a().createElement(y.zQ.Provider,{value:t},a().createElement(A.XA.Provider,{value:!0},a().createElement(n.SchemaComponent,{components:j({Alert:s.Alert,Fieldset:g.p,ActionDisabledProvider:D},o.components),scope:j({useCancelAction:n.useCancelAction,useExecuteConfirmAction:Q},o.scope),schema:{name:"trigger-modal-".concat(t.type,"-").concat(t.id),type:"void","x-decorator":"ActionDisabledProvider","x-component":"Action","x-component-props":{openSize:"small"},title:"{{t('Execute manually', { ns: \"".concat(b.A7,'" })}}'),properties:{drawer:{type:"void","x-decorator":"FormV2","x-component":"Action.Modal",title:"{{t('Execute manually', { ns: \"".concat(b.A7,'" })}}'),properties:T(j(T(j({},Object.keys(null!=(e=o.triggerFieldset)?e:{}).length?{alert:{type:"void","x-component":"Alert","x-component-props":{message:"{{t('Trigger variables need to be filled for executing.', { ns: \"".concat(b.A7,'" })}}'),className:(0,n.css)(N())}}}:{description:{type:"void","x-component":"p","x-content":"{{t('This will perform all the actions configured in the workflow. Are you sure you want to continue?', { ns: \"".concat(b.A7,'" })}}')}}),{fieldset:{type:"void","x-decorator":"FormItem","x-component":"Fieldset",title:"{{t('Trigger variables', { ns: \"".concat(b.A7,'" })}}'),properties:o.triggerFieldset}}),r?{}:{autoRevision:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":"{{t('Automatically create a new version after execution', { ns: \"".concat(b.A7,'" })}}'),default:!0}}),{footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:"{{t('Cancel')}}","x-component":"Action","x-component-props":{useAction:"{{useCancelAction}}"}},submit:{type:"void",title:"{{t('Confirm')}}","x-component":"Action","x-component-props":{type:"primary",useAction:"{{useExecuteConfirmAction}}"}}}}})}}}})))}function V(){var e,t=(0,y.G2)(),r=t.workflow,i=t.revisions,d=(e=(0,o.useState)(!1),function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,2)||function(e,t){if(e){if("string"==typeof e)return O(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return O(e,t)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),f=d[0],p=d[1],g=(0,l.useNavigate)(),E=(0,c.useTranslation)().t,A=s.App.useApp().modal,S=(0,n.useApp)(),j=(0,n.useResourceContext)().resource,T=s.App.useApp().message;(0,C.RY)();var R=(0,C.U3)(),N=(0,o.useCallback)(P(function(){var e;return K(this,function(t){switch(t.label){case 0:return[4,j.revision({filterByTk:r.id,filter:{key:r.key}})];case 1:return e=t.sent().data.data,T.success(E("Operation succeeded")),g("/admin/workflow/workflows/".concat(e.id)),[2]}})}),[j,r.id,r.key,T,E,g]),F=(0,o.useCallback)(P(function(){var e;return K(this,function(t){return e=r.current?(0,b.KQ)("This is a main version, delete it will cause the whole workflow to be deleted (including all other revisions)."):(0,b.KQ)("Current version will be deleted (without affecting other versions)."),A.confirm({title:E("Are you sure you want to delete it?"),content:e,onOk:function(){return P(function(){var e;return K(this,function(t){switch(t.label){case 0:return[4,j.destroy({filterByTk:r.id})];case 1:return t.sent(),T.success(E("Operation succeeded")),g(r.current?S.pluginSettingsManager.getRoutePath("workflow"):(0,w.SI)(null==(e=i.find(function(e){return e.current}))?void 0:e.id)),[2]}})})()}}),[2]})}),[r,A,E,j,T,g,S.pluginSettingsManager,i]),Q=(0,o.useCallback)(function(e){switch(e.key){case"history":p(!0);return;case"revision":return N();case"delete":return F()}},[F,N]);return a().createElement(a().Fragment,null,a().createElement(s.Dropdown,{menu:{items:[{key:"key",label:"Key: ".concat(r.key),disabled:!0},{type:"divider"},{role:"button","aria-label":"history",key:"history",label:(0,b.KQ)("Execution history"),disabled:!R},{role:"button","aria-label":"revision",key:"revision",label:(0,b.KQ)("Copy to new version")},{type:"divider"},{role:"button","aria-label":"delete",danger:!0,key:"delete",label:E("Delete")}],onClick:Q}},a().createElement(s.Button,{"aria-label":"more",type:"text",icon:a().createElement(u.EllipsisOutlined,null)})),a().createElement(n.ActionContextProvider,{value:{visible:f,setVisible:p}},a().createElement(n.SchemaComponent,{schema:h.V,components:{ExecutionResourceProvider:B,ExecutionLink:v.a,ExecutionStatusColumn:m.r},scope:{useRefreshActionProps:k.X,ExecutionStatusOptions:x.C6}})))}function z(){var e,t,r=(0,l.useNavigate)(),c=(0,n.useApp)(),d=(0,n.useResourceActionContext)(),m=d.data,v=d.refresh,h=d.loading,g=(0,n.useResourceContext)().resource,k=(0,n.useDocumentTitle)().setTitle,E=(0,i.Z)().styles,x=null!=(t=null==m?void 0:m.data)?t:{},A=x.nodes,C=void 0===A?[]:A,O=x.revisions,S=void 0===O?[]:O,j=R(x,["nodes","revisions"]);(0,w.Yc)(C),(0,o.useEffect)(function(){var e,t=(null!=(e=null==m?void 0:m.data)?e:{}).title;null==k||k("".concat((0,b.KQ)("Workflow")).concat(t?": ".concat(t):""))},[null==m?void 0:m.data,k]);var T=(0,o.useCallback)(function(e){var t=e.key;t!=j.id&&r((0,w.SI)(t))},[j.id,r]),N=(0,o.useCallback)((e=P(function(e){return K(this,function(t){switch(t.label){case 0:return[4,g.update({filterByTk:j.id,values:{enabled:e}})];case 1:return t.sent(),v(),[2]}})}),function(t){return e.apply(this,arguments)}),[g,j.id,v]);if(!(null==m?void 0:m.data))return h?a().createElement(s.Spin,null):a().createElement(s.Result,{status:"404",title:"Not found",extra:a().createElement(s.Button,{onClick:function(){return r(-1)}},(0,b.KQ)("Go back"))});var B=C.find(function(e){return!e.upstream});return a().createElement(y.iT.Provider,{value:{workflow:j,revisions:S,nodes:C,refresh:v}},a().createElement("div",{className:"workflow-toolbar"},a().createElement("header",null,a().createElement(s.Breadcrumb,{items:[{title:a().createElement(l.Link,{to:c.pluginSettingsManager.getRoutePath("workflow")},(0,b.KQ)("Workflow"))},{title:a().createElement(s.Tooltip,{title:"Key: ".concat(j.key)},a().createElement("strong",null,j.title))}]}),j.sync?a().createElement(s.Tag,{color:"orange"},(0,b.KQ)("Synchronously")):a().createElement(s.Tag,{color:"cyan"},(0,b.KQ)("Asynchronously"))),a().createElement("aside",null,a().createElement(I,null),a().createElement(s.Dropdown,{className:"workflow-versions",trigger:["click"],menu:{onClick:T,defaultSelectedKeys:["".concat(j.id)],className:(0,n.cx)(E.dropdownClass,E.workflowVersionDropdownClass),items:S.sort(function(e,t){return t.id-e.id}).map(function(e,t){return{role:"button","aria-label":"version-".concat(t),key:"".concat(e.id),icon:e.current?a().createElement(u.RightOutlined,null):null,className:(0,n.cx)({executed:e.versionStats.executed>0,unexecuted:0==e.versionStats.executed,enabled:e.enabled}),label:a().createElement(a().Fragment,null,a().createElement("strong",null,"#".concat(e.id)),a().createElement("time",null,(0,f.dayjs)(e.createdAt).fromNow()))}})}},a().createElement(s.Button,{type:"text","aria-label":"version"},a().createElement("label",null,(0,b.KQ)("Version")),a().createElement("span",null,(null==j?void 0:j.id)?"#".concat(j.id):null),a().createElement(u.DownOutlined,null))),a().createElement(s.Switch,{checked:j.enabled,onChange:N,checkedChildren:(0,b.KQ)("On"),unCheckedChildren:(0,b.KQ)("Off")}),a().createElement(V,null))),a().createElement(p.g,{entry:B}))}var G=function(){var e,t,r,o=(0,l.useParams)(),c=(0,i.Z)().styles;return a().createElement("div",{className:(0,n.cx)(c.workflowPageClass)},a().createElement(n.SchemaComponent,{schema:{type:"void",properties:(e={},t="provider_".concat(o.id),r={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"workflows",fields:[]},resourceName:"workflows",request:{resource:"workflows",action:"get",params:{filter:{id:o.id},appends:["nodes","revisions.id","revisions.createdAt","revisions.current","revisions.stats.executed","revisions.versionStats.executed","revisions.enabled","stats.executed","versionStats.executed"]}}},"x-component":"WorkflowCanvas"},t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e)},components:{WorkflowCanvas:z}}))}}}]);
|