@nocobase/plugin-workflow 1.7.19 → 1.8.0-alpha.10
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/256475f279fb46d1.js +10 -0
- package/dist/client/46ecd7ca1b9ab549.js +10 -0
- package/dist/client/77f05f24f6a5f421.js +10 -0
- package/dist/client/7af2da3defaae26f.js +10 -0
- package/dist/client/WorkflowTasks.d.ts +0 -7
- package/dist/client/index.js +1 -1
- package/dist/client/nodes/calculation.d.ts +0 -1
- package/dist/client/nodes/condition.d.ts +0 -1
- package/dist/client/schemas/executions.d.ts +0 -1
- package/dist/client/variable.d.ts +5 -2
- package/dist/externalVersion.js +10 -11
- 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.d.ts +1 -0
- package/dist/server/Plugin.js +27 -2
- package/dist/server/instructions/CalculationInstruction.d.ts +0 -10
- package/dist/server/instructions/CalculationInstruction.js +0 -15
- package/dist/server/instructions/ConditionInstruction.d.ts +0 -11
- package/dist/server/instructions/ConditionInstruction.js +0 -15
- package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.js +12 -3
- package/package.json +3 -4
- package/dist/client/c3b6a4e98b30c0ce.js +0 -10
- package/dist/client/cd148c8354d7084a.js +0 -10
- package/dist/client/f2ba2ac6e7edba30.js +0 -10
- package/dist/client/f2c77bbdba9010bb.js +0 -10
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
+
import { CollectionManager } from '@nocobase/client';
|
|
10
11
|
export type VariableOption = {
|
|
11
12
|
key?: string;
|
|
12
13
|
value?: string;
|
|
@@ -21,7 +22,9 @@ export type VariableDataType = 'boolean' | 'number' | 'string' | 'date' | {
|
|
|
21
22
|
multiple?: boolean;
|
|
22
23
|
entity?: boolean;
|
|
23
24
|
};
|
|
24
|
-
} | ((field: any
|
|
25
|
+
} | ((field: any, options: {
|
|
26
|
+
collectionManager?: CollectionManager;
|
|
27
|
+
}) => boolean);
|
|
25
28
|
export type UseVariableOptions = {
|
|
26
29
|
types?: VariableDataType[];
|
|
27
30
|
fieldNames?: {
|
|
@@ -70,7 +73,7 @@ export declare const BaseTypeSets: {
|
|
|
70
73
|
};
|
|
71
74
|
export declare function useWorkflowVariableOptions(options?: UseVariableOptions): any[];
|
|
72
75
|
export declare function getCollectionFieldOptions(options: any): VariableOption[];
|
|
73
|
-
export declare function
|
|
76
|
+
export declare function useGetDataSourceCollectionManager(dataSourceName?: any): CollectionManager;
|
|
74
77
|
export declare function WorkflowVariableInput({ variableOptions, ...props }: {
|
|
75
78
|
[x: string]: any;
|
|
76
79
|
variableOptions: any;
|
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.
|
|
15
|
-
"@nocobase/utils": "1.
|
|
14
|
+
"@nocobase/client": "1.8.0-alpha.10",
|
|
15
|
+
"@nocobase/utils": "1.8.0-alpha.10",
|
|
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,16 @@ 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.7.19",
|
|
24
23
|
"sequelize": "6.35.2",
|
|
25
|
-
"@nocobase/database": "1.
|
|
26
|
-
"@nocobase/server": "1.
|
|
27
|
-
"@nocobase/data-source-manager": "1.
|
|
28
|
-
"@nocobase/logger": "1.
|
|
29
|
-
"@nocobase/evaluators": "1.
|
|
24
|
+
"@nocobase/database": "1.8.0-alpha.10",
|
|
25
|
+
"@nocobase/server": "1.8.0-alpha.10",
|
|
26
|
+
"@nocobase/data-source-manager": "1.8.0-alpha.10",
|
|
27
|
+
"@nocobase/logger": "1.8.0-alpha.10",
|
|
28
|
+
"@nocobase/evaluators": "1.8.0-alpha.10",
|
|
30
29
|
"@formily/antd-v5": "1.2.3",
|
|
31
30
|
"@formily/reactive": "2.3.0",
|
|
32
|
-
"@nocobase/actions": "1.
|
|
31
|
+
"@nocobase/actions": "1.8.0-alpha.10",
|
|
33
32
|
"dayjs": "1.11.13",
|
|
34
|
-
"@nocobase/plugin-workflow-test": "1.
|
|
35
|
-
"@nocobase/test": "1.
|
|
33
|
+
"@nocobase/plugin-workflow-test": "1.8.0-alpha.10",
|
|
34
|
+
"@nocobase/test": "1.8.0-alpha.10"
|
|
36
35
|
};
|
|
@@ -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-06-25T04:45:35.225Z"}
|
|
@@ -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-06-25T04:45:34.909Z"}
|
|
@@ -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-06-25T04:45:34.751Z"}
|
package/dist/server/Plugin.d.ts
CHANGED
package/dist/server/Plugin.js
CHANGED
|
@@ -75,6 +75,20 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
75
75
|
loggerCache;
|
|
76
76
|
meter = null;
|
|
77
77
|
checker = null;
|
|
78
|
+
onQueueExecution = async (event) => {
|
|
79
|
+
const ExecutionRepo = this.db.getRepository("executions");
|
|
80
|
+
const execution = await ExecutionRepo.findOne({
|
|
81
|
+
filterByTk: event.executionId
|
|
82
|
+
});
|
|
83
|
+
if (!execution || execution.status !== import_constants.EXECUTION_STATUS.QUEUEING) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.getLogger(execution.workflowId).info(
|
|
87
|
+
`execution (${execution.id}) received from queue, adding to pending list`
|
|
88
|
+
);
|
|
89
|
+
this.pending.push([execution]);
|
|
90
|
+
this.dispatch();
|
|
91
|
+
};
|
|
78
92
|
onBeforeSave = async (instance, { transaction, cycling }) => {
|
|
79
93
|
if (cycling) {
|
|
80
94
|
return;
|
|
@@ -176,6 +190,7 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
176
190
|
this.ready = true;
|
|
177
191
|
};
|
|
178
192
|
onBeforeStop = async () => {
|
|
193
|
+
this.app.logger.info(`stopping workflow plugin before app (${this.app.name}) shutdown...`);
|
|
179
194
|
for (const workflow of this.enabledCache.values()) {
|
|
180
195
|
this.toggle(workflow, false, { silent: true });
|
|
181
196
|
}
|
|
@@ -289,6 +304,10 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
289
304
|
this.snowflake = new import_nodejs_snowflake.Snowflake({
|
|
290
305
|
custom_epoch: pluginRecord == null ? void 0 : pluginRecord.createdAt.getTime()
|
|
291
306
|
});
|
|
307
|
+
this.app.eventQueue.subscribe(`${this.name}.pendingExecution`, {
|
|
308
|
+
idle: () => !this.executing && !this.pending.length && !this.events.length,
|
|
309
|
+
process: this.onQueueExecution
|
|
310
|
+
});
|
|
292
311
|
}
|
|
293
312
|
/**
|
|
294
313
|
* @internal
|
|
@@ -545,8 +564,14 @@ class PluginWorkflowServer extends import_server.Plugin {
|
|
|
545
564
|
logger.info(`preparing execution for event`);
|
|
546
565
|
try {
|
|
547
566
|
const execution = await this.createExecution(...event);
|
|
548
|
-
if ((execution == null ? void 0 : execution.status) === import_constants.EXECUTION_STATUS.QUEUEING
|
|
549
|
-
this.pending.
|
|
567
|
+
if ((execution == null ? void 0 : execution.status) === import_constants.EXECUTION_STATUS.QUEUEING) {
|
|
568
|
+
if (!this.executing && !this.pending.length) {
|
|
569
|
+
logger.info(`local pending list is empty, adding execution (${execution.id}) to pending list`);
|
|
570
|
+
this.pending.push([execution]);
|
|
571
|
+
} else {
|
|
572
|
+
logger.info(`local pending list is not empty, sending execution (${execution.id}) to queue`);
|
|
573
|
+
this.app.eventQueue.publish(`${this.name}.pendingExecution`, { executionId: execution.id });
|
|
574
|
+
}
|
|
550
575
|
}
|
|
551
576
|
} catch (error) {
|
|
552
577
|
logger.error(`failed to create execution:`, { error });
|
|
@@ -21,15 +21,5 @@ export declare class CalculationInstruction extends Instruction {
|
|
|
21
21
|
result: any;
|
|
22
22
|
status: -2;
|
|
23
23
|
}>;
|
|
24
|
-
test({ engine, expression }: {
|
|
25
|
-
engine?: string;
|
|
26
|
-
expression?: string;
|
|
27
|
-
}): Promise<{
|
|
28
|
-
result: any;
|
|
29
|
-
status: 1;
|
|
30
|
-
} | {
|
|
31
|
-
result: any;
|
|
32
|
-
status: -2;
|
|
33
|
-
}>;
|
|
34
24
|
}
|
|
35
25
|
export default CalculationInstruction;
|
|
@@ -51,21 +51,6 @@ class CalculationInstruction extends import__.Instruction {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
async test({ engine = "math.js", expression = "" }) {
|
|
55
|
-
const evaluator = import_evaluators.evaluators.get(engine);
|
|
56
|
-
try {
|
|
57
|
-
const result = evaluator && expression ? evaluator(expression) : null;
|
|
58
|
-
return {
|
|
59
|
-
result,
|
|
60
|
-
status: import_constants.JOB_STATUS.RESOLVED
|
|
61
|
-
};
|
|
62
|
-
} catch (e) {
|
|
63
|
-
return {
|
|
64
|
-
result: e.toString(),
|
|
65
|
-
status: import_constants.JOB_STATUS.ERROR
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
54
|
}
|
|
70
55
|
var CalculationInstruction_default = CalculationInstruction;
|
|
71
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -29,16 +29,5 @@ export declare class ConditionInstruction extends Instruction {
|
|
|
29
29
|
result: boolean;
|
|
30
30
|
}>;
|
|
31
31
|
resume(node: FlowNodeModel, branchJob: JobModel, processor: Processor): Promise<any>;
|
|
32
|
-
test({ engine, calculation, expression }: {
|
|
33
|
-
engine: any;
|
|
34
|
-
calculation: any;
|
|
35
|
-
expression?: string;
|
|
36
|
-
}): Promise<{
|
|
37
|
-
result: any;
|
|
38
|
-
status: 1;
|
|
39
|
-
} | {
|
|
40
|
-
result: any;
|
|
41
|
-
status: -2;
|
|
42
|
-
}>;
|
|
43
32
|
}
|
|
44
33
|
export default ConditionInstruction;
|
|
@@ -84,21 +84,6 @@ class ConditionInstruction extends import__.Instruction {
|
|
|
84
84
|
}
|
|
85
85
|
return processor.exit(branchJob.status);
|
|
86
86
|
}
|
|
87
|
-
async test({ engine, calculation, expression = "" }) {
|
|
88
|
-
const evaluator = import_evaluators.evaluators.get(engine);
|
|
89
|
-
try {
|
|
90
|
-
const result = evaluator ? evaluator(expression) : (0, import_logicCalculate.logicCalculate)(calculation);
|
|
91
|
-
return {
|
|
92
|
-
result,
|
|
93
|
-
status: import_constants.JOB_STATUS.RESOLVED
|
|
94
|
-
};
|
|
95
|
-
} catch (e) {
|
|
96
|
-
return {
|
|
97
|
-
result: e.toString(),
|
|
98
|
-
status: import_constants.JOB_STATUS.ERROR
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
87
|
}
|
|
103
88
|
var ConditionInstruction_default = ConditionInstruction;
|
|
104
89
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -44,6 +44,7 @@ var import_cron_parser = __toESM(require("cron-parser"));
|
|
|
44
44
|
var import_utils = require("./utils");
|
|
45
45
|
var import_data_source_manager = require("@nocobase/data-source-manager");
|
|
46
46
|
var import_lodash = require("lodash");
|
|
47
|
+
var import_utils2 = require("../../utils");
|
|
47
48
|
function getOnTimestampWithOffset({ field, offset = 0, unit = 1e3 }, now) {
|
|
48
49
|
if (!field) {
|
|
49
50
|
return null;
|
|
@@ -317,16 +318,24 @@ class DateFieldScheduleTrigger {
|
|
|
317
318
|
});
|
|
318
319
|
const eventKey = `${workflow.id}:${recordPk}@${nextTime}`;
|
|
319
320
|
this.cache.delete(eventKey);
|
|
320
|
-
|
|
321
|
+
const json = (0, import_utils2.toJSON)(data);
|
|
322
|
+
const args = [
|
|
321
323
|
workflow,
|
|
322
324
|
{
|
|
323
|
-
data:
|
|
325
|
+
data: json,
|
|
324
326
|
date: new Date(nextTime)
|
|
325
327
|
},
|
|
326
328
|
{
|
|
327
329
|
eventKey
|
|
328
330
|
}
|
|
329
|
-
|
|
331
|
+
];
|
|
332
|
+
if (transaction) {
|
|
333
|
+
transaction.afterCommit(() => {
|
|
334
|
+
this.workflow.trigger(...args);
|
|
335
|
+
});
|
|
336
|
+
} else {
|
|
337
|
+
this.workflow.trigger(...args);
|
|
338
|
+
}
|
|
330
339
|
if (!workflow.config.repeat || workflow.config.limit && workflow.stats.executed >= workflow.config.limit - 1) {
|
|
331
340
|
return;
|
|
332
341
|
}
|
package/package.json
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
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.
|
|
7
|
+
"version": "1.8.0-alpha.10",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/workflow",
|
|
11
11
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nocobase/plugin-workflow-test": "1.
|
|
13
|
+
"@nocobase/plugin-workflow-test": "1.8.0-alpha.10"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@ant-design/icons": "5.x",
|
|
@@ -40,14 +40,13 @@
|
|
|
40
40
|
"@nocobase/logger": "1.x",
|
|
41
41
|
"@nocobase/plugin-data-source-main": "1.x",
|
|
42
42
|
"@nocobase/plugin-error-handler": "1.x",
|
|
43
|
-
"@nocobase/plugin-mobile": "1.x",
|
|
44
43
|
"@nocobase/plugin-users": "1.x",
|
|
45
44
|
"@nocobase/resourcer": "1.x",
|
|
46
45
|
"@nocobase/server": "1.x",
|
|
47
46
|
"@nocobase/test": "1.x",
|
|
48
47
|
"@nocobase/utils": "1.x"
|
|
49
48
|
},
|
|
50
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "31b2895b847f6998492e20bb923c2791e896951d",
|
|
51
50
|
"keywords": [
|
|
52
51
|
"Workflow"
|
|
53
52
|
]
|
|
@@ -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([["999"],{458:function(e,t,r){r.d(t,{g:function(){return g}});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(2708),d=r(573),m=r(8378),f=r(336),p=r(5071),y=r(8019);function v(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 E(){var e=b(["\n margin-top: 0 !important;\n "]);return E=function(){return e},e}function h(){var e=b(["\n margin-bottom: 1em;\n "]);return h=function(){return e},e}function w(){var e=b(["\n margin-top: 0 !important;\n "]);return w=function(){return e},e}function g(e){var t,r=e.entry,o=(0,m.Z)().styles,l=(0,y.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 v(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 v(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],g=i[1];return a().createElement("div",{className:"workflow-canvas-wrapper"},a().createElement(c,{FallbackComponent:s.ErrorFallback,onError:console.error},a().createElement(p.E1,null,a().createElement("div",{className:"workflow-canvas",style:{zoom:b/100}},a().createElement("div",{className:(0,s.cx)(o.branchBlockClass,(0,s.css)(E()))},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)(h())}):null,a().createElement(f.Gk,null),a().createElement("div",{className:(0,s.cx)(o.branchBlockClass,(0,s.css)(w()))},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:g})))}},5625:function(e,t,r){r.r(t),r.d(t,{ExecutionPage:function(){return N}});var n=r(3772),o=r(8156),a=r.n(o),l=r(6128),i=r(2721),c=r(7584),s=r(482),u=r(3238),d=r(2976),m=r(458),f=r(6594),p=r(9144),y=r(8018),v=r(573),b=r(8378),E=r(7893),h=r(467);function w(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 g(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k(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 x(e,t){return 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),!t||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,t)||S(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 O(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||S(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){if(e){if("string"==typeof e)return w(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 w(e,t)}}function j(e){var t,r,o=(0,y.G2)().viewJob,l=(0,n.useRequest)({resource:"jobs",action:"get",params:{filterByTk:o.id}}),c=l.data;if(l.loading)return a().createElement(i.Spin,null);var s=(0,h.get)(c,"data.result");return a().createElement(n.Input.JSON,(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){g(e,t,r[t])})}return e}({},e),r=r={value:s,disabled:!0},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t))}function C(){var e=(0,n.usePlugin)(d.default).instructions,t=(0,n.useCompile)(),r=(0,y.G2)(),o=r.viewJob,l=r.setViewJob,c=(0,b.Z)().styles,s=(null!=o?o:{}).node,u=void 0===s?{}:s,m=e.get(u.type);return a().createElement(n.ActionContextProvider,{value:{visible:!!o,setVisible:l}},a().createElement(n.SchemaComponent,{components:{JobResult:j},schema:{type:"void",properties:g({},"".concat(null==o?void 0:o.id,"-").concat(null==o?void 0:o.updatedAt,"-modal"),{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:o},"x-component":"Action.Modal",title:a().createElement("div",{className:c.nodeTitleClass},a().createElement(i.Tag,null,t(null==m?void 0:m.title)),a().createElement("strong",null,u.title),a().createElement("span",{className:"workflow-node-id"},"#",u.id)),properties:{status:{type:"number",title:'{{t("Status", { ns: "'.concat(v.A7,'" })}}'),"x-decorator":"FormItem","x-component":"Select",enum:p.Vh,"x-read-pretty":!0},updatedAt:{type:"string",title:'{{t("Executed at", { ns: "'.concat(v.A7,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},result:{type:"object",title:'{{t("Node result", { ns: "'.concat(v.A7,'" })}}'),"x-decorator":"FormItem","x-component":"JobResult","x-component-props":{className:c.nodeJobResultClass,autoSize:{minRows:4,maxRows:32}}}}})}}))}function A(e){var t=(0,y.G2)().execution,r=(0,n.useAPIClient)(),u=(0,l.useNavigate)(),d=(0,b.Z)().styles,m=x((0,o.useState)([]),2),v=m[0],h=m[1],w=x((0,o.useState)([]),2),g=w[0],k=w[1];(0,o.useEffect)(function(){t&&r.resource("executions").list({filter:{key:t.key,id:{$lt:t.id}},sort:"-createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(function(e){h(e.data.data)}).catch(function(){})},[t.id]),(0,o.useEffect)(function(){t&&r.resource("executions").list({filter:{key:t.key,id:{$gt:t.id}},sort:"createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(function(e){k(e.data.data.reverse())}).catch(function(){})},[t.id]);var S=(0,o.useCallback)(function(e){var r=e.key;r!=t.id&&u((0,E.s_)(r))},[t.id]);return t?a().createElement(i.Dropdown,{menu:{onClick:S,defaultSelectedKeys:["".concat(t.id)],className:(0,n.cx)(d.dropdownClass,d.executionsDropdownRowClass),items:O(g).concat([t],O(v)).map(function(e){return{key:e.id,label:a().createElement(a().Fragment,null,a().createElement("span",{className:"id"},"#".concat(e.id)),a().createElement("time",null,(0,c.str2moment)(e.createdAt).format("YYYY-MM-DD HH:mm:ss"))),icon:a().createElement("span",null,a().createElement(f.Y,{statusMap:p.uy,status:e.status}))}})}},a().createElement(i.Space,null,a().createElement("strong",null,"#".concat(t.id)),a().createElement(s.DownOutlined,null))):null}function P(){var e,t=(0,u.useTranslation)().t,r=(0,n.useCompile)(),d=(0,n.useResourceActionContext)(),f=d.data,b=d.loading,h=d.refresh,w=(0,n.useDocumentTitle)().setTitle,g=x((0,o.useState)(null),2),O=g[0],S=g[1],j=(0,n.useApp)(),P=(0,n.useAPIClient)();(0,o.useEffect)(function(){var e,t=(null!=(e=null==f?void 0:f.data)?e:{}).workflow;null==w||w("".concat((null==t?void 0:t.title)?"".concat(t.title," - "):"").concat((0,v.KQ)("Execution history")))},[null==f?void 0:f.data,w]);var N=(0,o.useCallback)(function(){i.Modal.confirm({title:(0,v.KQ)("Cancel the execution"),icon:a().createElement(s.ExclamationCircleFilled,null),content:(0,v.KQ)("Are you sure you want to cancel the execution?"),onOk:function(){P.resource("executions").cancel({filterByTk:null==f?void 0:f.data.id}).then(function(){i.message.success(t("Operation succeeded")),h()}).catch(function(e){console.error(e.data.error)})}})},[null==f?void 0:f.data]);if(!(null==f?void 0:f.data))return b?a().createElement(i.Spin,null):a().createElement(i.Result,{status:"404",title:"Not found"});var I=null!=(e=null==f?void 0:f.data)?e:{},D=I.jobs,T=I.workflow,R=void 0===T?{}:T,B=R.nodes,K=void 0===B?[]:B,M=(R.revisions,k(I.workflow,["nodes","revisions"])),Y=k(I,["jobs","workflow"]);(0,E.Yc)(K),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=new Map;e.forEach(function(e){e.jobs=[],r.set(e.id,e)}),t.forEach(function(e){var t=r.get(e.nodeId);t.jobs.push(e),e.node={id:t.id,key:t.key,title:t.title,type:t.type}}),e.forEach(function(e){e.jobs=e.jobs.sort(function(e,t){return e.id-t.id})})}(K,void 0===D?[]:D);var F=K.find(function(e){return!e.upstream}),J=p.uy[Y.status];return a().createElement(y.iT.Provider,{value:{workflow:M.type?M:null,nodes:K,execution:Y,viewJob:O,setViewJob:S}},a().createElement("div",{className:"workflow-toolbar"},a().createElement("header",null,a().createElement(i.Breadcrumb,{items:[{title:a().createElement(l.Link,{to:j.pluginSettingsManager.getRoutePath("workflow")},(0,v.KQ)("Workflow"))},{title:a().createElement(i.Tooltip,{title:"Key: ".concat(M.key)},a().createElement(l.Link,{to:(0,E.SI)(M.id)},M.title))},{title:a().createElement(A,null)}]})),a().createElement("aside",null,a().createElement(i.Tag,{color:J.color},r(J.label)),Y.status?null:a().createElement(i.Tooltip,{title:(0,v.KQ)("Cancel the execution")},a().createElement(i.Button,{type:"link",danger:!0,onClick:N,shape:"circle",size:"small",icon:a().createElement(s.StopOutlined,null)})),a().createElement("time",null,(0,c.str2moment)(Y.updatedAt).format("YYYY-MM-DD HH:mm:ss")))),a().createElement(m.g,{entry:F}),a().createElement(C,null))}var N=function(){var e,t,r,o=(0,l.useParams)(),i=(0,b.Z)().styles;return a().createElement("div",{className:(0,n.cx)(i.workflowPageClass)},a().createElement(n.SchemaComponent,{schema:{type:"void",properties:(e={},t="execution_".concat(o.id),r={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:o,appends:["jobs","workflow","workflow.nodes","workflow.versionStats","workflow.stats"],except:["jobs.result","workflow.options"]}}},"x-component":"ExecutionCanvas"},t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e)},components:{ExecutionCanvas:P}}))}}}]);
|
|
@@ -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([["383"],{8958:function(e,t,n){n.d(t,{a:function(){return a}});var o=n(8156),r=n.n(o),c=n(3238),i=n(6128),l=n(3772),u=n(7893),a=function(){var e=(0,c.useTranslation)().t,t=(0,l.useRecord)().id,n=(0,l.useActionContext)().setVisible;return r().createElement(i.Link,{to:(0,u.s_)(t),onClick:function(){return n(!1)}},e("View"))}},1732:function(e,t,n){n.d(t,{P:function(){return b},r:function(){return v}});var o=n(8156),r=n.n(o),c=n(2721),i=n(482),l=n(3238),u=n(3772),a=n(9144),s=n(573);function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}function d(){var e,t,n=(e=["\n display: flex;\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return d=function(){return n},n}function m(e){var t,n=(0,u.useCompile)()(e.label),o=(null!=(t=a.uy[e.value])?t:{}).color;return r().createElement(c.Tag,{color:o,closable:e.closable,onClose:e.onClose},n)}function y(e){var t=(0,u.useCompile)();return r().createElement(r().Fragment,null,r().createElement(m,e),e.description?r().createElement("span",null,t(e.description)):null)}function b(e){var t,n,o=p({},function(e){if(null==e)throw TypeError("Cannot destructure "+e);return e}(e)),i=o.multiple?"multiple":null;return r().createElement(c.Select,(t=f({role:"button","data-testid":"select-".concat(i||"single")},o),n=n={mode:i,optionLabelProp:"label",tagRender:m},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t),a.C6.filter(function(e){return!!e.value&&e.value!==a.r9.ABORTED}).map(function(e){return r().createElement(c.Select.Option,f({key:e.value},e),r().createElement(y,e))}))}function v(e){var t=(0,l.useTranslation)().t,n=(0,u.useResourceActionContext)().refresh,a=(0,u.useResourceContext)().resource,p=(0,u.useRecord)(),f=(0,o.useCallback)(function(){c.Modal.confirm({title:(0,s.KQ)("Cancel the execution"),icon:r().createElement(i.ExclamationCircleFilled,null),content:(0,s.KQ)("Are you sure you want to cancel the execution?"),onOk:function(){a.cancel({filterByTk:p.id}).then(function(){c.message.success(t("Operation succeeded")),n()}).catch(function(e){console.error(e.data.error)})}})},[p]);return r().createElement("div",{className:(0,u.css)(d())},e.children,p.status?null:r().createElement(c.Tooltip,{title:(0,s.KQ)("Cancel the execution")},r().createElement(c.Button,{type:"link",danger:!0,onClick:f,shape:"circle",size:"small",icon:r().createElement(i.StopOutlined,null)})))}},2659:function(e,t,n){n.d(t,{V:function(){return b}});var o,r=n(8156),c=n.n(r),i=n(6128),l=n(3238),u=n(2721),a=n(3772),s=n(1768),p=n(9144),f=n(573),d=n(7893);function m(e,t,n,o,r,c,i){try{var l=e[c](i),u=l.value}catch(e){n(e);return}l.done?t(u):Promise.resolve(u).then(o,r)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var b={type:"void",name:"executionHistoryDrawer",title:'{{t("Execution history", { ns: "'.concat(f.A7,'" })}}'),"x-component":"Action.Drawer",properties:{content:{type:"void","x-decorator":"ExecutionResourceProvider","x-decorator-props":{collection:s.Z,resourceName:"executions",request:{resource:"executions",action:"list",params:{appends:["workflow.id","workflow.title"],pageSize:20,sort:["-createdAt"],except:["context","output"],filter:{}}}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},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?')}}"}}},clear:{type:"void",title:'{{t("Clear")}}',"x-component":"Action","x-component-props":{useAction:function(){var e=(0,l.useTranslation)().t,t=(0,a.useResourceActionContext)(),n=t.refresh,o=t.defaultRequest,r=(0,a.useResourceContext)().resource,c=(0,a.useActionContext)().setVisible;return{run:function(){var t;return(t=function(){var t;return function(e,t){var n,o,r,c,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return c={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&u[0]?o.return:u[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;switch(o=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,o=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){i.label=u[1];break}if(6===u[0]&&i.label<r[1]){i.label=r[1],r=u;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(u);break}r[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],o=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(i){switch(i.label){case 0:return[4,r.destroy({filter:null==(t=o.params)?void 0:t.filter})];case 1:return i.sent(),u.message.success(e("Operation succeeded")),n(),c(!1),[2]}})},function(){var e=this,n=arguments;return new Promise(function(o,r){var c=t.apply(e,n);function i(e){m(c,o,r,i,l,"next",e)}function l(e){m(c,o,r,i,l,"throw",e)}i(void 0)})})()}}},confirm:{title:'{{t("Clear all executions", { ns: "'.concat(f.A7,'" })}}'),content:'{{t("Clear executions will not reset executed count, and started executions will not be deleted, are you sure you want to delete them all?", { ns: "'.concat(f.A7,'" })}}')}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},createdAt:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{createdAt:{type:"string","x-component":"CollectionField","x-component-props":{showTime:!0},"x-read-pretty":!0}}},workflowId:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Version", { ns: "'.concat(f.A7,'" })}}'),properties:{workflowId:(y(o={type:"number"},"x-component",function(e){var t=e.value,n=(0,a.useActionContext)().setVisible;return c().createElement(i.Link,{to:(0,d.SI)(t),onClick:function(){return n(!1)}},"#".concat(t))}),y(o,"x-read-pretty",!0),o)}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Status", { ns: "'.concat(f.A7,'" })}}'),properties:{status:{type:"number","x-decorator":"ExecutionStatusColumn","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{link:{type:"void","x-component":"ExecutionLink"},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 }}"},"x-reactions":[{dependencies:["..status"],fulfill:{state:{visible:"{{ $deps[0] !== ".concat(p.r9.STARTED," }}")}}}]}}}}}}}}}}}},8327:function(e,t,n){n.d(t,{X:function(){return c}});var o=n(3772);function r(e,t,n,o,r,c,i){try{var l=e[c](i),u=l.value}catch(e){n(e);return}l.done?t(u):Promise.resolve(u).then(o,r)}function c(){var e=(0,o.useResourceActionContext)();return{onClick:function(){var t;return(t=function(){var t;return function(e,t){var n,o,r,c,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return c={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&u[0]?o.return:u[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;switch(o=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,o=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){i.label=u[1];break}if(6===u[0]&&i.label<r[1]){i.label=r[1],r=u;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(u);break}r[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],o=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(n){return null==e||null==(t=e.refresh)||t.call(e),[2]})},function(){var e=this,n=arguments;return new Promise(function(o,c){var i=t.apply(e,n);function l(e){r(i,o,c,l,u,"next",e)}function u(e){r(i,o,c,l,u,"throw",e)}l(void 0)})})()}}}}}]);
|
|
@@ -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([["638"],{679:function(e,t,o){o.r(t),o.d(t,{WorkflowPane:function(){return es}});var r=o(8156),n=o.n(r),i=o(2721),c=o(8563),a=o(3505),l=o(3772),s=o(8958);function u(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){var r;r=o[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function p(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);o.push.apply(o,r)}return o})(Object(t)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}),e}var m=function(e){var t,o=e.request,r=(e.filter,function(e,t){if(null==e)return{};var o,r,n=function(e,t){if(null==e)return{};var o,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)o=i[r],!(t.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(e,["request","filter"])),i=(0,l.useRecord)(),c=p(u({},r),{request:p(u({},o),{params:p(u({},null==o?void 0:o.params),{filter:p(u({},null==o||null==(t=o.params)?void 0:t.filter),{key:i.key})})})});return n().createElement(l.ResourceActionProvider,c)},d=o(3238),f=o(6128),y=o(7893),b=function(){var e=(0,d.useTranslation)().t,t=(0,l.useRecord)().id,o=(0,l.useActionContext)().setVisible,r=(0,l.useGetAriaLabelOfAction)("Configure").getAriaLabel;return n().createElement(f.Link,{"aria-label":r(),to:(0,y.SI)(t),onClick:function(){return o(!1)}},e("Configure"))};function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=Array(t);o<t;o++)r[o]=e[o];return r}function x(e){var t,o,i,c=e.component,s=e.children,u=function(e,t){if(null==e)return{};var o,r,n=function(e,t){if(null==e)return{};var o,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)o=i[r],!(t.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(e,["component","children"]),p=(t=(0,r.useState)(!1),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var o,r,n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i=[],c=!0,a=!1;try{for(n=n.call(e);!(c=(o=n.next()).done)&&(i.push(o.value),i.length!==t);c=!0);}catch(e){a=!0,r=e}finally{try{c||null==n.return||n.return()}finally{if(a)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return v(e,2);var o=Object.prototype.toString.call(e).slice(8,-1);if("Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o)return Array.from(o);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return v(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.")}()),m=p[0],d=p[1],f=(0,a.useFieldSchema)();return n().createElement(l.ActionContextProvider,{value:{visible:m,setVisible:d,fieldSchema:f}},n().createElement(void 0===c?"div":c,(o=function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){var r;r=o[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},u),i=i={onClick:function(){d(!0)}},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):(function(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);o.push.apply(o,r)}return o})(Object(i)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))}),o),s),n().createElement(l.SchemaComponent,{schema:f,onlyRenderProperties:!0}))}var g=o(573),h=o(2659),O=o(67),A={title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-decorator":"FormItem",title:'{{t("Trigger type", { ns: "'.concat(g.A7,'" })}}'),"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(g.A7,'" }) }}'),description:'{{ t("Execute workflow asynchronously or synchronously based on trigger type, and could not be changed after created.", { ns: "'.concat(g.A7,'" }) }}'),"x-decorator":"FormItem","x-component":"SyncOptionSelect","x-component-props":{options:[{label:'{{ t("Asynchronously", { ns: "'.concat(g.A7,'" }) }}'),value:!1,tooltip:'{{ t("Will be executed in the background as a queued task.", { ns: "'.concat(g.A7,'" }) }}')},{label:'{{ t("Synchronously", { ns: "'.concat(g.A7,'" }) }}'),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(g.A7,'" }) }}')}]}},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},categories:{type:"array",title:'{{ t("Category", { ns: "'.concat(g.A7,'" }) }}'),"x-decorator":"FormItem","x-component":"CollectionField","x-collection-field":"workflows.categories"},options:{type:"object","x-component":"fieldset",properties:{deleteExecutionOnStatus:{type:"array",title:'{{ t("Auto delete history when execution is on end status", { ns: "'.concat(g.A7,'" }) }}'),"x-decorator":"FormItem","x-component":"ExecutionStatusSelect","x-component-props":{multiple:!0}},stackLimit:{type:"number",title:'{{ t("Maximum number of cycling triggers", { ns: "'.concat(g.A7,'" }) }}'),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(g.A7,'" }) }}'),"x-decorator":"FormItem",default:1,"x-component":"InputNumber","x-component-props":{min:1,precision:0,className:"auto-width"}}}}},w={name:"workflow",type:"void",properties:{provider:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:O.Z,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":"useWorkflowFilterActionProps","x-component-props":{icon:"FilterOutlined",nonfilterable:["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(g.A7,'" })}}'),"x-decorator":"Tooltip","x-decorator-props":{title:'{{ t("Sync enabled status of all workflows from database", { ns: "'.concat(g.A7,'" }) }}')},"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:A.title,type:A.type,sync:A.sync,categories:A.categories,description:A.description,options:A.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(g.A7,'" }) }}'),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(g.A7,'" }) }}'),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(g.A7,'" }) }}'),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("Status", { ns: "'.concat(g.A7,'" }) }}'),properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,default:!1}}},"stats.executed":{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{ t("Executed", { ns: "'.concat(g.A7,'" }) }}'),properties:{"stats.executed":{type:"number","x-decorator":"OpenDrawer","x-decorator-props":{component:function(e){var t=(0,l.useCollectionRecordData)();return n().createElement("a",function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){var r;r=o[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({"aria-label":"executed-".concat(t.title)},e))}},"x-component":"InputNumber","x-read-pretty":!0,properties:{drawer:h.V}}}},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:A.title,enabled:A.enabled,sync:A.sync,categories:A.categories,description:A.description,options:A.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(g.A7,'" })}}'),"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:'{{t("Duplicate to new workflow", { ns: "'.concat(g.A7,'" })}}'),"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 }}"}}}}}}}}}}}}}},C=o(1732),S=o(2976),P=o(4987),E=o(8327);function j(e){var t=e.data,o=t.label,r=t.color,c=t.options,a=(0,l.useCompile)();return n().createElement(i.Space,{direction:"vertical"},n().createElement(i.Tag,{color:r},a(o)),n().createElement(i.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"}},a(c.description)))}var k=o(482),F=o(2948),D=o(8875),T=o(467);function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=Array(t);o<t;o++)r[o]=e[o];return r}function R(e,t,o,r,n,i,c){try{var a=e[i](c),l=a.value}catch(e){o(e);return}a.done?t(l):Promise.resolve(l).then(r,n)}function V(e){return function(){var t=this,o=arguments;return new Promise(function(r,n){var i=e.apply(t,o);function c(e){R(i,r,n,c,a,"next",e)}function a(e){R(i,r,n,c,a,"throw",e)}c(void 0)})}}function M(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){var r;r=o[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function q(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);o.push.apply(o,r)}return o})(Object(t)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}),e}function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o,r,n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i=[],c=!0,a=!1;try{for(n=n.call(e);!(c=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);c=!0);}catch(e){a=!0,r=e}finally{try{c||null==n.return||n.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return I(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if("Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o)return Array.from(o);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return I(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 N(e,t){var o,r,n,i,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(o)throw TypeError("Generator is already executing.");for(;c;)try{if(o=1,r&&(n=2&l[0]?r.return:l[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,l[1])).done)return n;switch(r=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,r=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(n=(n=c.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){c.label=l[1];break}if(6===l[0]&&c.label<n[1]){c.label=n[1],n=l;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(l);break}n[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],r=0}finally{o=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function W(){var e,t,o=(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 W=function(){return o},o}function B(e){var t=(0,F.useDraggable)({id:e.id,data:e.data}),o=t.attributes,r=t.listeners,i=t.setNodeRef;return n().createElement("div",M({ref:i},r,o),n().createElement("div",null,e.children))}function _(e){var t=(0,F.useDroppable)({id:e.id,data:e.data}),o=t.isOver,r=t.setNodeRef;return n().createElement("div",{ref:r,style:o?{color:"green"}:void 0},e.children)}var z=(0,a.observer)(function(e){var t=e.item;return n().createElement(_,{id:t.id.toString(),data:t},n().createElement("div",null,n().createElement(B,{id:t.id.toString(),data:t},n().createElement(K,{item:t}))))},{displayName:"TabTitle"}),K=function(e){var t=e.item,o=(0,d.useTranslation)().t,r=(0,l.useCompile)();return n().createElement(i.Space,null,n().createElement(i.Badge,{color:t.color}),o(r(t.title)))},$=(0,a.observer)(function(e){var t,o=L((0,r.useState)(null),2),i=o[0],c=o[1],a=(0,r.useContext)(G).refresh,s=(0,l.useAPIClient)(),u=(t=V(function(e){var t,o;return N(this,function(r){switch(r.label){case 0:if(t=e.active,o=e.over,setTimeout(function(){c(null)}),!(o&&o.id!==t.id))return[3,2];return[4,s.resource("workflowCategories").move({sourceId:t.id,targetId:o.id})];case 1:r.sent(),a(),r.label=2;case 2:return[2]}})}),function(e){return t.apply(this,arguments)}),p=(0,F.useSensor)(F.MouseSensor,{activationConstraint:{distance:10}}),m=(0,F.useSensors)(p);return n().createElement(F.DndContext,{sensors:m,onDragEnd:u,onDragStart:function(e){var t;c(null==(t=e.active)?void 0:t.data.current)}},e.children,n().createElement(F.DragOverlay,null,i?n().createElement("span",{style:{whiteSpace:"nowrap"}},n().createElement(K,{item:i})):null))},{displayName:"DndProvider"}),G=(0,r.createContext)({});function U(e){var t=e.values,o=e.onEdit,c=e.onRemove,a=(0,l.useCompile)(),s=(0,r.useCallback)(function(e){switch(e.key){case"edit":o(t);break;case"delete":c(t.id)}},[o,c,t]);return n().createElement(i.Dropdown,{menu:{items:[{key:"edit",label:(0,g.KQ)("Edit category")},{key:"delete",label:(0,g.KQ)("Delete category")}],onClick:s}},n().createElement(k.MenuOutlined,{role:"button","aria-label":a(t.title),style:{padding:8,margin:"-8px"}}))}function Q(){var e,t=(0,l.useResourceActionContext)(),o=t.run,s=t.setState,u=t.defaultRequest,p=L((0,r.useState)({tab:"all"}),2),m=p[0],d=p[1],f=L((0,r.useState)(m.tab),2),y=f[0],b=f[1],v=(0,l.useCompile)(),x=(0,l.useAPIClient)(),h=(0,a.useFieldSchema)(),O=i.App.useApp().modal,A=(0,l.useRequest)({resource:"workflowCategories",action:"list",params:{paginate:!1,sort:["sort"]}}),w=A.data,C=A.refresh,S=L((0,r.useState)(!1),2),P=S[0],E=S[1],j=(0,r.useMemo)(function(){return(0,c.createForm)()},[]),k=(0,r.useCallback)(function(e){E(!0);var t=(0,T.cloneDeep)(e);j.setValues(t)},[j]),F=(0,r.useCallback)(function(){E(!1),j.reset()},[j]),I=(0,r.useCallback)(function(e){O.confirm({title:v("{{t('Delete category')}}"),content:v("{{t('Are you sure you want to delete it?')}}"),onOk:V(function(){return N(this,function(t){switch(t.label){case 0:return[4,x.resource("workflowCategories").destroy({filter:{id:e}})];case 1:return t.sent(),e===+m.tab&&d({tab:"all"}),C(),o(),[2]}})})})},[m.tab]),R=(0,r.useMemo)(function(){if(!(null==w?void 0:w.data))return[];var e=w.data.sort(function(e,t){return e.sort-t.sort}).concat().map(function(e){return q(M({},e),{schema:h.properties.main})});return e.find(function(e){return"all"===e.id})||e.unshift({title:'{{t("All", { ns: "'.concat(g.A7,'" })}}'),id:"all",sort:0,closable:!1,schema:h.properties.main}),e.map(function(e){return{label:"all"!==e.id?n().createElement("div",{"data-no-dnd":"true"},n().createElement(z,{item:e})):v(e.title),key:String(e.id),closable:e.closable,closeIcon:n().createElement(U,{values:e,onEdit:k,onRemove:I}),children:n().createElement(i.Card,{variant:"borderless",style:{borderRadius:"0 0.5em 0.5em 0.5em"}},n().createElement(a.RecursionField,{name:y,schema:e.schema,onlyRenderProperties:!0}))}})},[null==w?void 0:w.data,y]),B=(0,r.useCallback)(function(e){if(d({tab:e}),b((0,D.uid)()),"all"!==e){var t,r={$and:[null==u||null==(t=u.params)?void 0:t.filter,{"categories.id":e}]};o({filter:r}),null==s||s({categories:[+e],params:[{filter:r}]})}else o(),null==s||s({categories:[],params:[]})},[null==u||null==(e=u.params)?void 0:e.filter,o,s]);return((0,r.useEffect)(function(){"all"!==m.tab&&B(m.tab)},[m.tab,B]),w)?n().createElement(G.Provider,{value:{refresh:C}},n().createElement($,null,n().createElement(i.Tabs,{addIcon:n().createElement(l.SchemaComponent,{components:{AddCategory:J},schema:{type:"void",properties:{addCategories:{type:"void",title:'{{ t("Add category", { ns: "'.concat(g.A7,'" }) }}'),"x-component":"AddCategory","x-component-props":{type:"primary"}}}}}),onChange:B,defaultActiveKey:m.tab||"all",type:"editable-card",destroyInactiveTabPane:!0,tabBarStyle:{marginBottom:"0px"},className:(0,l.css)(W()),items:R})),n().createElement(l.ActionContextProvider,{value:{visible:P,setVisible:F,openSize:"small"}},n().createElement(l.SchemaComponent,{scope:{useFormProviderProps:X,useCancelAction:l.useCancelAction,useEditSubmit:H},schema:{name:"modal",type:"void","x-decorator":"FormV2","x-decorator-props":{form:j},title:'{{ t("Edit category", { ns: "'.concat(g.A7,'" }) }}'),"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 H(){var e=(0,a.useForm)(),t=(0,l.useActionContext)(),o=(0,l.useResourceActionContext)(),n=(0,r.useContext)(G).refresh,i=(0,l.useAPIClient)();return{run:function(){return V(function(){var r;return N(this,function(c){switch(c.label){case 0:return[4,e.submit()];case 1:return c.sent(),[4,i.resource("workflowCategories").update({filterByTk:null==(r=e.values)?void 0:r.id,values:e.values})];case 2:return c.sent(),t.setVisible(!1),[4,e.reset()];case 3:return c.sent(),null==n||n(),null==o||o.refresh(),[2]}})})()}}}function X(){return{form:(0,a.useForm)()}}function Z(){var e=(0,a.useForm)(),t=(0,l.useActionContext)().setVisible,o=(0,r.useContext)(G).refresh,n=(0,l.useAPIClient)();return{run:function(){return V(function(){var r;return N(this,function(i){switch(i.label){case 0:return[4,e.submit()];case 1:return i.sent(),r=(0,T.cloneDeep)(e.values),[4,n.resource("workflowCategories").create({values:r})];case 2:return i.sent(),t(!1),e.reset(),o(),[2]}})})()}}}function J(e){var t=L((0,r.useState)(!1),2),o=t[0],i=t[1],a=(0,d.useTranslation)().t,s=(0,r.useMemo)(function(){return(0,c.createForm)()},[]);return n().createElement(l.ActionContextProvider,{value:{visible:o,setVisible:i,openSize:"small"}},n().createElement("div",{onClick:function(){return i(!0)},title:a("Add category")},n().createElement(k.PlusOutlined,null)),n().createElement(l.SchemaComponent,{schema:{name:"modal",type:"void","x-decorator":"FormV2","x-decorator-props":{form:s},title:'{{ t("Add category") }}',"x-component":"Action.Modal","x-component-props":q(M({},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:l.useCancelAction,useCreateSubmit:Z}}))}function Y(e){var t=e.value,o=e.multiple,r=e.fieldNames,c=void 0===r?l.defaultFieldNames:r,a=(0,l.useCompile)();return(o?null!=t?t:[]:t?[t]:[]).map(function(e){return n().createElement(i.Tag,{key:e[c.value],color:e[c.color]},a(e[c.label]))})}var ee=function(){var e,t,o=(0,l.useResourceContext)().collection,r=(0,l.useFilterFieldOptions)(o.fields),n=(0,l.useResourceActionContext)();return(0,l.useFilterFieldProps)({options:r,params:(null==(t=n.state)||null==(e=t.params)?void 0:e[0])||n.params,service:n})},et=o(9144);function eo(e,t,o,r,n,i,c){try{var a=e[i](c),l=a.value}catch(e){o(e);return}a.done?t(l):Promise.resolve(l).then(r,n)}function er(e){return function(){var t=this,o=arguments;return new Promise(function(r,n){var i=e.apply(t,o);function c(e){eo(i,r,n,c,a,"next",e)}function a(e){eo(i,r,n,c,a,"throw",e)}c(void 0)})}}function en(e,t){var o,r,n,i,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(o)throw TypeError("Generator is already executing.");for(;c;)try{if(o=1,r&&(n=2&l[0]?r.return:l[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,l[1])).done)return n;switch(r=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,r=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(n=(n=c.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){c.label=l[1];break}if(6===l[0]&&c.label<n[1]){c.label=n[1],n=l;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(l);break}n[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],r=0}finally{o=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function ei(e){var t=(0,a.useField)(),o=(0,l.useRecord)(),i=(0,l.usePlugin)(S.default);return(0,a.useFormEffects)(function(e){(0,c.onFieldChange)("type",function(e){var r=o.id||!e.value;if(e.value){var n=i.triggers.get(e.value);null!=n.sync?(r=!0,t.setValue(n.sync)):t.setInitialValue(!1)}t.setPattern(r?"disabled":"editable")})}),(0,r.useEffect)(function(){if(o.id){t.setPattern("disabled");var r,n=i.triggers.get(o.type);null!=n.sync?t.setValue(n.sync):t.setInitialValue(null!=(r=e.value)&&r)}},[o.id,t,i.triggers,o.type,e.value]),n().createElement(P.W5,e)}function ec(e){var t=(0,l.useApp)();e.visible=!!((0,l.usePlugin)("multi-app-share-collection")||"main"!==t.name)}function ea(){var e=i.App.useApp().message,t=(0,d.useTranslation)().t,o=(0,l.useResourceContext)().resource;return{run:function(){return er(function(){return en(this,function(r){switch(r.label){case 0:return[4,o.sync()];case 1:return r.sent(),e.success(t("Operation succeeded")),[2]}})})()}}}function el(){var e=i.App.useApp().message,t=(0,d.useTranslation)().t,o=(0,l.useResourceActionContext)().refresh,r=(0,l.useResourceContext)(),n=r.resource,c=r.targetKey,s=(0,l.useActionContext)().setVisible,u=(0,l.useRecord)()[c],p=(0,a.useForm)(),m=(0,a.useField)();return{run:function(){return er(function(){return en(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,4,5]),[4,p.submit()];case 1:return r.sent(),m.data=m.data||{},m.data.loading=!0,[4,n.revision({filterByTk:u,values:p.values})];case 2:return r.sent(),e.success(t("Operation succeeded")),o(),s(!1),[3,5];case 3:return console.error(r.sent()),[3,5];case 4:return m.data&&(m.data.loading=!1),[7];case 5:return[2]}})})()}}}function es(){var e,t,o=(0,r.useContext)(l.SchemaComponentContext),c=(0,l.usePlugin)(S.default).useTriggersOptions;return n().createElement(l.SchemaComponentContext.Provider,{value:(e=function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){var r;r=o[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},o),t=t={designable:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);o.push.apply(o,r)}return o})(Object(t)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}),e)},n().createElement(l.SchemaComponent,{schema:w,components:{CollectionProvider:l.CollectionProvider,WorkflowLink:b,ExecutionResourceProvider:m,ExecutionLink:s.a,OpenDrawer:x,ExecutionStatusSelect:C.P,SyncOptionSelect:ei,ExecutionStatusColumn:C.r,Tooltip:i.Tooltip,CategoryTabs:Q,EnumerationField:Y},scope:{useTriggersOptions:c,useWorkflowSyncReaction:ec,useSyncAction:ea,useWorkflowFilterActionProps:ee,useRefreshActionProps:E.X,useRevisionAction:el,TriggerOptionRender:j,ExecutionStatusOptions:et.C6}}))}}}]);
|
|
@@ -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([["929"],{458: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(2708),d=r(573),f=r(8378),p=r(336),m=r(5071),v=r(8019);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})))}},5437: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(8378),c=r(3238),s=r(2721),u=r(482),d=r(3505),f=r(7584),p=r(458),m=r(1732),v=r(8958),y=r(8018),b=r(573),h=r(2659),w=r(7893),g=r(1188),k=r(8327),E=r(336),x=r(9144),A=r(6805),C=r(8019);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}}))}}}]);
|