@nocobase/plugin-workflow 2.3.0-alpha.1 → 2.3.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/438.255c1f798203a3fc.js +10 -0
- package/dist/client/509.280de53e5e3e8874.js +10 -0
- package/dist/client/{67.56a3d15a55ab7d5c.js → 67.92c849b5dbe07c33.js} +1 -1
- package/dist/client/728.e54be200a2eaac45.js +10 -0
- package/dist/client/828.eda52a8918f0a56c.js +10 -0
- package/dist/client/WorkflowTasks.d.ts +5 -4
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client-v2/32.f7a2f5b51aac18b6.js +10 -0
- package/dist/client-v2/438.76337ed02ad35e77.js +10 -0
- package/dist/client-v2/513.028d9992cc415e73.js +10 -0
- package/dist/client-v2/677.687ffa76229d7e48.js +10 -0
- package/dist/client-v2/canvas/WorkflowVariableInput.d.ts +8 -1
- package/dist/client-v2/canvas/WorkflowVariableTextArea.d.ts +5 -0
- package/dist/client-v2/constants.d.ts +4 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/client-v2/taskCenter.d.ts +3 -1
- package/dist/common/collections/jobs.js +2 -2
- package/dist/common/collections/userWorkflowTaskStats.d.ts +54 -0
- package/dist/common/collections/userWorkflowTaskStats.js +87 -0
- package/dist/externalVersion.js +14 -14
- package/dist/locale/de-DE.json +2 -0
- package/dist/locale/en-US.json +6 -0
- package/dist/locale/es-ES.json +2 -0
- package/dist/locale/fr-FR.json +2 -0
- package/dist/locale/hu-HU.json +2 -0
- package/dist/locale/id-ID.json +2 -0
- package/dist/locale/it-IT.json +2 -0
- package/dist/locale/ja-JP.json +2 -0
- package/dist/locale/ko-KR.json +2 -0
- package/dist/locale/nl-NL.json +2 -0
- package/dist/locale/pt-BR.json +2 -0
- package/dist/locale/ru-RU.json +2 -0
- package/dist/locale/tr-TR.json +2 -0
- package/dist/locale/uk-UA.json +2 -0
- package/dist/locale/vi-VN.json +2 -0
- package/dist/locale/zh-CN.json +6 -0
- package/dist/locale/zh-TW.json +2 -0
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/joi/package.json +1 -1
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/server/Dispatcher.d.ts +24 -13
- package/dist/server/Dispatcher.js +160 -143
- package/dist/server/Plugin.d.ts +58 -12
- package/dist/server/Plugin.js +356 -16
- package/dist/server/Processor.d.ts +2 -7
- package/dist/server/Processor.js +37 -18
- package/dist/server/RunningExecutionRegistry.d.ts +2 -2
- package/dist/server/RunningExecutionRegistry.js +21 -6
- package/dist/server/actions/executions.js +3 -6
- package/dist/server/actions/index.js +3 -1
- package/dist/server/actions/jobs.js +1 -2
- package/dist/server/{migrations/20260713000000-remove-workflow-validation.d.ts → actions/userWorkflowTaskStats.d.ts} +2 -5
- package/dist/server/actions/userWorkflowTaskStats.js +112 -0
- package/dist/server/actions/workflows.js +18 -1
- package/dist/server/collections/userWorkflowTaskStats.d.ts +11 -0
- package/dist/server/collections/userWorkflowTaskStats.js +43 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/types/Execution.d.ts +2 -0
- package/dist/server/types/Job.d.ts +6 -0
- package/dist/server/utils.d.ts +1 -0
- package/dist/server/utils.js +5 -0
- package/dist/shared/WorkflowTaskNavigation.d.ts +56 -0
- package/dist/shared/WorkflowTaskNavigation.js +742 -0
- package/dist/swagger/index.d.ts +68 -1
- package/dist/swagger/index.js +61 -1
- package/package.json +2 -2
- package/dist/client/438.6c6409d821d8c353.js +0 -10
- package/dist/client/509.88792f5bd054b2af.js +0 -10
- package/dist/client/728.711fd4f1ed7d4e6a.js +0 -10
- package/dist/client/828.6880ab21513b1968.js +0 -10
- package/dist/client-v2/438.b7df0416b66f8f64.js +0 -10
- package/dist/client-v2/513.617697f74783a611.js +0 -10
- package/dist/client-v2/677.7382807126d9621a.js +0 -10
- package/dist/client-v2/728.4e8322ff8fce87b9.js +0 -10
- package/dist/server/migrations/20260713000000-remove-workflow-validation.js +0 -56
|
@@ -98,12 +98,9 @@ async function rerun(context, next) {
|
|
|
98
98
|
if (execution.status !== import_constants.EXECUTION_STATUS.STARTED) {
|
|
99
99
|
return context.throw(400, "Only started executions can be rerun");
|
|
100
100
|
}
|
|
101
|
-
await workflowPlugin.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
nodeId,
|
|
105
|
-
overwrite: overwrite === true
|
|
106
|
-
}
|
|
101
|
+
await workflowPlugin.rerun(execution, {
|
|
102
|
+
nodeId,
|
|
103
|
+
overwrite: overwrite === true
|
|
107
104
|
});
|
|
108
105
|
context.body = execution;
|
|
109
106
|
context.status = 202;
|
|
@@ -44,6 +44,7 @@ var nodes = __toESM(require("./nodes"));
|
|
|
44
44
|
var jobs = __toESM(require("./jobs"));
|
|
45
45
|
var executions = __toESM(require("./executions"));
|
|
46
46
|
var userWorkflowTasks = __toESM(require("./userWorkflowTasks"));
|
|
47
|
+
var userWorkflowTaskStats = __toESM(require("./userWorkflowTaskStats"));
|
|
47
48
|
function make(name, mod) {
|
|
48
49
|
return Object.keys(mod).reduce(
|
|
49
50
|
(result, key) => ({
|
|
@@ -69,6 +70,7 @@ function actions_default({ app }) {
|
|
|
69
70
|
}),
|
|
70
71
|
...make("jobs", jobs),
|
|
71
72
|
...make("executions", executions),
|
|
72
|
-
...make("userWorkflowTasks", userWorkflowTasks)
|
|
73
|
+
...make("userWorkflowTasks", userWorkflowTasks),
|
|
74
|
+
...make("userWorkflowTaskStats", userWorkflowTaskStats)
|
|
73
75
|
});
|
|
74
76
|
}
|
|
@@ -82,8 +82,7 @@ async function resume(context, next) {
|
|
|
82
82
|
context.body = job;
|
|
83
83
|
context.status = 202;
|
|
84
84
|
await next();
|
|
85
|
-
job
|
|
86
|
-
workflowPlugin.resume(job);
|
|
85
|
+
await workflowPlugin.resume(job);
|
|
87
86
|
}
|
|
88
87
|
// Annotate the CommonJS export names for ESM import in node:
|
|
89
88
|
0 && (module.exports = {
|
|
@@ -6,8 +6,5 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
export
|
|
11
|
-
on: string;
|
|
12
|
-
up(): Promise<void>;
|
|
13
|
-
}
|
|
9
|
+
import { Context } from '@nocobase/actions';
|
|
10
|
+
export declare function listMine(context: Context, next: any): Promise<void>;
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var userWorkflowTaskStats_exports = {};
|
|
28
|
+
__export(userWorkflowTaskStats_exports, {
|
|
29
|
+
listMine: () => listMine
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(userWorkflowTaskStats_exports);
|
|
32
|
+
var import_actions = require("@nocobase/actions");
|
|
33
|
+
async function listMine(context, next) {
|
|
34
|
+
const { type, search } = context.action.params;
|
|
35
|
+
const normalizedSearch = typeof search === "string" ? search.trim() : "";
|
|
36
|
+
const page = Math.max(Number.parseInt(String(context.action.params.page ?? 1), 10) || 1, 1);
|
|
37
|
+
const pageSize = Math.min(
|
|
38
|
+
Math.max(Number.parseInt(String(context.action.params.pageSize ?? 200), 10) || 200, 1),
|
|
39
|
+
200
|
|
40
|
+
);
|
|
41
|
+
const pagination = import_actions.utils.pageArgsToLimitArgs(page, pageSize);
|
|
42
|
+
const repository = context.db.getRepository("userWorkflowTaskStats");
|
|
43
|
+
const rows = await repository.find({
|
|
44
|
+
filter: {
|
|
45
|
+
userId: context.state.currentUser.id,
|
|
46
|
+
...type ? { type } : {},
|
|
47
|
+
all: {
|
|
48
|
+
$gt: 0
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
fields: ["workflowKey", "pending", "all"]
|
|
52
|
+
});
|
|
53
|
+
const statsMap = /* @__PURE__ */ new Map();
|
|
54
|
+
for (const row of rows) {
|
|
55
|
+
if (!row.workflowKey) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const existed = statsMap.get(row.workflowKey) ?? {
|
|
59
|
+
workflowKey: row.workflowKey,
|
|
60
|
+
stats: { pending: 0, all: 0 }
|
|
61
|
+
};
|
|
62
|
+
existed.stats.pending += Number(row.pending) || 0;
|
|
63
|
+
existed.stats.all += Number(row.all) || 0;
|
|
64
|
+
statsMap.set(row.workflowKey, existed);
|
|
65
|
+
}
|
|
66
|
+
const workflowKeys = Array.from(statsMap.keys());
|
|
67
|
+
if (!workflowKeys.length) {
|
|
68
|
+
context.body = {
|
|
69
|
+
rows: [],
|
|
70
|
+
page,
|
|
71
|
+
pageSize,
|
|
72
|
+
hasNext: false
|
|
73
|
+
};
|
|
74
|
+
await next();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const workflows = await context.db.getRepository("workflows").find({
|
|
78
|
+
filter: {
|
|
79
|
+
key: workflowKeys,
|
|
80
|
+
current: true,
|
|
81
|
+
...normalizedSearch ? {
|
|
82
|
+
title: {
|
|
83
|
+
$includes: normalizedSearch
|
|
84
|
+
}
|
|
85
|
+
} : {}
|
|
86
|
+
},
|
|
87
|
+
fields: ["key", "title"],
|
|
88
|
+
sort: ["title"],
|
|
89
|
+
limit: pagination.limit + 1,
|
|
90
|
+
offset: pagination.offset
|
|
91
|
+
});
|
|
92
|
+
const hasNext = workflows.length > pageSize;
|
|
93
|
+
const data = workflows.slice(0, pageSize).map((workflow) => {
|
|
94
|
+
var _a;
|
|
95
|
+
return {
|
|
96
|
+
workflowKey: workflow.key,
|
|
97
|
+
title: workflow.title,
|
|
98
|
+
stats: ((_a = statsMap.get(workflow.key)) == null ? void 0 : _a.stats) ?? { pending: 0, all: 0 }
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
context.body = {
|
|
102
|
+
rows: data,
|
|
103
|
+
page,
|
|
104
|
+
pageSize,
|
|
105
|
+
hasNext
|
|
106
|
+
};
|
|
107
|
+
await next();
|
|
108
|
+
}
|
|
109
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
+
0 && (module.exports = {
|
|
111
|
+
listMine
|
|
112
|
+
});
|
|
@@ -106,6 +106,7 @@ async function update(context, next) {
|
|
|
106
106
|
return import_actions.default.update(context, next);
|
|
107
107
|
}
|
|
108
108
|
async function destroy(context, next) {
|
|
109
|
+
const plugin = context.app.pm.get(import_Plugin.default);
|
|
109
110
|
const repository = import_actions.utils.getRepositoryFromParams(context);
|
|
110
111
|
const { filterByTk, filter } = context.action.params;
|
|
111
112
|
await context.db.sequelize.transaction(async (transaction) => {
|
|
@@ -116,6 +117,15 @@ async function destroy(context, next) {
|
|
|
116
117
|
transaction
|
|
117
118
|
});
|
|
118
119
|
const ids = new Set(items.map((item) => item.id));
|
|
120
|
+
const affectedKeys = Array.from(new Set(items.map((item) => item.get("key"))));
|
|
121
|
+
const affectedTaskStats = affectedKeys.length ? await context.db.getRepository("userWorkflowTaskStats").find({
|
|
122
|
+
filter: {
|
|
123
|
+
workflowKey: affectedKeys
|
|
124
|
+
},
|
|
125
|
+
fields: ["userId"],
|
|
126
|
+
transaction
|
|
127
|
+
}) : [];
|
|
128
|
+
const affectedUserIds = Array.from(new Set(affectedTaskStats.map((item) => item.get("userId"))));
|
|
119
129
|
const keysSet = new Set(items.filter((item) => item.current).map((item) => item.key));
|
|
120
130
|
const revisions = await repository.find({
|
|
121
131
|
filter: {
|
|
@@ -138,6 +148,13 @@ async function destroy(context, next) {
|
|
|
138
148
|
},
|
|
139
149
|
transaction
|
|
140
150
|
});
|
|
151
|
+
if (affectedKeys.length) {
|
|
152
|
+
await plugin.repairTaskStats({
|
|
153
|
+
workflowKeys: affectedKeys,
|
|
154
|
+
...affectedUserIds.length ? { userIds: affectedUserIds } : {},
|
|
155
|
+
transaction
|
|
156
|
+
});
|
|
157
|
+
}
|
|
141
158
|
context.body = deleted;
|
|
142
159
|
});
|
|
143
160
|
next();
|
|
@@ -208,7 +225,7 @@ async function execute(context, next) {
|
|
|
208
225
|
filter: { key: workflow.key }
|
|
209
226
|
});
|
|
210
227
|
let newVersion;
|
|
211
|
-
if (executed
|
|
228
|
+
if (executed === 0 && Number(autoRevision) === 1) {
|
|
212
229
|
newVersion = await repository.revision({
|
|
213
230
|
filterByTk: workflow.id,
|
|
214
231
|
filter: { key: workflow.key },
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
import { CollectionOptions } from '@nocobase/database';
|
|
10
|
+
declare const _default: CollectionOptions;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var userWorkflowTaskStats_exports = {};
|
|
38
|
+
__export(userWorkflowTaskStats_exports, {
|
|
39
|
+
default: () => userWorkflowTaskStats_default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(userWorkflowTaskStats_exports);
|
|
42
|
+
var import_userWorkflowTaskStats = __toESM(require("../../common/collections/userWorkflowTaskStats"));
|
|
43
|
+
var userWorkflowTaskStats_default = import_userWorkflowTaskStats.default;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -17,4 +17,5 @@ export type { EventOptions } from './Dispatcher';
|
|
|
17
17
|
export { default as Processor } from './Processor';
|
|
18
18
|
export type { BackgroundAbortHandle, ProcessorOptions, ScopeTransaction } from './Processor';
|
|
19
19
|
export { default } from './Plugin';
|
|
20
|
+
export type { RepairTaskStatsOptions, TaskStatsProvider, TaskStatsRow } from './Plugin';
|
|
20
21
|
export * from './types';
|
|
@@ -12,11 +12,13 @@ import WorkflowModel from './Workflow';
|
|
|
12
12
|
export default class ExecutionModel extends Model {
|
|
13
13
|
static readonly database: Database;
|
|
14
14
|
id: number;
|
|
15
|
+
workflowId: number;
|
|
15
16
|
title: string;
|
|
16
17
|
context: any;
|
|
17
18
|
status: number;
|
|
18
19
|
reason?: string | null;
|
|
19
20
|
dispatched: boolean;
|
|
21
|
+
manually?: boolean | null;
|
|
20
22
|
parentExecutionId?: number | null;
|
|
21
23
|
stack?: Array<number | string>;
|
|
22
24
|
startedAt?: Date | null;
|
|
@@ -8,11 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { BelongsToGetAssociationMixin, Model } from '@nocobase/database';
|
|
10
10
|
import FlowNodeModel from './FlowNode';
|
|
11
|
+
import ExecutionModel from './Execution';
|
|
11
12
|
export default class JobModel extends Model {
|
|
12
13
|
id: number;
|
|
14
|
+
executionId: number;
|
|
15
|
+
workflowId?: number;
|
|
13
16
|
status: number;
|
|
14
17
|
result?: any;
|
|
15
18
|
meta?: any;
|
|
19
|
+
startedAt?: Date | null;
|
|
16
20
|
createdAt: Date;
|
|
17
21
|
updatedAt: Date;
|
|
18
22
|
upstreamId: number;
|
|
@@ -20,4 +24,6 @@ export default class JobModel extends Model {
|
|
|
20
24
|
nodeId: number;
|
|
21
25
|
node?: FlowNodeModel;
|
|
22
26
|
getNode: BelongsToGetAssociationMixin<FlowNodeModel>;
|
|
27
|
+
execution?: ExecutionModel;
|
|
28
|
+
getExecution: BelongsToGetAssociationMixin<ExecutionModel>;
|
|
23
29
|
}
|
package/dist/server/utils.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ type AbortOptions = Transactionable & {
|
|
|
16
16
|
reason?: (typeof EXECUTION_REASON)[keyof typeof EXECUTION_REASON];
|
|
17
17
|
};
|
|
18
18
|
export declare function getExecutionLockKey(executionId: number | string): string;
|
|
19
|
+
export declare function getJobLockKey(jobId: number | string): string;
|
|
19
20
|
export declare function isLockAcquireError(error: unknown): boolean;
|
|
20
21
|
export declare function validateCollectionField(collection: string, dataSourceManager: DataSourceManager): Record<string, string> | null;
|
|
21
22
|
export declare function getExecutionStatusName(status: number | null | undefined): string;
|
package/dist/server/utils.js
CHANGED
|
@@ -29,6 +29,7 @@ __export(utils_exports, {
|
|
|
29
29
|
abortExecution: () => abortExecution,
|
|
30
30
|
getExecutionLockKey: () => getExecutionLockKey,
|
|
31
31
|
getExecutionStatusName: () => getExecutionStatusName,
|
|
32
|
+
getJobLockKey: () => getJobLockKey,
|
|
32
33
|
getWorkflowExecutionLogMeta: () => getWorkflowExecutionLogMeta,
|
|
33
34
|
isLockAcquireError: () => isLockAcquireError,
|
|
34
35
|
toJSON: () => toJSON,
|
|
@@ -41,6 +42,9 @@ var import_constants = require("./constants");
|
|
|
41
42
|
function getExecutionLockKey(executionId) {
|
|
42
43
|
return `workflow:execution:${executionId}`;
|
|
43
44
|
}
|
|
45
|
+
function getJobLockKey(jobId) {
|
|
46
|
+
return `workflow:job:${jobId}`;
|
|
47
|
+
}
|
|
44
48
|
function isLockAcquireError(error) {
|
|
45
49
|
return error instanceof Error && error.constructor.name === "LockAcquireError";
|
|
46
50
|
}
|
|
@@ -197,6 +201,7 @@ function toJSON(data) {
|
|
|
197
201
|
abortExecution,
|
|
198
202
|
getExecutionLockKey,
|
|
199
203
|
getExecutionStatusName,
|
|
204
|
+
getJobLockKey,
|
|
200
205
|
getWorkflowExecutionLogMeta,
|
|
201
206
|
isLockAcquireError,
|
|
202
207
|
toJSON,
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
import React from 'react';
|
|
10
|
+
export interface WorkflowTaskStatsItem {
|
|
11
|
+
workflowKey: string;
|
|
12
|
+
title: string;
|
|
13
|
+
stats: {
|
|
14
|
+
pending: number;
|
|
15
|
+
all: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface WorkflowTaskNavigationType {
|
|
19
|
+
count: number;
|
|
20
|
+
key: string;
|
|
21
|
+
title: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
interface WorkflowTaskStatsListParams {
|
|
24
|
+
page: number;
|
|
25
|
+
pageSize: number;
|
|
26
|
+
search?: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}
|
|
29
|
+
export type LoadWorkflowTaskStats = (params: WorkflowTaskStatsListParams) => Promise<unknown>;
|
|
30
|
+
export interface WorkflowTaskFilterContextValue {
|
|
31
|
+
selectedWorkflow: WorkflowTaskStatsItem | null;
|
|
32
|
+
selectWorkflow: (workflow: WorkflowTaskStatsItem | null) => void;
|
|
33
|
+
workflows: WorkflowTaskStatsItem[];
|
|
34
|
+
loading: boolean;
|
|
35
|
+
loadingMore: boolean;
|
|
36
|
+
hasNext: boolean;
|
|
37
|
+
error: boolean;
|
|
38
|
+
search: string;
|
|
39
|
+
setSearch: (search: string) => void;
|
|
40
|
+
loadMore: () => void;
|
|
41
|
+
reload: () => void;
|
|
42
|
+
}
|
|
43
|
+
export declare function useWorkflowTaskFilterContext(): WorkflowTaskFilterContextValue;
|
|
44
|
+
export declare function WorkflowTaskFilterProvider(props: React.PropsWithChildren<{
|
|
45
|
+
eventBus?: EventTarget;
|
|
46
|
+
loadWorkflowTaskStats: LoadWorkflowTaskStats;
|
|
47
|
+
typeKey?: string;
|
|
48
|
+
}>): React.JSX.Element;
|
|
49
|
+
export declare function WorkflowTaskNavigation(props: {
|
|
50
|
+
currentTypeKey?: string;
|
|
51
|
+
mobile: boolean;
|
|
52
|
+
onTaskTypeSelect: (typeKey: string) => void;
|
|
53
|
+
taskTypes: WorkflowTaskNavigationType[];
|
|
54
|
+
t: (key: string) => string;
|
|
55
|
+
}): React.JSX.Element;
|
|
56
|
+
export {};
|