@nocobase/plugin-workflow 0.7.6-alpha.2 → 0.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/lib/client/AddButton.d.ts +7 -0
- package/lib/client/AddButton.js +173 -0
- package/lib/client/Branch.d.ts +7 -0
- package/lib/client/Branch.js +61 -0
- package/lib/client/ExecutionCanvas.d.ts +2 -0
- package/lib/client/ExecutionCanvas.js +212 -0
- package/lib/client/ExecutionLink.d.ts +1 -0
- package/lib/client/ExecutionLink.js +66 -0
- package/lib/client/ExecutionPage.d.ts +1 -0
- package/lib/client/ExecutionPage.js +92 -0
- package/lib/client/FlowContext.d.ts +3 -0
- package/lib/client/FlowContext.js +29 -0
- package/lib/client/WorkflowCanvas.d.ts +0 -13
- package/lib/client/WorkflowCanvas.js +30 -141
- package/lib/client/WorkflowLink.js +1 -1
- package/lib/client/WorkflowPage.js +1 -1
- package/lib/client/WorkflowProvider.js +30 -10
- package/lib/client/WorkflowShortcut.d.ts +1 -0
- package/lib/client/WorkflowShortcut.js +36 -52
- package/lib/client/calculators.js +3 -3
- package/lib/client/constants.d.ts +30 -0
- package/lib/client/constants.js +95 -0
- package/lib/client/nodes/condition.js +6 -4
- package/lib/client/nodes/create.js +2 -2
- package/lib/client/nodes/index.d.ts +2 -1
- package/lib/client/nodes/index.js +168 -46
- package/lib/client/nodes/parallel.js +6 -4
- package/lib/client/nodes/query.js +2 -2
- package/lib/client/nodes/update.js +2 -2
- package/lib/client/schemas/executions.d.ts +22 -0
- package/lib/client/schemas/executions.js +75 -40
- package/lib/client/schemas/workflows.js +7 -5
- package/lib/client/style.js +44 -3
- package/lib/client/triggers/collection.js +2 -2
- package/lib/client/triggers/index.js +102 -13
- package/lib/client/triggers/schedule/index.js +2 -2
- package/lib/server/Plugin.d.ts +4 -5
- package/lib/server/Plugin.js +13 -16
- package/lib/server/actions/jobs.js +1 -1
- package/lib/server/actions/workflows.d.ts +1 -0
- package/lib/server/actions/workflows.js +37 -7
- package/lib/server/extensions/assignees/actions.js +1 -1
- package/lib/server/triggers/schedule.js +25 -15
- package/package.json +9 -8
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.AddButton = AddButton;
|
|
7
|
-
exports.Branch = Branch;
|
|
8
6
|
exports.WorkflowCanvas = WorkflowCanvas;
|
|
9
|
-
exports.useFlowContext = useFlowContext;
|
|
10
7
|
|
|
11
8
|
function _react() {
|
|
12
9
|
const data = _interopRequireWildcard(require("react"));
|
|
@@ -68,6 +65,16 @@ function _reactI18next() {
|
|
|
68
65
|
return data;
|
|
69
66
|
}
|
|
70
67
|
|
|
68
|
+
function _classnames() {
|
|
69
|
+
const data = _interopRequireDefault(require("classnames"));
|
|
70
|
+
|
|
71
|
+
_classnames = function _classnames() {
|
|
72
|
+
return data;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return data;
|
|
76
|
+
}
|
|
77
|
+
|
|
71
78
|
function _client() {
|
|
72
79
|
const data = require("@nocobase/client");
|
|
73
80
|
|
|
@@ -78,26 +85,22 @@ function _client() {
|
|
|
78
85
|
return data;
|
|
79
86
|
}
|
|
80
87
|
|
|
81
|
-
var
|
|
88
|
+
var _FlowContext = require("./FlowContext");
|
|
82
89
|
|
|
83
90
|
var _style = require("./style");
|
|
84
91
|
|
|
85
92
|
var _triggers = require("./triggers");
|
|
86
93
|
|
|
94
|
+
var _Branch = require("./Branch");
|
|
95
|
+
|
|
87
96
|
const _excluded = ["nodes", "revisions"];
|
|
88
97
|
|
|
98
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
99
|
+
|
|
89
100
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
90
101
|
|
|
91
102
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
92
103
|
|
|
93
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
94
|
-
|
|
95
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
96
|
-
|
|
97
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
98
|
-
|
|
99
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
100
|
-
|
|
101
104
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
102
105
|
|
|
103
106
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -106,7 +109,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
106
109
|
|
|
107
110
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
108
111
|
|
|
109
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(
|
|
112
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
110
113
|
|
|
111
114
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
112
115
|
|
|
@@ -138,12 +141,6 @@ function makeNodes(nodes) {
|
|
|
138
141
|
}
|
|
139
142
|
}
|
|
140
143
|
|
|
141
|
-
const FlowContext = _react().default.createContext(null);
|
|
142
|
-
|
|
143
|
-
function useFlowContext() {
|
|
144
|
-
return (0, _react().useContext)(FlowContext);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
144
|
function WorkflowCanvas() {
|
|
148
145
|
var _data$data2;
|
|
149
146
|
|
|
@@ -170,7 +167,7 @@ function WorkflowCanvas() {
|
|
|
170
167
|
const _ref = (_data$data = data === null || data === void 0 ? void 0 : data.data) !== null && _data$data !== void 0 ? _data$data : {},
|
|
171
168
|
title = _ref.title;
|
|
172
169
|
|
|
173
|
-
setTitle(`${title ?
|
|
170
|
+
setTitle(`${t('Workflow')}${title ? `: ${title}` : ''}`);
|
|
174
171
|
}, [data === null || data === void 0 ? void 0 : data.data]);
|
|
175
172
|
|
|
176
173
|
if (!(data === null || data === void 0 ? void 0 : data.data) && !loading) {
|
|
@@ -205,7 +202,7 @@ function WorkflowCanvas() {
|
|
|
205
202
|
filterByTk: workflow[targetKey],
|
|
206
203
|
values: {
|
|
207
204
|
enabled: value,
|
|
208
|
-
// NOTE: keep `key` field to
|
|
205
|
+
// NOTE: keep `key` field to adapt for backend
|
|
209
206
|
key: workflow.key
|
|
210
207
|
}
|
|
211
208
|
});
|
|
@@ -232,7 +229,7 @@ function WorkflowCanvas() {
|
|
|
232
229
|
return _onRevision.apply(this, arguments);
|
|
233
230
|
}
|
|
234
231
|
|
|
235
|
-
return _react().default.createElement(FlowContext.Provider, {
|
|
232
|
+
return _react().default.createElement(_FlowContext.FlowContext.Provider, {
|
|
236
233
|
value: {
|
|
237
234
|
workflow,
|
|
238
235
|
nodes,
|
|
@@ -241,7 +238,9 @@ function WorkflowCanvas() {
|
|
|
241
238
|
}
|
|
242
239
|
}, _react().default.createElement("div", {
|
|
243
240
|
className: "workflow-toolbar"
|
|
244
|
-
}, _react().default.createElement("header", null, _react().default.createElement("
|
|
241
|
+
}, _react().default.createElement("header", null, _react().default.createElement("span", null, _react().default.createElement(_reactRouterDom().Link, {
|
|
242
|
+
to: `/admin/settings/workflow/workflows`
|
|
243
|
+
}, t('Workflow'))), _react().default.createElement("strong", null, workflow.title)), _react().default.createElement("aside", null, _react().default.createElement("div", {
|
|
245
244
|
className: "workflow-versions"
|
|
246
245
|
}, _react().default.createElement("label", null, t('Version')), _react().default.createElement(_antd().Dropdown, {
|
|
247
246
|
trigger: ['click'],
|
|
@@ -249,10 +248,14 @@ function WorkflowCanvas() {
|
|
|
249
248
|
onClick: onSwitchVersion,
|
|
250
249
|
defaultSelectedKeys: [workflow.id],
|
|
251
250
|
className: (0, _css().cx)(_style.workflowVersionDropdownClass)
|
|
252
|
-
}, revisions.sort((a, b) => b.id - a.id).map(item => _react().default.createElement(_antd().Menu.Item, {
|
|
251
|
+
}, revisions.sort((a, b) => b.id - a.id).map((item, index) => _react().default.createElement(_antd().Menu.Item, {
|
|
253
252
|
key: item.id,
|
|
254
253
|
icon: item.current ? _react().default.createElement(_icons().RightOutlined, null) : null,
|
|
255
|
-
className:
|
|
254
|
+
className: (0, _classnames().default)({
|
|
255
|
+
executed: item.executed,
|
|
256
|
+
unexecuted: !item.executed,
|
|
257
|
+
enabled: item.enabled
|
|
258
|
+
})
|
|
256
259
|
}, _react().default.createElement("strong", null, `#${item.id}`), _react().default.createElement("time", null, new Date(item.createdAt).toLocaleString()))))
|
|
257
260
|
}, _react().default.createElement(_antd().Button, {
|
|
258
261
|
type: "link"
|
|
@@ -267,7 +270,7 @@ function WorkflowCanvas() {
|
|
|
267
270
|
className: "workflow-canvas"
|
|
268
271
|
}, _react().default.createElement(_triggers.TriggerConfig, null), _react().default.createElement("div", {
|
|
269
272
|
className: _style.branchBlockClass
|
|
270
|
-
}, _react().default.createElement(Branch, {
|
|
273
|
+
}, _react().default.createElement(_Branch.Branch, {
|
|
271
274
|
entry: entry
|
|
272
275
|
})), _react().default.createElement("div", {
|
|
273
276
|
className: (0, _css().cx)(_style.nodeCardClass)
|
|
@@ -276,118 +279,4 @@ function WorkflowCanvas() {
|
|
|
276
279
|
}, _react().default.createElement(_antd().Tag, {
|
|
277
280
|
color: "#333"
|
|
278
281
|
}, t('End'))))));
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
function Branch({
|
|
282
|
-
from = null,
|
|
283
|
-
entry = null,
|
|
284
|
-
branchIndex = null,
|
|
285
|
-
controller = null
|
|
286
|
-
}) {
|
|
287
|
-
const list = [];
|
|
288
|
-
|
|
289
|
-
for (let node = entry; node; node = node.downstream) {
|
|
290
|
-
list.push(node);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return _react().default.createElement("div", {
|
|
294
|
-
className: (0, _css().cx)(_style.branchClass)
|
|
295
|
-
}, _react().default.createElement("div", {
|
|
296
|
-
className: "workflow-branch-lines"
|
|
297
|
-
}), controller, _react().default.createElement(AddButton, {
|
|
298
|
-
upstream: from,
|
|
299
|
-
branchIndex: branchIndex
|
|
300
|
-
}), _react().default.createElement("div", {
|
|
301
|
-
className: "workflow-node-list"
|
|
302
|
-
}, list.map(item => _react().default.createElement(_nodes.Node, {
|
|
303
|
-
data: item,
|
|
304
|
-
key: item.id
|
|
305
|
-
}))));
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
;
|
|
309
|
-
|
|
310
|
-
function AddButton({
|
|
311
|
-
upstream,
|
|
312
|
-
branchIndex = null
|
|
313
|
-
}) {
|
|
314
|
-
const compile = (0, _client().useCompile)();
|
|
315
|
-
const api = (0, _client().useAPIClient)();
|
|
316
|
-
|
|
317
|
-
const _useFlowContext = useFlowContext(),
|
|
318
|
-
workflow = _useFlowContext.workflow,
|
|
319
|
-
onNodeAdded = _useFlowContext.onNodeAdded;
|
|
320
|
-
|
|
321
|
-
const resource = api.resource('workflows.nodes', workflow.id);
|
|
322
|
-
|
|
323
|
-
function onCreate(_x2) {
|
|
324
|
-
return _onCreate.apply(this, arguments);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function _onCreate() {
|
|
328
|
-
_onCreate = _asyncToGenerator(function* ({
|
|
329
|
-
keyPath
|
|
330
|
-
}) {
|
|
331
|
-
var _upstream$id;
|
|
332
|
-
|
|
333
|
-
const type = keyPath.pop();
|
|
334
|
-
const config = {};
|
|
335
|
-
|
|
336
|
-
const _keyPath = _slicedToArray(keyPath, 1),
|
|
337
|
-
optionKey = _keyPath[0];
|
|
338
|
-
|
|
339
|
-
if (optionKey) {
|
|
340
|
-
const _instructions$get$opt = _nodes.instructions.get(type).options.find(item => item.key === optionKey),
|
|
341
|
-
value = _instructions$get$opt.value;
|
|
342
|
-
|
|
343
|
-
Object.assign(config, value);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
const _yield$resource$creat = yield resource.create({
|
|
347
|
-
values: {
|
|
348
|
-
type,
|
|
349
|
-
upstreamId: (_upstream$id = upstream === null || upstream === void 0 ? void 0 : upstream.id) !== null && _upstream$id !== void 0 ? _upstream$id : null,
|
|
350
|
-
branchIndex,
|
|
351
|
-
config
|
|
352
|
-
}
|
|
353
|
-
}),
|
|
354
|
-
node = _yield$resource$creat.data.data;
|
|
355
|
-
|
|
356
|
-
onNodeAdded(node);
|
|
357
|
-
});
|
|
358
|
-
return _onCreate.apply(this, arguments);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
const groups = [{
|
|
362
|
-
value: 'control',
|
|
363
|
-
name: '{{t("Control")}}'
|
|
364
|
-
}, {
|
|
365
|
-
value: 'collection',
|
|
366
|
-
name: '{{t("Collection operations")}}'
|
|
367
|
-
}];
|
|
368
|
-
const instructionList = Array.from(_nodes.instructions.getValues());
|
|
369
|
-
return _react().default.createElement("div", {
|
|
370
|
-
className: (0, _css().cx)(_style.addButtonClass)
|
|
371
|
-
}, _react().default.createElement(_antd().Dropdown, {
|
|
372
|
-
trigger: ['click'],
|
|
373
|
-
overlay: _react().default.createElement(_antd().Menu, {
|
|
374
|
-
onClick: ev => onCreate(ev)
|
|
375
|
-
}, groups.map(group => _react().default.createElement(_antd().Menu.ItemGroup, {
|
|
376
|
-
key: group.value,
|
|
377
|
-
title: compile(group.name)
|
|
378
|
-
}, instructionList.filter(item => item.group === group.value).map(item => item.options ? _react().default.createElement(_antd().Menu.SubMenu, {
|
|
379
|
-
key: item.type,
|
|
380
|
-
title: compile(item.title)
|
|
381
|
-
}, item.options.map(option => _react().default.createElement(_antd().Menu.Item, {
|
|
382
|
-
key: option.key
|
|
383
|
-
}, compile(option.label)))) : _react().default.createElement(_antd().Menu.Item, {
|
|
384
|
-
key: item.type
|
|
385
|
-
}, compile(item.title)))))),
|
|
386
|
-
disabled: workflow.executed
|
|
387
|
-
}, _react().default.createElement(_antd().Button, {
|
|
388
|
-
shape: "circle",
|
|
389
|
-
icon: _react().default.createElement(_icons().PlusOutlined, null)
|
|
390
|
-
})));
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
;
|
|
282
|
+
}
|
|
@@ -58,7 +58,7 @@ const WorkflowLink = () => {
|
|
|
58
58
|
setVisible = _useActionContext.setVisible;
|
|
59
59
|
|
|
60
60
|
return _react().default.createElement(_reactRouterDom().Link, {
|
|
61
|
-
to: `/admin/
|
|
61
|
+
to: `/admin/settings/workflow/workflows/${id}`,
|
|
62
62
|
onClick: () => setVisible(false)
|
|
63
63
|
}, t('View'));
|
|
64
64
|
};
|
|
@@ -75,7 +75,7 @@ const WorkflowPage = () => {
|
|
|
75
75
|
action: 'get',
|
|
76
76
|
params: {
|
|
77
77
|
filter: params,
|
|
78
|
-
appends: ['nodes', 'revisions.id', 'revisions.createdAt', 'revisions.current', 'revisions.executed']
|
|
78
|
+
appends: ['nodes', 'revisions.id', 'revisions.createdAt', 'revisions.current', 'revisions.executed', 'revisions.enabled']
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
},
|
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.WorkflowProvider = void 0;
|
|
7
7
|
|
|
8
|
-
function
|
|
9
|
-
const data =
|
|
8
|
+
function _client() {
|
|
9
|
+
const data = require("@nocobase/client");
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
_client = function _client() {
|
|
12
12
|
return data;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
return data;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function
|
|
19
|
-
const data = require("
|
|
18
|
+
function _react() {
|
|
19
|
+
const data = _interopRequireWildcard(require("react"));
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
_react = function _react() {
|
|
22
22
|
return data;
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -29,6 +29,8 @@ var _WorkflowPage = require("./WorkflowPage");
|
|
|
29
29
|
|
|
30
30
|
var _WorkflowShortcut = require("./WorkflowShortcut");
|
|
31
31
|
|
|
32
|
+
var _ExecutionPage = require("./ExecutionPage");
|
|
33
|
+
|
|
32
34
|
const _excluded = ["routes", "components"];
|
|
33
35
|
|
|
34
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -55,10 +57,27 @@ const WorkflowProvider = props => {
|
|
|
55
57
|
|
|
56
58
|
routes[1].routes.unshift({
|
|
57
59
|
type: 'route',
|
|
58
|
-
path: '/admin/
|
|
60
|
+
path: '/admin/settings/workflow/workflows/:id',
|
|
59
61
|
component: 'WorkflowPage'
|
|
62
|
+
}, {
|
|
63
|
+
type: 'route',
|
|
64
|
+
path: '/admin/settings/workflow/executions/:id',
|
|
65
|
+
component: 'ExecutionPage'
|
|
60
66
|
});
|
|
61
|
-
return _react().default.createElement(_client().
|
|
67
|
+
return _react().default.createElement(_client().SettingsCenterProvider, {
|
|
68
|
+
settings: {
|
|
69
|
+
workflow: {
|
|
70
|
+
icon: 'PartitionOutlined',
|
|
71
|
+
title: '{{t("Workflow")}}',
|
|
72
|
+
tabs: {
|
|
73
|
+
workflows: {
|
|
74
|
+
title: '{{t("Workflow")}}',
|
|
75
|
+
component: _WorkflowShortcut.WorkflowPane
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, _react().default.createElement(_client().PluginManagerContext.Provider, {
|
|
62
81
|
value: {
|
|
63
82
|
components: _objectSpread(_objectSpread({}, ctx === null || ctx === void 0 ? void 0 : ctx.components), {}, {
|
|
64
83
|
WorkflowShortcut: _WorkflowShortcut.WorkflowShortcut
|
|
@@ -67,12 +86,13 @@ const WorkflowProvider = props => {
|
|
|
67
86
|
}, _react().default.createElement(_client().RouteSwitchContext.Provider, {
|
|
68
87
|
value: _objectSpread(_objectSpread({
|
|
69
88
|
components: _objectSpread(_objectSpread({}, components), {}, {
|
|
70
|
-
WorkflowPage: _WorkflowPage.WorkflowPage
|
|
89
|
+
WorkflowPage: _WorkflowPage.WorkflowPage,
|
|
90
|
+
ExecutionPage: _ExecutionPage.ExecutionPage
|
|
71
91
|
})
|
|
72
92
|
}, others), {}, {
|
|
73
93
|
routes
|
|
74
94
|
})
|
|
75
|
-
}, props.children));
|
|
95
|
+
}, props.children)));
|
|
76
96
|
};
|
|
77
97
|
|
|
78
98
|
exports.WorkflowProvider = WorkflowProvider;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WorkflowShortcut = void 0;
|
|
6
|
+
exports.WorkflowShortcut = exports.WorkflowPane = void 0;
|
|
7
7
|
|
|
8
8
|
function _react() {
|
|
9
|
-
const data =
|
|
9
|
+
const data = _interopRequireDefault(require("react"));
|
|
10
10
|
|
|
11
11
|
_react = function _react() {
|
|
12
12
|
return data;
|
|
@@ -15,20 +15,20 @@ function _react() {
|
|
|
15
15
|
return data;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function
|
|
19
|
-
const data = require("
|
|
18
|
+
function _antd() {
|
|
19
|
+
const data = require("antd");
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
_antd = function _antd() {
|
|
22
22
|
return data;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
return data;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function
|
|
29
|
-
const data = require("@
|
|
28
|
+
function _icons() {
|
|
29
|
+
const data = require("@ant-design/icons");
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
_icons = function _icons() {
|
|
32
32
|
return data;
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -45,6 +45,16 @@ function _reactI18next() {
|
|
|
45
45
|
return data;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
function _reactRouterDom() {
|
|
49
|
+
const data = require("react-router-dom");
|
|
50
|
+
|
|
51
|
+
_reactRouterDom = function _reactRouterDom() {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
48
58
|
function _client() {
|
|
49
59
|
const data = require("@nocobase/client");
|
|
50
60
|
|
|
@@ -61,63 +71,37 @@ var _WorkflowLink = require("./WorkflowLink");
|
|
|
61
71
|
|
|
62
72
|
var _ExecutionResourceProvider = require("./ExecutionResourceProvider");
|
|
63
73
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
67
|
-
|
|
68
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
74
|
+
var _ExecutionLink = require("./ExecutionLink");
|
|
69
75
|
|
|
70
|
-
function
|
|
76
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
71
77
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
type: 'object',
|
|
82
|
-
properties: {
|
|
83
|
-
[(0, _shared().uid)()]: {
|
|
84
|
-
'x-component': 'Action.Drawer',
|
|
85
|
-
type: 'void',
|
|
86
|
-
title: '{{t("Workflow")}}',
|
|
87
|
-
properties: {
|
|
88
|
-
table: _workflows.workflowSchema
|
|
89
|
-
}
|
|
78
|
+
const WorkflowPane = () => {
|
|
79
|
+
return _react().default.createElement(_antd().Card, {
|
|
80
|
+
bordered: false
|
|
81
|
+
}, _react().default.createElement(_client().SchemaComponent, {
|
|
82
|
+
schema: _workflows.workflowSchema,
|
|
83
|
+
components: {
|
|
84
|
+
WorkflowLink: _WorkflowLink.WorkflowLink,
|
|
85
|
+
ExecutionResourceProvider: _ExecutionResourceProvider.ExecutionResourceProvider,
|
|
86
|
+
ExecutionLink: _ExecutionLink.ExecutionLink
|
|
90
87
|
}
|
|
91
|
-
}
|
|
88
|
+
}));
|
|
92
89
|
};
|
|
93
90
|
|
|
91
|
+
exports.WorkflowPane = WorkflowPane;
|
|
92
|
+
|
|
94
93
|
const WorkflowShortcut = () => {
|
|
95
94
|
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
96
95
|
t = _useTranslation.t;
|
|
97
96
|
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
visible = _useState2[0],
|
|
101
|
-
setVisible = _useState2[1];
|
|
102
|
-
|
|
103
|
-
return _react().default.createElement(_client().ActionContext.Provider, {
|
|
104
|
-
value: {
|
|
105
|
-
visible,
|
|
106
|
-
setVisible
|
|
107
|
-
}
|
|
108
|
-
}, _react().default.createElement(_client().PluginManager.Toolbar.Item, {
|
|
97
|
+
const history = (0, _reactRouterDom().useHistory)();
|
|
98
|
+
return _react().default.createElement(_client().PluginManager.Toolbar.Item, {
|
|
109
99
|
icon: _react().default.createElement(_icons().PartitionOutlined, null),
|
|
110
100
|
title: t('Workflow'),
|
|
111
101
|
onClick: () => {
|
|
112
|
-
|
|
102
|
+
history.push('/admin/settings/workflow/workflows');
|
|
113
103
|
}
|
|
114
|
-
})
|
|
115
|
-
schema: schema,
|
|
116
|
-
components: {
|
|
117
|
-
WorkflowLink: _WorkflowLink.WorkflowLink,
|
|
118
|
-
ExecutionResourceProvider: _ExecutionResourceProvider.ExecutionResourceProvider
|
|
119
|
-
}
|
|
120
|
-
}));
|
|
104
|
+
});
|
|
121
105
|
};
|
|
122
106
|
|
|
123
107
|
exports.WorkflowShortcut = WorkflowShortcut;
|
|
@@ -53,7 +53,7 @@ function _client() {
|
|
|
53
53
|
|
|
54
54
|
var _nodes = require("./nodes");
|
|
55
55
|
|
|
56
|
-
var
|
|
56
|
+
var _FlowContext = require("./FlowContext");
|
|
57
57
|
|
|
58
58
|
var _triggers = require("./triggers");
|
|
59
59
|
|
|
@@ -407,7 +407,7 @@ const VariableTypes = {
|
|
|
407
407
|
}) {
|
|
408
408
|
var _instruction$getter;
|
|
409
409
|
|
|
410
|
-
const _useFlowContext = (0,
|
|
410
|
+
const _useFlowContext = (0, _FlowContext.useFlowContext)(),
|
|
411
411
|
nodes = _useFlowContext.nodes;
|
|
412
412
|
|
|
413
413
|
if (!(options === null || options === void 0 ? void 0 : options.nodeId)) {
|
|
@@ -472,7 +472,7 @@ const VariableTypes = {
|
|
|
472
472
|
component() {
|
|
473
473
|
var _trigger$getter;
|
|
474
474
|
|
|
475
|
-
const _useFlowContext2 = (0,
|
|
475
|
+
const _useFlowContext2 = (0, _FlowContext.useFlowContext)(),
|
|
476
476
|
workflow = _useFlowContext2.workflow;
|
|
477
477
|
|
|
478
478
|
const trigger = _triggers.triggers.get(workflow.type);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const EXECUTION_STATUS: {
|
|
2
|
+
QUEUEING: any;
|
|
3
|
+
STARTED: number;
|
|
4
|
+
SUCCEEDED: number;
|
|
5
|
+
FAILED: number;
|
|
6
|
+
CANCELED: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const ExecutionStatusOptions: ({
|
|
9
|
+
value: any;
|
|
10
|
+
label: string;
|
|
11
|
+
color: string;
|
|
12
|
+
} | {
|
|
13
|
+
value: number;
|
|
14
|
+
label: string;
|
|
15
|
+
color?: undefined;
|
|
16
|
+
})[];
|
|
17
|
+
export declare const ExecutionStatusOptionsMap: {};
|
|
18
|
+
export declare const JOB_STATUS: {
|
|
19
|
+
PENDING: number;
|
|
20
|
+
RESOLVED: number;
|
|
21
|
+
REJECTED: number;
|
|
22
|
+
CANCELED: number;
|
|
23
|
+
};
|
|
24
|
+
export declare const JobStatusOptions: {
|
|
25
|
+
value: number;
|
|
26
|
+
label: string;
|
|
27
|
+
color: string;
|
|
28
|
+
icon: JSX.Element;
|
|
29
|
+
}[];
|
|
30
|
+
export declare const JobStatusOptionsMap: {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.JobStatusOptionsMap = exports.JobStatusOptions = exports.JOB_STATUS = exports.ExecutionStatusOptionsMap = exports.ExecutionStatusOptions = exports.EXECUTION_STATUS = void 0;
|
|
7
|
+
|
|
8
|
+
function _react() {
|
|
9
|
+
const data = _interopRequireDefault(require("react"));
|
|
10
|
+
|
|
11
|
+
_react = function _react() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _icons() {
|
|
19
|
+
const data = require("@ant-design/icons");
|
|
20
|
+
|
|
21
|
+
_icons = function _icons() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
+
|
|
30
|
+
const EXECUTION_STATUS = {
|
|
31
|
+
QUEUEING: null,
|
|
32
|
+
STARTED: 0,
|
|
33
|
+
SUCCEEDED: 1,
|
|
34
|
+
FAILED: -1,
|
|
35
|
+
CANCELED: -2
|
|
36
|
+
};
|
|
37
|
+
exports.EXECUTION_STATUS = EXECUTION_STATUS;
|
|
38
|
+
const ExecutionStatusOptions = [{
|
|
39
|
+
value: EXECUTION_STATUS.QUEUEING,
|
|
40
|
+
label: '{{t("Queueing")}}',
|
|
41
|
+
color: 'blue'
|
|
42
|
+
}, {
|
|
43
|
+
value: EXECUTION_STATUS.STARTED,
|
|
44
|
+
label: '{{t("On going")}}',
|
|
45
|
+
color: 'gold'
|
|
46
|
+
}, {
|
|
47
|
+
value: EXECUTION_STATUS.SUCCEEDED,
|
|
48
|
+
label: '{{t("Succeeded")}}',
|
|
49
|
+
color: 'green'
|
|
50
|
+
}, {
|
|
51
|
+
value: EXECUTION_STATUS.FAILED,
|
|
52
|
+
label: '{{t("Failed")}}',
|
|
53
|
+
color: 'red'
|
|
54
|
+
}, {
|
|
55
|
+
value: EXECUTION_STATUS.CANCELED,
|
|
56
|
+
label: '{{t("Canceled")}}'
|
|
57
|
+
}];
|
|
58
|
+
exports.ExecutionStatusOptions = ExecutionStatusOptions;
|
|
59
|
+
const ExecutionStatusOptionsMap = ExecutionStatusOptions.reduce((map, option) => Object.assign(map, {
|
|
60
|
+
[option.value]: option
|
|
61
|
+
}), {});
|
|
62
|
+
exports.ExecutionStatusOptionsMap = ExecutionStatusOptionsMap;
|
|
63
|
+
const JOB_STATUS = {
|
|
64
|
+
PENDING: 0,
|
|
65
|
+
RESOLVED: 1,
|
|
66
|
+
REJECTED: -1,
|
|
67
|
+
CANCELED: -2
|
|
68
|
+
};
|
|
69
|
+
exports.JOB_STATUS = JOB_STATUS;
|
|
70
|
+
const JobStatusOptions = [{
|
|
71
|
+
value: JOB_STATUS.PENDING,
|
|
72
|
+
label: '{{t("Pending")}}',
|
|
73
|
+
color: '#d4c306',
|
|
74
|
+
icon: _react().default.createElement(_icons().ClockCircleOutlined, null)
|
|
75
|
+
}, {
|
|
76
|
+
value: JOB_STATUS.RESOLVED,
|
|
77
|
+
label: '{{t("Succeeded")}}',
|
|
78
|
+
color: '#67c068',
|
|
79
|
+
icon: _react().default.createElement(_icons().CheckOutlined, null)
|
|
80
|
+
}, {
|
|
81
|
+
value: JOB_STATUS.REJECTED,
|
|
82
|
+
label: '{{t("Failed")}}',
|
|
83
|
+
color: '#f40',
|
|
84
|
+
icon: _react().default.createElement(_icons().ExclamationOutlined, null)
|
|
85
|
+
}, {
|
|
86
|
+
value: JOB_STATUS.CANCELED,
|
|
87
|
+
label: '{{t("Canceled")}}',
|
|
88
|
+
color: '#f40',
|
|
89
|
+
icon: _react().default.createElement(_icons().CloseOutlined, null)
|
|
90
|
+
}];
|
|
91
|
+
exports.JobStatusOptions = JobStatusOptions;
|
|
92
|
+
const JobStatusOptionsMap = JobStatusOptions.reduce((map, option) => Object.assign(map, {
|
|
93
|
+
[option.value]: option
|
|
94
|
+
}), {});
|
|
95
|
+
exports.JobStatusOptionsMap = JobStatusOptionsMap;
|