@nocobase/plugin-workflow 2.2.0-alpha.1 → 2.2.0-beta.2
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/618.c91be3f6e4d73501.js +10 -0
- package/dist/client/{67.452743ce8ec30617.js → 67.61e70b8b777f8638.js} +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/style.d.ts +1 -0
- package/dist/externalVersion.js +12 -12
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/joi/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/ExecutionTimeoutManager.js +2 -2
- package/dist/server/actions/nodes.js +36 -1
- package/dist/server/utils.js +19 -26
- package/package.json +2 -2
- package/dist/client/618.19af7f84261c815d.js +0 -10
package/dist/client/style.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<
|
|
|
11
11
|
dropdownClass: import("antd-style").SerializedStyles;
|
|
12
12
|
workflowVersionDropdownClass: import("antd-style").SerializedStyles;
|
|
13
13
|
executionsDropdownRowClass: import("antd-style").SerializedStyles;
|
|
14
|
+
workflowDetailsDescriptionClass: import("antd-style").SerializedStyles;
|
|
14
15
|
branchBlockClass: import("antd-style").SerializedStyles;
|
|
15
16
|
branchClass: import("antd-style").SerializedStyles;
|
|
16
17
|
nodeBlockClass: import("antd-style").SerializedStyles;
|
package/dist/externalVersion.js
CHANGED
|
@@ -11,8 +11,8 @@ module.exports = {
|
|
|
11
11
|
"react": "18.2.0",
|
|
12
12
|
"@formily/core": "2.3.7",
|
|
13
13
|
"@formily/react": "2.3.7",
|
|
14
|
-
"@nocobase/client": "2.2.0-
|
|
15
|
-
"@nocobase/utils": "2.2.0-
|
|
14
|
+
"@nocobase/client": "2.2.0-beta.2",
|
|
15
|
+
"@nocobase/utils": "2.2.0-beta.2",
|
|
16
16
|
"antd": "5.24.2",
|
|
17
17
|
"@ant-design/icons": "5.6.1",
|
|
18
18
|
"react-router-dom": "6.30.1",
|
|
@@ -20,20 +20,20 @@ module.exports = {
|
|
|
20
20
|
"lodash": "4.18.1",
|
|
21
21
|
"@dnd-kit/core": "6.1.0",
|
|
22
22
|
"@formily/shared": "2.3.7",
|
|
23
|
-
"@nocobase/flow-engine": "2.2.0-
|
|
24
|
-
"@nocobase/plugin-mobile": "2.2.0-
|
|
23
|
+
"@nocobase/flow-engine": "2.2.0-beta.2",
|
|
24
|
+
"@nocobase/plugin-mobile": "2.2.0-beta.2",
|
|
25
25
|
"sequelize": "6.35.2",
|
|
26
|
-
"@nocobase/server": "2.2.0-
|
|
27
|
-
"@nocobase/database": "2.2.0-
|
|
28
|
-
"@nocobase/data-source-manager": "2.2.0-
|
|
29
|
-
"@nocobase/logger": "2.2.0-
|
|
30
|
-
"@nocobase/evaluators": "2.2.0-
|
|
26
|
+
"@nocobase/server": "2.2.0-beta.2",
|
|
27
|
+
"@nocobase/database": "2.2.0-beta.2",
|
|
28
|
+
"@nocobase/data-source-manager": "2.2.0-beta.2",
|
|
29
|
+
"@nocobase/logger": "2.2.0-beta.2",
|
|
30
|
+
"@nocobase/evaluators": "2.2.0-beta.2",
|
|
31
31
|
"@formily/antd-v5": "1.2.3",
|
|
32
32
|
"@formily/reactive": "2.3.7",
|
|
33
33
|
"@emotion/css": "11.13.0",
|
|
34
34
|
"@formily/json-schema": "2.3.7",
|
|
35
|
-
"@nocobase/actions": "2.2.0-
|
|
35
|
+
"@nocobase/actions": "2.2.0-beta.2",
|
|
36
36
|
"dayjs": "1.11.13",
|
|
37
|
-
"@nocobase/plugin-workflow-test": "2.2.0-
|
|
38
|
-
"@nocobase/test": "2.2.0-
|
|
37
|
+
"@nocobase/plugin-workflow-test": "2.2.0-beta.2",
|
|
38
|
+
"@nocobase/test": "2.2.0-beta.2"
|
|
39
39
|
};
|
|
@@ -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":"2026-06-
|
|
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":"2026-06-13T08:44:15.747Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-06-
|
|
1
|
+
{"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-06-13T08:44:15.472Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"11.3.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","prepare":"tshy && bash scripts/build.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig ./.tshy/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","lint":"oxlint --fix src test","postsnap":"npm run lint","postlint":"npm run format"},"main":"./dist/commonjs/index.min.js","types":"./dist/commonjs/index.d.ts","tshy":{"esmDialects":["node","browser"],"exports":{"./raw":"./src/index.ts",".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"selfLink":false},"repository":{"type":"git","url":"git+ssh://git@github.com/isaacs/node-lru-cache.git"},"devDependencies":{"benchmark":"^2.1.4","esbuild":"^0.25.9","marked":"^4.2.12","mkdirp":"^3.0.1","oxlint":"^1.58.0","oxlint-tsgolint":"^0.19.0","prettier":"^3.8.1","tap":"^21.6.3","tshy":"^4.1.1","typedoc":"^0.28.18"},"license":"BlueOak-1.0.0","files":["dist"],"engines":{"node":"20 || >=22"},"exports":{"./raw":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"type":"module","module":"./dist/esm/index.min.js","_lastModified":"2026-06-
|
|
1
|
+
{"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"11.3.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","prepare":"tshy && bash scripts/build.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig ./.tshy/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","lint":"oxlint --fix src test","postsnap":"npm run lint","postlint":"npm run format"},"main":"./dist/commonjs/index.min.js","types":"./dist/commonjs/index.d.ts","tshy":{"esmDialects":["node","browser"],"exports":{"./raw":"./src/index.ts",".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"selfLink":false},"repository":{"type":"git","url":"git+ssh://git@github.com/isaacs/node-lru-cache.git"},"devDependencies":{"benchmark":"^2.1.4","esbuild":"^0.25.9","marked":"^4.2.12","mkdirp":"^3.0.1","oxlint":"^1.58.0","oxlint-tsgolint":"^0.19.0","prettier":"^3.8.1","tap":"^21.6.3","tshy":"^4.1.1","typedoc":"^0.28.18"},"license":"BlueOak-1.0.0","files":["dist"],"engines":{"node":"20 || >=22"},"exports":{"./raw":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},".":{"import":{"node":{"types":"./dist/esm/node/index.d.ts","default":"./dist/esm/node/index.min.js"},"browser":{"types":"./dist/esm/browser/index.d.ts","default":"./dist/esm/browser/index.min.js"},"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}}},"type":"module","module":"./dist/esm/index.min.js","_lastModified":"2026-06-13T08:44:14.676Z"}
|
|
@@ -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":"2026-06-
|
|
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":"2026-06-13T08:44:14.502Z"}
|
|
@@ -81,10 +81,10 @@ class ExecutionTimeoutManager {
|
|
|
81
81
|
await ((_a = this.scanning) == null ? void 0 : _a.catch(() => {
|
|
82
82
|
}));
|
|
83
83
|
}
|
|
84
|
-
isExpired(execution, now =
|
|
84
|
+
isExpired(execution, now = new Date(Date.now())) {
|
|
85
85
|
return !!execution.expiresAt && execution.expiresAt.getTime() <= now.getTime();
|
|
86
86
|
}
|
|
87
|
-
getRemainingMs(execution, now =
|
|
87
|
+
getRemainingMs(execution, now = new Date(Date.now())) {
|
|
88
88
|
if (!execution.expiresAt) {
|
|
89
89
|
return null;
|
|
90
90
|
}
|
|
@@ -78,6 +78,23 @@ function validateNode(context, workflow, values) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
+
async function touchWorkflow(context, workflowId, transaction) {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
const values = {
|
|
84
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
85
|
+
};
|
|
86
|
+
const currentUserId = (_b = (_a = context.state) == null ? void 0 : _a.currentUser) == null ? void 0 : _b.id;
|
|
87
|
+
if (currentUserId != null) {
|
|
88
|
+
values.updatedById = currentUserId;
|
|
89
|
+
}
|
|
90
|
+
await context.db.getCollection("workflows").model.update(values, {
|
|
91
|
+
where: {
|
|
92
|
+
id: workflowId
|
|
93
|
+
},
|
|
94
|
+
transaction,
|
|
95
|
+
hooks: false
|
|
96
|
+
});
|
|
97
|
+
}
|
|
81
98
|
async function create(context, next) {
|
|
82
99
|
const { db } = context;
|
|
83
100
|
const repository = import_actions.utils.getRepositoryFromParams(context);
|
|
@@ -122,6 +139,7 @@ async function create(context, next) {
|
|
|
122
139
|
await instance.setDownstream(previousHead, { transaction });
|
|
123
140
|
instance.set("downstream", previousHead);
|
|
124
141
|
}
|
|
142
|
+
await touchWorkflow(context, workflow.id, transaction);
|
|
125
143
|
return instance;
|
|
126
144
|
}
|
|
127
145
|
const upstream = await instance.getUpstream({ transaction });
|
|
@@ -162,6 +180,7 @@ async function create(context, next) {
|
|
|
162
180
|
}
|
|
163
181
|
}
|
|
164
182
|
instance.set("upstream", upstream);
|
|
183
|
+
await touchWorkflow(context, workflow.id, transaction);
|
|
165
184
|
return instance;
|
|
166
185
|
});
|
|
167
186
|
await next();
|
|
@@ -233,6 +252,7 @@ async function duplicate(context, next) {
|
|
|
233
252
|
await instance.setDownstream(previousHead, { transaction });
|
|
234
253
|
instance.set("downstream", previousHead);
|
|
235
254
|
}
|
|
255
|
+
await touchWorkflow(context, origin.workflowId, transaction);
|
|
236
256
|
return instance;
|
|
237
257
|
}
|
|
238
258
|
const upstream = await instance.getUpstream({ transaction });
|
|
@@ -273,6 +293,7 @@ async function duplicate(context, next) {
|
|
|
273
293
|
}
|
|
274
294
|
}
|
|
275
295
|
instance.set("upstream", upstream);
|
|
296
|
+
await touchWorkflow(context, origin.workflowId, transaction);
|
|
276
297
|
return instance;
|
|
277
298
|
});
|
|
278
299
|
await next();
|
|
@@ -401,6 +422,7 @@ async function destroy(context, next) {
|
|
|
401
422
|
filterByTk: [instance.id, ...branchNodesToDelete.map((item) => item.id)],
|
|
402
423
|
transaction
|
|
403
424
|
});
|
|
425
|
+
await touchWorkflow(context, instance.workflowId, transaction);
|
|
404
426
|
});
|
|
405
427
|
context.body = instance;
|
|
406
428
|
await next();
|
|
@@ -431,6 +453,7 @@ async function destroyBranch(context, next) {
|
|
|
431
453
|
}
|
|
432
454
|
let deletedBranchHead = null;
|
|
433
455
|
await db.sequelize.transaction(async (transaction) => {
|
|
456
|
+
let shouldTouchWorkflow = false;
|
|
434
457
|
const nodes = await repository.find({
|
|
435
458
|
filter: {
|
|
436
459
|
workflowId: instance.workflowId
|
|
@@ -461,6 +484,7 @@ async function destroyBranch(context, next) {
|
|
|
461
484
|
filterByTk: idsToDelete,
|
|
462
485
|
transaction
|
|
463
486
|
});
|
|
487
|
+
shouldTouchWorkflow = true;
|
|
464
488
|
}
|
|
465
489
|
}
|
|
466
490
|
if (shift) {
|
|
@@ -475,6 +499,12 @@ async function destroyBranch(context, next) {
|
|
|
475
499
|
)
|
|
476
500
|
)
|
|
477
501
|
);
|
|
502
|
+
if (headsToShift.length) {
|
|
503
|
+
shouldTouchWorkflow = true;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
if (shouldTouchWorkflow) {
|
|
507
|
+
await touchWorkflow(context, instance.workflowId, transaction);
|
|
478
508
|
}
|
|
479
509
|
});
|
|
480
510
|
context.body = deletedBranchHead;
|
|
@@ -579,6 +609,7 @@ async function move(context, next) {
|
|
|
579
609
|
},
|
|
580
610
|
{ transaction }
|
|
581
611
|
);
|
|
612
|
+
await touchWorkflow(context, instance.workflowId, transaction);
|
|
582
613
|
return instance;
|
|
583
614
|
}
|
|
584
615
|
if (branchIndex == null) {
|
|
@@ -612,6 +643,7 @@ async function move(context, next) {
|
|
|
612
643
|
},
|
|
613
644
|
{ transaction }
|
|
614
645
|
);
|
|
646
|
+
await touchWorkflow(context, instance.workflowId, transaction);
|
|
615
647
|
return instance;
|
|
616
648
|
}
|
|
617
649
|
const branchHead = await repository.findOne({
|
|
@@ -640,6 +672,7 @@ async function move(context, next) {
|
|
|
640
672
|
},
|
|
641
673
|
{ transaction }
|
|
642
674
|
);
|
|
675
|
+
await touchWorkflow(context, instance.workflowId, transaction);
|
|
643
676
|
return instance;
|
|
644
677
|
});
|
|
645
678
|
await next();
|
|
@@ -660,7 +693,7 @@ async function update(context, next) {
|
|
|
660
693
|
}
|
|
661
694
|
const merged = Object.assign({}, instance.get(), values);
|
|
662
695
|
validateNode(context, null, merged);
|
|
663
|
-
|
|
696
|
+
const result = await repository.update({
|
|
664
697
|
filterByTk,
|
|
665
698
|
values,
|
|
666
699
|
whitelist,
|
|
@@ -670,6 +703,8 @@ async function update(context, next) {
|
|
|
670
703
|
context,
|
|
671
704
|
transaction
|
|
672
705
|
});
|
|
706
|
+
await touchWorkflow(context, instance.workflowId, transaction);
|
|
707
|
+
return result;
|
|
673
708
|
});
|
|
674
709
|
await next();
|
|
675
710
|
}
|
package/dist/server/utils.js
CHANGED
|
@@ -95,33 +95,30 @@ async function abortExecution(plugin, execution, options = {}) {
|
|
|
95
95
|
const ExecutionRepo = plugin.db.getRepository("executions");
|
|
96
96
|
const JobRepo = plugin.db.getRepository("jobs");
|
|
97
97
|
try {
|
|
98
|
+
if (!transaction) {
|
|
99
|
+
return plugin.db.sequelize.transaction(
|
|
100
|
+
(transaction2) => abortExecution(plugin, execution, {
|
|
101
|
+
...options,
|
|
102
|
+
transaction: transaction2
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
}
|
|
98
106
|
const abortValues = {
|
|
99
107
|
status: import_constants.EXECUTION_STATUS.ABORTED,
|
|
100
108
|
...options.reason ? {
|
|
101
109
|
reason: options.reason
|
|
102
110
|
} : {}
|
|
103
111
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
} else {
|
|
115
|
-
const [affected] = await ExecutionRepo.model.update(abortValues, {
|
|
116
|
-
where: {
|
|
117
|
-
id: execution.id,
|
|
118
|
-
status: import_constants.EXECUTION_STATUS.STARTED
|
|
119
|
-
},
|
|
120
|
-
individualHooks: true
|
|
121
|
-
});
|
|
122
|
-
if (!affected) {
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
112
|
+
const [affected] = await ExecutionRepo.model.update(abortValues, {
|
|
113
|
+
where: {
|
|
114
|
+
id: execution.id,
|
|
115
|
+
status: import_constants.EXECUTION_STATUS.STARTED
|
|
116
|
+
},
|
|
117
|
+
individualHooks: true,
|
|
118
|
+
transaction
|
|
119
|
+
});
|
|
120
|
+
if (!affected) {
|
|
121
|
+
return false;
|
|
125
122
|
}
|
|
126
123
|
const updated = await JobRepo.update({
|
|
127
124
|
values: {
|
|
@@ -150,11 +147,7 @@ async function abortExecution(plugin, execution, options = {}) {
|
|
|
150
147
|
plugin.timeoutManager.clear(execution.id);
|
|
151
148
|
plugin.abortRunningExecution(execution.id, options.reason);
|
|
152
149
|
};
|
|
153
|
-
|
|
154
|
-
afterTransactionCommit(transaction, updateLocalState);
|
|
155
|
-
} else {
|
|
156
|
-
updateLocalState();
|
|
157
|
-
}
|
|
150
|
+
afterTransactionCommit(transaction, updateLocalState);
|
|
158
151
|
logger.info(`execution (${execution.id}) aborted`, {
|
|
159
152
|
workflowId: execution.workflowId,
|
|
160
153
|
pendingJobs: Array.isArray(updated) ? updated.length : updated
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
|
|
7
7
|
"description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
|
|
8
8
|
"description.ru-RU": "Мощный инструмент BPM, обеспечивающий базовую поддержку автоматизации бизнес-процессов с возможностью неограниченного расширения триггеров и узлов.",
|
|
9
|
-
"version": "2.2.0-
|
|
9
|
+
"version": "2.2.0-beta.2",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/workflow",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@nocobase/test": "2.x",
|
|
50
50
|
"@nocobase/utils": "2.x"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "2fe3e6a86fc1d0cd039349a68b2e4d1d6945ce45",
|
|
53
53
|
"keywords": [
|
|
54
54
|
"Workflow"
|
|
55
55
|
]
|
|
@@ -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([["618"],{5705:function(e,t,r){r.r(t),r.d(t,{WorkflowPane:function(){return eO}});var n,o,i=r(9155),c=r.n(i),a=r(2059),l=r(9452),u=r(5230),s=r(3342),p=r(4421);function m(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 d(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var f=function(e){var t,r=e.request,n=(e.filter,function(e,t){if(null==e)return{};var r,n,o,i={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,r=Reflect.ownKeys(Object(e));o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}if(i=function(e,t){if(null==e)return{};var r,n,o={},i=Object.getOwnPropertyNames(e);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,["request","filter"])),o=(0,s.useRecord)(),i=d(m({},n),{request:d(m({},r),{params:d(m({disableDefaultAppends:!0},null==r?void 0:r.params),{filter:d(m({},null==r||null==(t=r.params)?void 0:t.filter),{key:o.key})})})});return c().createElement(s.ResourceActionProvider,i)},y=r(5953),b=r(4442),v=r(6072),g=function(){var e=(0,y.useTranslation)().t,t=(0,s.useRecord)().id,r=(0,s.useActionContext)().setVisible,n=(0,s.useGetAriaLabelOfAction)("Configure").getAriaLabel;return c().createElement(b.Link,{"aria-label":n(),to:(0,v.Yz)(t),onClick:function(){return r(!1)}},e("Configure"))};function x(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 h(e){var t,r,n,o=e.component,a=e.children,l=function(e,t){if(null==e)return{};var r,n,o,i={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,r=Reflect.ownKeys(Object(e));o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}if(i=function(e,t){if(null==e)return{};var r,n,o={},i=Object.getOwnPropertyNames(e);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,["component","children"]),p=function(e){if(Array.isArray(e))return e}(t=(0,i.useState)(!1))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){c=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw r}}return o}}(t)||function(e){if(e){if("string"==typeof e)return x(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return x(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),m=p[0],d=p[1],f=(0,u.useFieldSchema)();return c().createElement(s.ActionContextProvider,{value:{visible:m,setVisible:d,fieldSchema:f}},c().createElement(void 0===o?"div":o,(r=function(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}({},l),n=n={onClick:function(){d(!0)}},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}),r),a),c().createElement(s.SchemaComponent,{schema:f,onlyRenderProperties:!0}))}var O=r(3872),w=r(6481),C=r(7428),A=r(5827),S=r(2662);function P(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}var j={title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-decorator":"FormItem",title:'{{t("Trigger type", { ns: "'.concat(O.CU,'" })}}'),"x-component":"Select","x-component-props":{optionRender:"{{TriggerOptionRender}}",popupMatchSelectWidth:!0,listHeight:300},enum:"{{useTriggersOptions()}}",required:!0},sync:{type:"boolean",title:'{{ t("Execute mode", { ns: "'.concat(O.CU,'" }) }}'),description:'{{ t("Execute workflow asynchronously or synchronously based on trigger type, and could not be changed after created.", { ns: "'.concat(O.CU,'" }) }}'),"x-decorator":"FormItem","x-component":"SyncOptionSelect","x-component-props":{options:[{label:'{{ t("Asynchronously", { ns: "'.concat(O.CU,'" }) }}'),value:!1,tooltip:'{{ t("Will be executed in the background as a queued task.", { ns: "'.concat(O.CU,'" }) }}')},{label:'{{ t("Synchronously", { ns: "'.concat(O.CU,'" }) }}'),value:!0,tooltip:'{{ t("For user actions that require immediate feedback. Can not use asynchronous nodes in such mode, and it is not recommended to perform time-consuming operations under synchronous mode.", { ns: "'.concat(O.CU,'" }) }}')}]}},triggerPreset:{type:"void","x-component":"TriggerPresetFieldset"},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},categories:{type:"array",title:'{{ t("Category", { ns: "'.concat(O.CU,'" }) }}'),"x-decorator":"FormItem","x-component":"CollectionField","x-collection-field":"workflows.categories"},options:{type:"object","x-decorator":"FormItem",title:'{{ t("Advance options", { ns: "'.concat(O.CU,'" }) }}'),"x-component":"Fieldset",properties:{timeout:{type:"number",title:'{{ t("Timeout settings", { ns: "'.concat(O.CU,'" }) }}'),description:'{{ t("0 means unlimited. If you set any other value and the execution is still not completed when the timeout is reached, the execution plan will be terminated and the remaining nodes will not be executed. Time spent in queue is not counted; timing starts only after it first enters a processor.", { ns: "'.concat(O.CU,'" }) }}'),"x-decorator":"FormItem","x-component":"TimeoutInput",default:0},stackLimit:{type:"number",title:'{{ t("Maximum number of cycling triggers", { ns: "'.concat(O.CU,'" }) }}'),description:'{{ t("The triggers of same workflow by some node (create, update and sub-flow etc.) more than this number will be ignored. Large number may cause performance issues. Please use with caution.", { ns: "'.concat(O.CU,'" }) }}'),"x-decorator":"FormItem",default:1,"x-component":"InputNumber","x-component-props":{min:1,precision:0,className:"auto-width"}},deleteExecutionOnStatus:{type:"array",title:'{{ t("Auto delete history when execution is on end status", { ns: "'.concat(O.CU,'" }) }}'),"x-decorator":"FormItem","x-component":"Select","x-component-props":{multiple:!0,optionRender:S.Qg,tagRender:S.lP},enum:C.$A.filter(function(e){return!!e.value})}}}},E={name:"workflow",type:"void",properties:{provider:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:A.A,resourceName:"workflows",request:{resource:"workflows",action:"list",params:{filter:{current:!0},sort:["-createdAt"],except:["config"]}}},"x-component":"CategoryTabs",properties:{main:{type:"void","x-component":"CardItem",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useResourceFilterActionProps","x-component-props":{icon:"FilterOutlined",nonfilterable:["id","description","categories"]},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},sync:{type:"void",title:'{{t("Sync", { ns: "'.concat(O.CU,'" })}}'),"x-decorator":"Tooltip","x-decorator-props":{title:'{{ t("Sync enabled status of all workflows from database", { ns: "'.concat(O.CU,'" }) }}')},"x-component":"Action","x-component-props":{icon:"SyncOutlined",useAction:"{{ useSyncAction }}"},"x-reactions":["{{useWorkflowSyncReaction}}"]},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{current:!0}},title:'{{t("Add new")}}',properties:{title:j.title,type:j.type,triggerPreset:j.triggerPreset,sync:j.sync,categories:j.categories,description:j.description,options:j.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"array","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{ t("Title") }}',properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},categories:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{ t("Category", { ns: "'.concat(O.CU,'" }) }}'),properties:{categories:{type:"array","x-component":"EnumerationField","x-component-props":{multiple:!0,fieldNames:{label:"title",value:"id",color:"color"}}}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{ t("Trigger type", { ns: "'.concat(O.CU,'" }) }}'),properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},sync:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{ t("Execute mode", { ns: "'.concat(O.CU,'" }) }}'),properties:{sync:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{ t("Enabled", { ns: "'.concat(O.CU,'" }) }}'),properties:{enabled:{type:"boolean","x-component":"WorkflowEnabledSwitch",default:!1}}},"stats.executed":{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{ t("Executed", { ns: "'.concat(O.CU,'" }) }}'),properties:{"stats.executed":{type:"number","x-decorator":"OpenDrawer","x-decorator-props":{component:function(e){var t=(0,s.useCollectionRecordData)();return c().createElement("a",P({"aria-label":"executed-".concat(t.title)},e))}},"x-component":"InputNumber","x-read-pretty":!0,properties:{drawer:w.M}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void","x-component":"WorkflowLink"},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{ t("Edit") }}',properties:{title:j.title,type:(n=P({},j.type),o=o={"x-disabled":!0},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(o)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}),n),sync:j.sync,categories:j.categories,description:j.description,options:j.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},revision:{type:"void",title:'{{t("Duplicate", { ns: "'.concat(O.CU,'" })}}'),"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:'{{t("Duplicate to new workflow", { ns: "'.concat(O.CU,'" })}}'),"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useRevisionAction }}"}},cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"}}}}}}}}}}}}}},k=r(5324),F=r(9603),T=r(512);function D(e){var t=e.data,r=t.label,n=t.color,o=t.options,i=(0,s.useCompile)();return c().createElement(a.Space,{direction:"vertical"},c().createElement(a.Tag,{color:n},i(r)),c().createElement(a.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"}},i(o.description)))}var I=r(7375),R=r(6799),U=r(166),V=r(6773);function M(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 N(e,t,r,n,o,i,c){try{var a=e[i](c),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(n,o)}function q(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function c(e){N(i,n,o,c,a,"next",e)}function a(e){N(i,n,o,c,a,"throw",e)}c(void 0)})}}function L(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 $(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function B(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],c=!0,a=!1;try{for(o=o.call(e);!(c=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);c=!0);}catch(e){a=!0,n=e}finally{try{c||null==o.return||o.return()}finally{if(a)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return M(e,t);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 M(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function W(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:l(0)}),a(c,"throw",{value:l(1)}),a(c,"return",{value:l(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function l(a){return function(l){var u=[a,l];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,n=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function z(){var e,t,r=(e=["\n .ant-tabs-nav-list > :first-child {\n border: none;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return z=function(){return r},r}function K(e){var t=(0,R.useDraggable)({id:e.id,data:e.data}),r=t.attributes,n=t.listeners,o=t.setNodeRef;return c().createElement("div",L({ref:o},n,r),c().createElement("div",null,e.children))}function _(e){var t=(0,R.useDroppable)({id:e.id,data:e.data}),r=t.isOver,n=t.setNodeRef;return c().createElement("div",{ref:n,style:r?{color:"green"}:void 0},e.children)}var G=(0,u.observer)(function(e){var t=e.item;return c().createElement(_,{id:t.id.toString(),data:t},c().createElement("div",null,c().createElement(K,{id:t.id.toString(),data:t},c().createElement(H,{item:t}))))},{displayName:"TabTitle"}),H=function(e){var t=e.item,r=(0,y.useTranslation)().t,n=(0,s.useCompile)();return c().createElement(a.Space,null,c().createElement(a.Badge,{color:t.color}),r(n(t.title)))},Q=(0,u.observer)(function(e){var t=B((0,i.useState)(null),2),r=t[0],n=t[1],o=(0,i.useContext)(Y).refresh,a=(0,s.useAPIClient)(),l=(0,R.useSensor)(R.MouseSensor,{activationConstraint:{distance:10}}),u=(0,R.useSensors)(l);return c().createElement(R.DndContext,{sensors:u,onDragEnd:function(e){return q(function(){var t,r;return W(this,function(i){switch(i.label){case 0:if(t=e.active,r=e.over,setTimeout(function(){n(null)}),!(r&&r.id!==t.id))return[3,2];return[4,a.resource("workflowCategories").move({sourceId:t.id,targetId:r.id})];case 1:i.sent(),o(),i.label=2;case 2:return[2]}})})()},onDragStart:function(e){var t;n(null==(t=e.active)?void 0:t.data.current)}},e.children,c().createElement(R.DragOverlay,null,r?c().createElement("span",{style:{whiteSpace:"nowrap"}},c().createElement(H,{item:r})):null))},{displayName:"DndProvider"}),Y=(0,i.createContext)({});function J(e){var t=e.values,r=e.onEdit,n=e.onRemove,o=(0,s.useCompile)(),l=(0,i.useCallback)(function(e){switch(e.key){case"edit":r(t);break;case"delete":n(t.id)}},[r,n,t]);return c().createElement(a.Dropdown,{menu:{items:[{key:"edit",label:(0,O.vV)("Edit category")},{key:"delete",label:(0,O.vV)("Delete category")}],onClick:l}},c().createElement(I.MenuOutlined,{role:"button","aria-label":o(t.title),style:{padding:8,margin:"-8px"}}))}function X(){var e,t=(0,s.useResourceActionContext)(),r=t.run,n=t.setState,o=t.defaultRequest,p=B((0,i.useState)({tab:"all"}),2),m=p[0],d=p[1],f=B((0,i.useState)(m.tab),2),y=f[0],b=f[1],v=(0,s.useCompile)(),g=(0,s.useAPIClient)(),x=(0,u.useFieldSchema)(),h=a.App.useApp().modal,w=(0,s.useRequest)({resource:"workflowCategories",action:"list",params:{paginate:!1,sort:["sort"]}}),C=w.data,A=w.refresh,S=B((0,i.useState)(!1),2),P=S[0],j=S[1],E=(0,i.useMemo)(function(){return(0,l.createForm)()},[]),k=(0,i.useCallback)(function(e){j(!0);var t=(0,V.cloneDeep)(e);E.setValues(t)},[E]),F=(0,i.useCallback)(function(){j(!1),E.reset()},[E]),T=(0,i.useCallback)(function(e){h.confirm({title:v("{{t('Delete category')}}"),content:v("{{t('Are you sure you want to delete it?')}}"),onOk:function(){return q(function(){return W(this,function(t){switch(t.label){case 0:return[4,g.resource("workflowCategories").destroy({filter:{id:e}})];case 1:return t.sent(),e===+m.tab&&d({tab:"all"}),A(),r(),[2]}})})()}})},[m.tab]),D=(0,i.useMemo)(function(){if(!(null==C?void 0:C.data))return[];var e=C.data.sort(function(e,t){return e.sort-t.sort}).concat().map(function(e){return $(L({},e),{schema:x.properties.main})});return e.find(function(e){return"all"===e.id})||e.unshift({title:'{{t("All", { ns: "'.concat(O.CU,'" })}}'),id:"all",sort:0,closable:!1,schema:x.properties.main}),e.map(function(e){return{label:"all"!==e.id?c().createElement("div",{"data-no-dnd":"true"},c().createElement(G,{item:e})):v(e.title),key:String(e.id),closable:e.closable,closeIcon:c().createElement(J,{values:e,onEdit:k,onRemove:T}),children:c().createElement(a.Card,{variant:"borderless",style:{borderRadius:"0 0.5em 0.5em 0.5em"}},c().createElement(u.RecursionField,{name:y,schema:e.schema,onlyRenderProperties:!0}))}})},[v,null==C?void 0:C.data,y,k,T,x.properties.main]),I=(0,i.useCallback)(function(e){if(d({tab:e}),b((0,U.uid)()),"all"!==e){var t,i={$and:[null==o||null==(t=o.params)?void 0:t.filter,{"categories.id":e}]};r({filter:i}),null==n||n({categories:[+e],params:[{filter:i}]})}else r(),null==n||n({categories:[],params:[]})},[null==o||null==(e=o.params)?void 0:e.filter,r,n]);return((0,i.useEffect)(function(){"all"!==m.tab&&I(m.tab)},[m.tab,I]),C)?c().createElement(Y.Provider,{value:{refresh:A}},c().createElement(Q,null,c().createElement(a.Tabs,{addIcon:c().createElement(s.SchemaComponent,{components:{AddCategory:er},schema:{type:"void",properties:{addCategories:{type:"void",title:'{{ t("Add category", { ns: "'.concat(O.CU,'" }) }}'),"x-component":"AddCategory","x-component-props":{type:"primary"}}}}}),onChange:I,defaultActiveKey:m.tab||"all",type:"editable-card",destroyInactiveTabPane:!0,tabBarStyle:{marginBottom:"0px"},className:(0,s.css)(z()),items:D})),c().createElement(s.ActionContextProvider,{value:{visible:P,setVisible:F,openSize:"small"}},c().createElement(s.SchemaComponent,{scope:{useFormProviderProps:ee,useCancelAction:s.useCancelAction,useEditSubmit:Z},schema:{name:(0,U.uid)(),type:"void","x-decorator":"FormV2","x-decorator-props":{form:E},title:'{{ t("Edit category", { ns: "'.concat(O.CU,'" }) }}'),"x-component":"Action.Modal","x-component-props":{delay:0},properties:{title:{type:"string",title:'{{t("Title")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useEditSubmit }}",style:{marginLeft:"8px"}}}}}}}}))):null}function Z(){var e=(0,u.useForm)(),t=(0,s.useActionContext)(),r=(0,s.useResourceActionContext)(),n=(0,i.useContext)(Y).refresh,o=(0,s.useAPIClient)();return{run:function(){return q(function(){var i;return W(this,function(c){switch(c.label){case 0:return[4,e.submit()];case 1:return c.sent(),[4,o.resource("workflowCategories").update({filterByTk:null==(i=e.values)?void 0:i.id,values:e.values})];case 2:return c.sent(),t.setVisible(!1),[4,e.reset()];case 3:return c.sent(),null==n||n(),null==r||r.refresh(),[2]}})})()}}}function ee(){return{form:(0,u.useForm)()}}function et(){var e=(0,u.useForm)(),t=(0,s.useActionContext)().setVisible,r=(0,i.useContext)(Y).refresh,n=(0,s.useAPIClient)();return{run:function(){return q(function(){var o;return W(this,function(i){switch(i.label){case 0:return[4,e.submit()];case 1:return i.sent(),o=(0,V.cloneDeep)(e.values),[4,n.resource("workflowCategories").create({values:o})];case 2:return i.sent(),t(!1),e.reset(),r(),[2]}})})()}}}function er(e){var t=B((0,i.useState)(!1),2),r=t[0],n=t[1],o=(0,y.useTranslation)().t,a=(0,i.useMemo)(function(){return(0,l.createForm)()},[]);return c().createElement(s.ActionContextProvider,{value:{visible:r,setVisible:n,openSize:"small"}},c().createElement("div",{onClick:function(){return n(!0)},title:o("Add category")},c().createElement(I.PlusOutlined,null)),c().createElement(s.SchemaComponent,{schema:{name:"modal",type:"void","x-decorator":"FormV2","x-decorator-props":{form:a},title:'{{ t("Add category") }}',"x-component":"Action.Modal","x-component-props":$(L({},e),{delay:0}),properties:{title:{type:"string",title:'{{t("Title")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useCreateSubmit }}",style:{marginLeft:"8px"}}}}}}},scope:{useCancelAction:s.useCancelAction,useCreateSubmit:et}}))}function en(e){var t=e.value,r=e.multiple,n=e.fieldNames,o=void 0===n?s.defaultFieldNames:n,i=(0,s.useCompile)();return(r?null!=t?t:[]:t?[t]:[]).map(function(e){return c().createElement(a.Tag,{key:e[o.value],color:e[o.color]},i(e[o.label]))})}var eo=r(2815);function ei(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}var ec=[{value:1e3,label:"Seconds"},{value:6e4,label:"Minutes"},{value:36e5,label:"Hours"},{value:864e5,label:"Days"}];function ea(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15552e6;return Math.min(Math.max(e,0),t)}function el(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6e4;return e&&null!=(t=null==(r=ec.findLast(function(t){return e%t.value==0}))?void 0:r.value)?t:n}var eu=(0,u.connect)(function(e){var t,r,n=ea(Number(null!=(r=e.value)?r:0)),o=function(e){if(Array.isArray(e))return e}(t=c().useState(function(){return el(n)}))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){c=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw r}}return o}}(t)||function(e){if(e){if("string"==typeof e)return ei(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ei(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=o[0],l=o[1];c().useEffect(function(){0!==n&&l(function(e){return el(n,e)})},[n]);var u=0===n?0:n/i,s=15552e6/i;return c().createElement(a.Space.Compact,null,c().createElement(a.InputNumber,{min:0,max:s,precision:0,value:u,onChange:function(t){var r;return null==(r=e.onChange)?void 0:r.call(e,ea(Number(t)||0,s)*i)},className:"auto-width"}),c().createElement(a.Select,{value:i,options:ec.map(function(e){var t,r;return t=function(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}({},e),r=r={label:(0,O.vV)(e.label)},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t}),onChange:function(t){var r,n,o=ea(Number(null!=(r=e.value)?r:0)),c=0===o?0:o/i;l(t),null==(n=e.onChange)||n.call(e,ea(c*t))},className:"auto-width"}))},(0,u.mapProps)(function(e){return e}),(0,u.mapReadPretty)(function(e){var t,r=Number(null!=(t=e.value)?t:0);if(0===r)return c().createElement(c().Fragment,null,(0,O.vV)("Unlimited"));var n=el(r),o=ec.find(function(e){return e.value===n});return c().createElement(c().Fragment,null,r/n," ",o?(0,O.vV)(o.label):"")}));function es(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 ep(e,t,r,n,o,i,c){try{var a=e[i](c),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(n,o)}function em(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function c(e){ep(i,n,o,c,a,"next",e)}function a(e){ep(i,n,o,c,a,"throw",e)}c(void 0)})}}function ed(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],c=!0,a=!1;try{for(o=o.call(e);!(c=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);c=!0);}catch(e){a=!0,n=e}finally{try{c||null==o.return||o.return()}finally{if(a)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return es(e,t);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 es(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ef(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:l(0)}),a(c,"throw",{value:l(1)}),a(c,"return",{value:l(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function l(a){return function(l){var u=[a,l];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,n=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function ey(e){var t=(0,u.useField)(),r=(0,s.useRecord)(),n=(0,s.usePlugin)(k.default);return(0,u.useFormEffects)(function(e){(0,l.onFieldChange)("type",function(e){var o=r.id||!e.value;if(e.value){var i=n.triggers.get(e.value);null!=i.sync?(o=!0,t.setValue(i.sync)):t.setInitialValue(!1)}t.setPattern(o?"disabled":"editable")})}),(0,i.useEffect)(function(){if(r.id){t.setPattern("disabled");var o,i=n.triggers.get(r.type);null!=i.sync?t.setValue(i.sync):t.setInitialValue(null!=(o=e.value)&&o)}},[r.id,t,n.triggers,r.type,e.value]),c().createElement(F.$i,e)}function eb(e){var t=(0,s.useApp)();e.visible=!!((0,s.usePlugin)("multi-app-share-collection")||"main"!==t.name)}function ev(){var e=a.App.useApp().message,t=(0,y.useTranslation)().t,r=(0,s.useResourceContext)().resource;return{run:function(){return em(function(){return ef(this,function(n){switch(n.label){case 0:return[4,r.sync()];case 1:return n.sent(),e.success(t("Operation succeeded")),[2]}})})()}}}function eg(){var e=a.App.useApp().message,t=(0,y.useTranslation)().t,r=(0,s.useResourceActionContext)().refresh,n=(0,s.useResourceContext)(),o=n.resource,i=n.targetKey,c=(0,s.useActionContext)().setVisible,l=(0,s.useRecord)()[i],p=(0,u.useForm)(),m=(0,u.useField)();return{run:function(){return em(function(){return ef(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,4,5]),[4,p.submit()];case 1:return n.sent(),m.data=m.data||{},m.data.loading=!0,[4,o.revision({filterByTk:l,values:p.values})];case 2:return n.sent(),e.success(t("Operation succeeded")),r(),c(!1),[3,5];case 3:return console.error(n.sent()),[3,5];case 4:return m.data&&(m.data.loading=!1),[7];case 5:return[2]}})})()}}}function ex(){var e=(0,s.usePlugin)(k.default),t=ed((0,i.useState)(null),2),r=t[0],n=t[1],o=(0,u.useForm)();(0,u.useFormEffects)(function(){(0,l.onFieldValueChange)("type",function(e){var t;n(null!=(t=e.value)?t:null),o.clearFormGraph("config.*")})});var a=r?e.triggers.get(r):null;return(null==a?void 0:a.presetFieldset)?c().createElement(s.SchemaComponent,{key:r,components:a.components,scope:a.scope,schema:{type:"void",properties:{config:{type:"object","x-decorator":"FormItem",title:'{{t("Trigger configuration", { ns: "'.concat(O.CU,'" })}}'),"x-component":"Fieldset",properties:a.presetFieldset}}}}):null}function eh(){var e=a.App.useApp().message,t=(0,y.useTranslation)().t,r=(0,s.useRecord)(),n=(0,s.useResourceContext)().resource,o=(0,s.useResourceActionContext)().refresh,l=ed((0,i.useState)(!1),2),u=l[0],p=l[1],m=(0,i.useCallback)(function(i){return em(function(){return ef(this,function(c){switch(c.label){case 0:if(!(null==r?void 0:r.id))return[2];p(!0),c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,n.update({filterByTk:r.id,values:{enabled:i}})];case 2:return c.sent(),setTimeout(function(){return null==o?void 0:o()},0),[3,5];case 3:return console.error(c.sent()),e.error(t("Operation failed")),[3,5];case 4:return p(!1),[7];case 5:return[2]}})})()},[e,r,o,n,t]);return c().createElement(a.Switch,{checked:!!(null==r?void 0:r.enabled),size:"small",disabled:u||!(null==r?void 0:r.id),loading:u,onClick:function(e,t){var r;return null==t||null==(r=t.stopPropagation)?void 0:r.call(t)},onChange:m})}function eO(){var e,t,r=(0,i.useContext)(s.SchemaComponentContext),n=(0,s.usePlugin)(k.default).useTriggersOptions;return c().createElement(s.SchemaComponentContext.Provider,{value:(e=function(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}({},r),t=t={designable:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e)},c().createElement(s.SchemaComponent,{schema:E,components:{CollectionProvider:s.CollectionProvider,WorkflowLink:g,ExecutionResourceProvider:f,ExecutionLink:p.d,OpenDrawer:h,SyncOptionSelect:ey,ExecutionStatusColumn:S.t_,Tooltip:a.Tooltip,CategoryTabs:X,EnumerationField:en,WorkflowEnabledSwitch:eh,TriggerPresetFieldset:ex,TimeoutInput:eu},scope:{useTriggersOptions:n,useWorkflowSyncReaction:eb,useSyncAction:ev,useResourceFilterActionProps:eo.A,useRefreshActionProps:T.t,useRevisionAction:eg,TriggerOptionRender:D,ExecutionStatusOptions:C.$A}}))}}}]);
|