@nocobase/plugin-workflow 0.9.2-alpha.4 → 0.9.4-alpha.1
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/CanvasContent.d.ts +4 -0
- package/lib/client/CanvasContent.js +49 -0
- package/lib/client/ExecutionCanvas.js +110 -44
- package/lib/client/WorkflowCanvas.js +35 -18
- package/lib/client/components/CollectionFieldset.js +2 -2
- package/lib/client/components/FieldsSelect.js +2 -1
- package/lib/client/components/NodeDescription.d.ts +2 -0
- package/lib/client/components/NodeDescription.js +59 -0
- package/lib/client/components/ValueBlock.d.ts +5 -0
- package/lib/client/components/ValueBlock.js +110 -0
- package/lib/client/index.d.ts +1 -0
- package/lib/client/index.js +12 -0
- package/lib/client/locale/es-ES.d.ts +130 -0
- package/lib/client/locale/es-ES.js +136 -0
- package/lib/client/locale/zh-CN.d.ts +35 -6
- package/lib/client/locale/zh-CN.js +35 -6
- package/lib/client/nodes/aggregate.d.ts +186 -0
- package/lib/client/nodes/aggregate.js +349 -0
- package/lib/client/nodes/calculation.d.ts +2 -1
- package/lib/client/nodes/calculation.js +35 -60
- package/lib/client/nodes/condition.d.ts +2 -6
- package/lib/client/nodes/condition.js +4 -3
- package/lib/client/nodes/create.d.ts +6 -3
- package/lib/client/nodes/create.js +16 -7
- package/lib/client/nodes/delay.d.ts +1 -0
- package/lib/client/nodes/delay.js +1 -0
- package/lib/client/nodes/destroy.d.ts +3 -2
- package/lib/client/nodes/destroy.js +1 -0
- package/lib/client/nodes/index.d.ts +5 -2
- package/lib/client/nodes/index.js +96 -105
- package/lib/client/nodes/loop.d.ts +29 -0
- package/lib/client/nodes/loop.js +165 -0
- package/lib/client/nodes/manual/AssigneesSelect.js +8 -6
- package/lib/client/nodes/manual/WorkflowTodo.js +1 -8
- package/lib/client/nodes/manual/index.d.ts +6 -1
- package/lib/client/nodes/manual/index.js +6 -1
- package/lib/client/nodes/parallel.d.ts +1 -0
- package/lib/client/nodes/parallel.js +2 -1
- package/lib/client/nodes/query.d.ts +13 -3
- package/lib/client/nodes/query.js +24 -17
- package/lib/client/nodes/request.d.ts +1 -0
- package/lib/client/nodes/request.js +1 -0
- package/lib/client/nodes/update.d.ts +3 -2
- package/lib/client/nodes/update.js +1 -0
- package/lib/client/schemas/collection.d.ts +2 -2
- package/lib/client/schemas/collection.js +5 -5
- package/lib/client/style.d.ts +1 -0
- package/lib/client/style.js +40 -26
- package/lib/client/triggers/collection.d.ts +4 -11
- package/lib/client/triggers/collection.js +7 -7
- package/lib/client/triggers/index.d.ts +1 -1
- package/lib/client/triggers/index.js +5 -3
- package/lib/client/triggers/schedule/index.d.ts +3 -1
- package/lib/client/triggers/schedule/index.js +6 -4
- package/lib/client/variable.d.ts +27 -1
- package/lib/client/variable.js +66 -35
- package/lib/server/Plugin.d.ts +5 -2
- package/lib/server/Plugin.js +2 -14
- package/lib/server/Processor.d.ts +3 -0
- package/lib/server/Processor.js +34 -8
- package/lib/server/actions/workflows.js +2 -2
- package/lib/server/collections/workflows.js +2 -1
- package/lib/server/functions/index.d.ts +7 -1
- package/lib/server/instructions/aggregate.d.ts +9 -0
- package/lib/server/instructions/aggregate.js +57 -0
- package/lib/server/instructions/calculation.js +6 -7
- package/lib/server/instructions/condition.js +1 -1
- package/lib/server/instructions/create.js +1 -1
- package/lib/server/instructions/destroy.js +1 -1
- package/lib/server/instructions/index.d.ts +1 -0
- package/lib/server/instructions/index.js +1 -1
- package/lib/server/instructions/loop.d.ts +16 -0
- package/lib/server/instructions/loop.js +107 -0
- package/lib/server/instructions/parallel.js +17 -10
- package/lib/server/instructions/query.js +1 -4
- package/lib/server/instructions/request.js +1 -1
- package/lib/server/instructions/update.js +1 -1
- package/package.json +13 -14
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CanvasContent = CanvasContent;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = _interopRequireDefault(require("react"));
|
|
9
|
+
_react = function _react() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _antd() {
|
|
15
|
+
const data = require("antd");
|
|
16
|
+
_antd = function _antd() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _css() {
|
|
22
|
+
const data = require("@emotion/css");
|
|
23
|
+
_css = function _css() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
var _Branch = require("./Branch");
|
|
29
|
+
var _locale = require("./locale");
|
|
30
|
+
var _style = require("./style");
|
|
31
|
+
var _triggers = require("./triggers");
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
+
function CanvasContent({
|
|
34
|
+
entry
|
|
35
|
+
}) {
|
|
36
|
+
return _react().default.createElement("div", {
|
|
37
|
+
className: "workflow-canvas"
|
|
38
|
+
}, _react().default.createElement(_triggers.TriggerConfig, null), _react().default.createElement("div", {
|
|
39
|
+
className: _style.branchBlockClass
|
|
40
|
+
}, _react().default.createElement(_Branch.Branch, {
|
|
41
|
+
entry: entry
|
|
42
|
+
})), _react().default.createElement("div", {
|
|
43
|
+
className: (0, _css().cx)('end', _style.nodeCardClass)
|
|
44
|
+
}, _react().default.createElement("div", {
|
|
45
|
+
className: (0, _css().cx)(_style.nodeMetaClass)
|
|
46
|
+
}, _react().default.createElement(_antd().Tag, {
|
|
47
|
+
color: "#333"
|
|
48
|
+
}, (0, _locale.lang)('End')))));
|
|
49
|
+
}
|
|
@@ -48,39 +48,109 @@ function _client2() {
|
|
|
48
48
|
}
|
|
49
49
|
var _FlowContext = require("./FlowContext");
|
|
50
50
|
var _style = require("./style");
|
|
51
|
-
var _triggers = require("./triggers");
|
|
52
|
-
var _Branch = require("./Branch");
|
|
53
51
|
var _constants = require("./constants");
|
|
54
52
|
var _locale = require("./locale");
|
|
55
53
|
var _utils = require("./utils");
|
|
54
|
+
var _nodes = require("./nodes");
|
|
55
|
+
var _CanvasContent = require("./CanvasContent");
|
|
56
56
|
const _excluded = ["nodes", "revisions"],
|
|
57
57
|
_excluded2 = ["jobs", "workflow"];
|
|
58
58
|
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); }
|
|
59
59
|
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; }
|
|
60
60
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
61
61
|
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; }
|
|
62
|
-
function
|
|
62
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
63
|
+
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."); }
|
|
63
64
|
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); }
|
|
64
65
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
66
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
67
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
65
68
|
function attachJobs(nodes, jobs = []) {
|
|
66
69
|
const nodesMap = new Map();
|
|
67
|
-
nodes.forEach(item =>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
nodes.forEach(item => {
|
|
71
|
+
item.jobs = [];
|
|
72
|
+
nodesMap.set(item.id, item);
|
|
73
|
+
});
|
|
74
|
+
jobs.forEach(item => {
|
|
75
|
+
const node = nodesMap.get(item.nodeId);
|
|
76
|
+
node.jobs.push(item);
|
|
77
|
+
item.node = {
|
|
78
|
+
id: node.id,
|
|
79
|
+
title: node.title,
|
|
80
|
+
type: node.type
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
nodes.forEach(item => {
|
|
84
|
+
item.jobs = item.jobs.sort((a, b) => a.id - b.id);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function JobModal() {
|
|
88
|
+
const compile = (0, _client().useCompile)();
|
|
89
|
+
const _useFlowContext = (0, _FlowContext.useFlowContext)(),
|
|
90
|
+
job = _useFlowContext.viewJob,
|
|
91
|
+
setViewJob = _useFlowContext.setViewJob;
|
|
92
|
+
const _ref = job !== null && job !== void 0 ? job : {},
|
|
93
|
+
_ref$node = _ref.node,
|
|
94
|
+
node = _ref$node === void 0 ? {} : _ref$node;
|
|
95
|
+
const instruction = _nodes.instructions.get(node.type);
|
|
96
|
+
return _react().default.createElement(_client().ActionContext.Provider, {
|
|
97
|
+
value: {
|
|
98
|
+
visible: Boolean(job),
|
|
99
|
+
setVisible: setViewJob
|
|
100
|
+
}
|
|
101
|
+
}, _react().default.createElement(_client().SchemaComponent, {
|
|
102
|
+
schema: {
|
|
103
|
+
type: 'void',
|
|
104
|
+
properties: {
|
|
105
|
+
[`${job === null || job === void 0 ? void 0 : job.id}-modal`]: {
|
|
106
|
+
type: 'void',
|
|
107
|
+
'x-decorator': 'Form',
|
|
108
|
+
'x-decorator-props': {
|
|
109
|
+
initialValue: job
|
|
110
|
+
},
|
|
111
|
+
'x-component': 'Action.Modal',
|
|
112
|
+
title: _react().default.createElement("div", {
|
|
113
|
+
className: _style.nodeTitleClass
|
|
114
|
+
}, _react().default.createElement(_antd().Tag, null, compile(instruction === null || instruction === void 0 ? void 0 : instruction.title)), _react().default.createElement("strong", null, node.title), _react().default.createElement("span", {
|
|
115
|
+
className: "workflow-node-id"
|
|
116
|
+
}, "#", node.id)),
|
|
117
|
+
properties: {
|
|
118
|
+
status: {
|
|
119
|
+
type: 'number',
|
|
120
|
+
title: `{{t("Status", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
121
|
+
'x-decorator': 'FormItem',
|
|
122
|
+
'x-component': 'Select',
|
|
123
|
+
enum: _constants.JobStatusOptions,
|
|
124
|
+
'x-read-pretty': true
|
|
125
|
+
},
|
|
126
|
+
updatedAt: {
|
|
127
|
+
type: 'string',
|
|
128
|
+
title: `{{t("Executed at", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
129
|
+
'x-decorator': 'FormItem',
|
|
130
|
+
'x-component': 'DatePicker',
|
|
131
|
+
'x-component-props': {
|
|
132
|
+
showTime: true
|
|
133
|
+
},
|
|
134
|
+
'x-read-pretty': true
|
|
135
|
+
},
|
|
136
|
+
result: {
|
|
137
|
+
type: 'object',
|
|
138
|
+
title: `{{t("Node result", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
139
|
+
'x-decorator': 'FormItem',
|
|
140
|
+
'x-component': 'Input.JSON',
|
|
141
|
+
'x-component-props': {
|
|
142
|
+
className: (0, _css().css)`
|
|
143
|
+
padding: 1em;
|
|
144
|
+
background-color: #eee;
|
|
145
|
+
`
|
|
146
|
+
},
|
|
147
|
+
'x-read-pretty': true
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
77
151
|
}
|
|
78
152
|
}
|
|
79
|
-
}
|
|
80
|
-
_iterator.e(err);
|
|
81
|
-
} finally {
|
|
82
|
-
_iterator.f();
|
|
83
|
-
}
|
|
153
|
+
}));
|
|
84
154
|
}
|
|
85
155
|
function ExecutionCanvas() {
|
|
86
156
|
var _data$data2;
|
|
@@ -90,10 +160,14 @@ function ExecutionCanvas() {
|
|
|
90
160
|
loading = _useResourceActionCon.loading;
|
|
91
161
|
const _useDocumentTitle = (0, _client().useDocumentTitle)(),
|
|
92
162
|
setTitle = _useDocumentTitle.setTitle;
|
|
163
|
+
const _useState = (0, _react().useState)(null),
|
|
164
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
165
|
+
viewJob = _useState2[0],
|
|
166
|
+
setViewJob = _useState2[1];
|
|
93
167
|
(0, _react().useEffect)(() => {
|
|
94
168
|
var _data$data;
|
|
95
|
-
const
|
|
96
|
-
workflow =
|
|
169
|
+
const _ref2 = (_data$data = data === null || data === void 0 ? void 0 : data.data) !== null && _data$data !== void 0 ? _data$data : {},
|
|
170
|
+
workflow = _ref2.workflow;
|
|
97
171
|
setTitle === null || setTitle === void 0 ? void 0 : setTitle(`${(workflow === null || workflow === void 0 ? void 0 : workflow.title) ? `${workflow.title} - ` : ''}${(0, _locale.lang)('Execution history')}`);
|
|
98
172
|
}, [data === null || data === void 0 ? void 0 : data.data]);
|
|
99
173
|
if (!(data === null || data === void 0 ? void 0 : data.data)) {
|
|
@@ -103,17 +177,17 @@ function ExecutionCanvas() {
|
|
|
103
177
|
return _react().default.createElement("div", null, (0, _locale.lang)('Load failed'));
|
|
104
178
|
}
|
|
105
179
|
}
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
jobs =
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
nodes =
|
|
113
|
-
|
|
114
|
-
revisions =
|
|
115
|
-
workflow = _objectWithoutProperties(
|
|
116
|
-
execution = _objectWithoutProperties(
|
|
180
|
+
const _ref3 = (_data$data2 = data === null || data === void 0 ? void 0 : data.data) !== null && _data$data2 !== void 0 ? _data$data2 : {},
|
|
181
|
+
_ref3$jobs = _ref3.jobs,
|
|
182
|
+
jobs = _ref3$jobs === void 0 ? [] : _ref3$jobs,
|
|
183
|
+
_ref3$workflow = _ref3.workflow,
|
|
184
|
+
_ref3$workflow2 = _ref3$workflow === void 0 ? {} : _ref3$workflow,
|
|
185
|
+
_ref3$workflow2$nodes = _ref3$workflow2.nodes,
|
|
186
|
+
nodes = _ref3$workflow2$nodes === void 0 ? [] : _ref3$workflow2$nodes,
|
|
187
|
+
_ref3$workflow2$revis = _ref3$workflow2.revisions,
|
|
188
|
+
revisions = _ref3$workflow2$revis === void 0 ? [] : _ref3$workflow2$revis,
|
|
189
|
+
workflow = _objectWithoutProperties(_ref3$workflow2, _excluded),
|
|
190
|
+
execution = _objectWithoutProperties(_ref3, _excluded2);
|
|
117
191
|
(0, _utils.linkNodes)(nodes);
|
|
118
192
|
attachJobs(nodes, jobs);
|
|
119
193
|
const entry = nodes.find(item => !item.upstream);
|
|
@@ -122,7 +196,9 @@ function ExecutionCanvas() {
|
|
|
122
196
|
value: {
|
|
123
197
|
workflow: workflow.type ? workflow : null,
|
|
124
198
|
nodes,
|
|
125
|
-
execution
|
|
199
|
+
execution,
|
|
200
|
+
viewJob,
|
|
201
|
+
setViewJob
|
|
126
202
|
}
|
|
127
203
|
}, _react().default.createElement("div", {
|
|
128
204
|
className: "workflow-toolbar"
|
|
@@ -132,17 +208,7 @@ function ExecutionCanvas() {
|
|
|
132
208
|
to: `/admin/settings/workflow/workflows/${workflow.id}`
|
|
133
209
|
}, workflow.title)), _react().default.createElement(_antd().Breadcrumb.Item, null, _react().default.createElement("strong", null, `#${execution.id}`)))), _react().default.createElement("aside", null, _react().default.createElement(_antd().Tag, {
|
|
134
210
|
color: statusOption.color
|
|
135
|
-
}, compile(statusOption.label)), _react().default.createElement("time", null, (0, _client2().str2moment)(execution.updatedAt).format('YYYY-MM-DD HH:mm:ss')))), _react().default.createElement(
|
|
136
|
-
className: "workflow-canvas"
|
|
137
|
-
}, _react().default.createElement(_triggers.TriggerConfig, null), _react().default.createElement("div", {
|
|
138
|
-
className: _style.branchBlockClass
|
|
139
|
-
}, _react().default.createElement(_Branch.Branch, {
|
|
211
|
+
}, compile(statusOption.label)), _react().default.createElement("time", null, (0, _client2().str2moment)(execution.updatedAt).format('YYYY-MM-DD HH:mm:ss')))), _react().default.createElement(_CanvasContent.CanvasContent, {
|
|
140
212
|
entry: entry
|
|
141
|
-
})
|
|
142
|
-
className: (0, _css().cx)(_style.nodeCardClass)
|
|
143
|
-
}, _react().default.createElement("div", {
|
|
144
|
-
className: (0, _css().cx)(_style.nodeMetaClass)
|
|
145
|
-
}, _react().default.createElement(_antd().Tag, {
|
|
146
|
-
color: "#333"
|
|
147
|
-
}, (0, _locale.lang)('End'))))));
|
|
213
|
+
}), _react().default.createElement(JobModal, null));
|
|
148
214
|
}
|
|
@@ -62,12 +62,11 @@ function _client() {
|
|
|
62
62
|
}
|
|
63
63
|
var _FlowContext = require("./FlowContext");
|
|
64
64
|
var _style = require("./style");
|
|
65
|
-
var _triggers = require("./triggers");
|
|
66
|
-
var _Branch = require("./Branch");
|
|
67
65
|
var _executions = require("./schemas/executions");
|
|
68
66
|
var _ExecutionLink = require("./ExecutionLink");
|
|
69
67
|
var _locale = require("./locale");
|
|
70
68
|
var _utils = require("./utils");
|
|
69
|
+
var _CanvasContent = require("./CanvasContent");
|
|
71
70
|
const _excluded = ["request", "filter"],
|
|
72
71
|
_excluded2 = ["nodes", "revisions"];
|
|
73
72
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -180,6 +179,29 @@ function WorkflowCanvas() {
|
|
|
180
179
|
});
|
|
181
180
|
return _onRevision.apply(this, arguments);
|
|
182
181
|
}
|
|
182
|
+
function onDelete() {
|
|
183
|
+
return _onDelete.apply(this, arguments);
|
|
184
|
+
}
|
|
185
|
+
function _onDelete() {
|
|
186
|
+
_onDelete = _asyncToGenerator(function* () {
|
|
187
|
+
const content = workflow.current ? (0, _locale.lang)('Delete a main version will cause all other revisions to be deleted too.') : '';
|
|
188
|
+
_antd().Modal.confirm({
|
|
189
|
+
title: t('Are you sure you want to delete it?'),
|
|
190
|
+
content,
|
|
191
|
+
onOk() {
|
|
192
|
+
return _asyncToGenerator(function* () {
|
|
193
|
+
var _revisions$find;
|
|
194
|
+
yield resource.destroy({
|
|
195
|
+
filterByTk: workflow.id
|
|
196
|
+
});
|
|
197
|
+
_antd().message.success(t('Operation succeeded'));
|
|
198
|
+
history.push(workflow.current ? '..' : `${(_revisions$find = revisions.find(item => item.current)) === null || _revisions$find === void 0 ? void 0 : _revisions$find.id}`);
|
|
199
|
+
})();
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
return _onDelete.apply(this, arguments);
|
|
204
|
+
}
|
|
183
205
|
function onMenuCommand(_x3) {
|
|
184
206
|
return _onMenuCommand.apply(this, arguments);
|
|
185
207
|
}
|
|
@@ -193,6 +215,8 @@ function WorkflowCanvas() {
|
|
|
193
215
|
return;
|
|
194
216
|
case 'revision':
|
|
195
217
|
return onRevision();
|
|
218
|
+
case 'delete':
|
|
219
|
+
return onDelete();
|
|
196
220
|
default:
|
|
197
221
|
break;
|
|
198
222
|
}
|
|
@@ -214,7 +238,7 @@ function WorkflowCanvas() {
|
|
|
214
238
|
className: "workflow-versions"
|
|
215
239
|
}, _react().default.createElement(_antd().Dropdown, {
|
|
216
240
|
trigger: ['click'],
|
|
217
|
-
|
|
241
|
+
menu: {
|
|
218
242
|
onClick: onSwitchVersion,
|
|
219
243
|
defaultSelectedKeys: [`${workflow.id}`],
|
|
220
244
|
className: (0, _css().cx)(_style.workflowVersionDropdownClass),
|
|
@@ -229,7 +253,7 @@ function WorkflowCanvas() {
|
|
|
229
253
|
})
|
|
230
254
|
}, _react().default.createElement("strong", null, `#${item.id}`), _react().default.createElement("time", null, new Date(item.createdAt).toLocaleString()))
|
|
231
255
|
}))
|
|
232
|
-
}
|
|
256
|
+
}
|
|
233
257
|
}, _react().default.createElement(_antd().Button, {
|
|
234
258
|
type: "text"
|
|
235
259
|
}, _react().default.createElement("label", null, (0, _locale.lang)('Version')), _react().default.createElement("span", null, (workflow === null || workflow === void 0 ? void 0 : workflow.id) ? `#${workflow.id}` : null), _react().default.createElement(_icons().DownOutlined, null)))), _react().default.createElement(_antd().Switch, {
|
|
@@ -238,7 +262,7 @@ function WorkflowCanvas() {
|
|
|
238
262
|
checkedChildren: (0, _locale.lang)('On'),
|
|
239
263
|
unCheckedChildren: (0, _locale.lang)('Off')
|
|
240
264
|
}), _react().default.createElement(_antd().Dropdown, {
|
|
241
|
-
|
|
265
|
+
menu: {
|
|
242
266
|
items: [{
|
|
243
267
|
key: 'history',
|
|
244
268
|
label: (0, _locale.lang)('Execution history'),
|
|
@@ -247,9 +271,12 @@ function WorkflowCanvas() {
|
|
|
247
271
|
key: 'revision',
|
|
248
272
|
label: (0, _locale.lang)('Copy to new version'),
|
|
249
273
|
disabled: !revisionable
|
|
274
|
+
}, {
|
|
275
|
+
key: 'delete',
|
|
276
|
+
label: t('Delete')
|
|
250
277
|
}],
|
|
251
278
|
onClick: onMenuCommand
|
|
252
|
-
}
|
|
279
|
+
}
|
|
253
280
|
}, _react().default.createElement(_antd().Button, {
|
|
254
281
|
type: "text",
|
|
255
282
|
icon: _react().default.createElement(_icons().EllipsisOutlined, null)
|
|
@@ -264,17 +291,7 @@ function WorkflowCanvas() {
|
|
|
264
291
|
ExecutionResourceProvider,
|
|
265
292
|
ExecutionLink: _ExecutionLink.ExecutionLink
|
|
266
293
|
}
|
|
267
|
-
})))), _react().default.createElement(
|
|
268
|
-
className: "workflow-canvas"
|
|
269
|
-
}, _react().default.createElement(_triggers.TriggerConfig, null), _react().default.createElement("div", {
|
|
270
|
-
className: _style.branchBlockClass
|
|
271
|
-
}, _react().default.createElement(_Branch.Branch, {
|
|
294
|
+
})))), _react().default.createElement(_CanvasContent.CanvasContent, {
|
|
272
295
|
entry: entry
|
|
273
|
-
}))
|
|
274
|
-
className: (0, _css().cx)('end', _style.nodeCardClass)
|
|
275
|
-
}, _react().default.createElement("div", {
|
|
276
|
-
className: (0, _css().cx)(_style.nodeMetaClass)
|
|
277
|
-
}, _react().default.createElement(_antd().Tag, {
|
|
278
|
-
color: "#333"
|
|
279
|
-
}, (0, _locale.lang)('End'))))));
|
|
296
|
+
}));
|
|
280
297
|
}
|
|
@@ -103,7 +103,7 @@ var _default = (0, _react2().observer)(({
|
|
|
103
103
|
const fields = getCollectionFields(collectionName).filter(field => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false) &&
|
|
104
104
|
// TODO: should use some field option but not type to control this
|
|
105
105
|
!['formula'].includes(field.type));
|
|
106
|
-
const unassignedFields = fields.filter(field => !(field.name in value));
|
|
106
|
+
const unassignedFields = fields.filter(field => !value || !(field.name in value));
|
|
107
107
|
const scope = (0, _variable.useWorkflowVariableOptions)();
|
|
108
108
|
const mergedDisabled = disabled || form.disabled;
|
|
109
109
|
return _react().default.createElement("fieldset", {
|
|
@@ -120,7 +120,7 @@ var _default = (0, _react2().observer)(({
|
|
|
120
120
|
`
|
|
121
121
|
}, fields.length ? _react().default.createElement(_client().CollectionProvider, {
|
|
122
122
|
collection: getCollection(collectionName)
|
|
123
|
-
}, fields.filter(field => field.name in value).map(field => {
|
|
123
|
+
}, fields.filter(field => value && field.name in value).map(field => {
|
|
124
124
|
var _field$uiSchema$title, _field$uiSchema;
|
|
125
125
|
// constant for associations to use Input, others to use CollectionField
|
|
126
126
|
// dynamic values only support belongsTo/hasOne association, other association type should disable
|
|
@@ -52,7 +52,8 @@ const FieldsSelect = (0, _react2().observer)(props => {
|
|
|
52
52
|
values = _useForm.values;
|
|
53
53
|
const fields = getCollectionFields(values === null || values === void 0 ? void 0 : values.collection);
|
|
54
54
|
return _react().default.createElement(_antd().Select, _objectSpread(_objectSpread({
|
|
55
|
-
className: "full-width"
|
|
55
|
+
className: "full-width",
|
|
56
|
+
dropdownMatchSelectWidth: false
|
|
56
57
|
}, others), {}, {
|
|
57
58
|
options: fields.filter(filter).map(field => {
|
|
58
59
|
var _field$uiSchema;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NodeDescription = NodeDescription;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = _interopRequireDefault(require("react"));
|
|
9
|
+
_react = function _react() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _css() {
|
|
15
|
+
const data = require("@emotion/css");
|
|
16
|
+
_css = function _css() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _antd() {
|
|
22
|
+
const data = require("antd");
|
|
23
|
+
_antd = function _antd() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
var _locale = require("../locale");
|
|
29
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
+
function NodeDescription(props) {
|
|
31
|
+
const instruction = props.instruction;
|
|
32
|
+
const className = (0, _css().css)`
|
|
33
|
+
margin-bottom: 1.5em;
|
|
34
|
+
padding: 1em;
|
|
35
|
+
background: #f6f6f6;
|
|
36
|
+
|
|
37
|
+
> *:last-child {
|
|
38
|
+
margin-bottom: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
dl {
|
|
42
|
+
display: flex;
|
|
43
|
+
|
|
44
|
+
dt {
|
|
45
|
+
&:after {
|
|
46
|
+
content: ':';
|
|
47
|
+
margin-right: 0.5em;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
p {
|
|
53
|
+
color: rgba(0, 0, 0, 0.45);
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
return _react().default.createElement("div", {
|
|
57
|
+
className: (0, _css().cx)(className, props.className)
|
|
58
|
+
}, _react().default.createElement("dl", null, _react().default.createElement("dt", null, (0, _locale.lang)('Node type')), _react().default.createElement("dd", null, _react().default.createElement(_antd().Tag, null, instruction.title))), instruction.description ? _react().default.createElement("p", null, instruction.description) : null);
|
|
59
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ValueBlock = void 0;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = _interopRequireDefault(require("react"));
|
|
9
|
+
_react = function _react() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _react2() {
|
|
15
|
+
const data = require("@formily/react");
|
|
16
|
+
_react2 = function _react2() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _css() {
|
|
22
|
+
const data = require("@emotion/css");
|
|
23
|
+
_css = function _css() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _client() {
|
|
29
|
+
const data = require("@nocobase/utils/client");
|
|
30
|
+
_client = function _client() {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _client2() {
|
|
36
|
+
const data = require("@nocobase/client");
|
|
37
|
+
_client2 = function _client2() {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
var _FlowContext = require("../FlowContext");
|
|
43
|
+
const _excluded = ["node", "resultTitle", "insert"];
|
|
44
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
46
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
47
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
48
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
49
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
50
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
51
|
+
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; }
|
|
52
|
+
const ValueBlock = () => {
|
|
53
|
+
return null;
|
|
54
|
+
};
|
|
55
|
+
exports.ValueBlock = ValueBlock;
|
|
56
|
+
function Initializer(_ref) {
|
|
57
|
+
let node = _ref.node,
|
|
58
|
+
resultTitle = _ref.resultTitle,
|
|
59
|
+
insert = _ref.insert,
|
|
60
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
61
|
+
return _react().default.createElement(_client2().SchemaInitializer.Item, _objectSpread(_objectSpread({}, props), {}, {
|
|
62
|
+
onClick: () => {
|
|
63
|
+
var _node$title;
|
|
64
|
+
insert({
|
|
65
|
+
type: 'void',
|
|
66
|
+
name: node.id,
|
|
67
|
+
title: node.title,
|
|
68
|
+
'x-component': 'CardItem',
|
|
69
|
+
'x-component-props': {
|
|
70
|
+
title: (_node$title = node.title) !== null && _node$title !== void 0 ? _node$title : `#${node.id}`
|
|
71
|
+
},
|
|
72
|
+
'x-designer': 'SimpleDesigner',
|
|
73
|
+
properties: {
|
|
74
|
+
result: {
|
|
75
|
+
type: 'void',
|
|
76
|
+
title: resultTitle,
|
|
77
|
+
'x-component': 'ValueBlock.Result',
|
|
78
|
+
'x-component-props': {
|
|
79
|
+
// NOTE: as same format as other reference for migration of revision
|
|
80
|
+
dataSource: `{{$jobsMapByNodeId.${node.id}}}`
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
function Result({
|
|
89
|
+
dataSource
|
|
90
|
+
}) {
|
|
91
|
+
var _execution$jobs;
|
|
92
|
+
const field = (0, _react2().useFieldSchema)();
|
|
93
|
+
const _useFlowContext = (0, _FlowContext.useFlowContext)(),
|
|
94
|
+
execution = _useFlowContext.execution;
|
|
95
|
+
if (!execution) {
|
|
96
|
+
return field.title;
|
|
97
|
+
}
|
|
98
|
+
const result = (0, _client().parse)(dataSource)({
|
|
99
|
+
$jobsMapByNodeId: ((_execution$jobs = execution.jobs) !== null && _execution$jobs !== void 0 ? _execution$jobs : []).reduce((map, job) => Object.assign(map, {
|
|
100
|
+
[job.nodeId]: job.result
|
|
101
|
+
}), {})
|
|
102
|
+
});
|
|
103
|
+
return _react().default.createElement("pre", {
|
|
104
|
+
className: (0, _css().css)`
|
|
105
|
+
margin: 0;
|
|
106
|
+
`
|
|
107
|
+
}, JSON.stringify(result, null, 2));
|
|
108
|
+
}
|
|
109
|
+
ValueBlock.Initializer = Initializer;
|
|
110
|
+
ValueBlock.Result = Result;
|
package/lib/client/index.d.ts
CHANGED
package/lib/client/index.js
CHANGED
|
@@ -43,4 +43,16 @@ Object.keys(_FlowContext).forEach(function (key) {
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
+
var _Branch = require("./Branch");
|
|
47
|
+
Object.keys(_Branch).forEach(function (key) {
|
|
48
|
+
if (key === "default" || key === "__esModule") return;
|
|
49
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
50
|
+
if (key in exports && exports[key] === _Branch[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function get() {
|
|
54
|
+
return _Branch[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
46
58
|
var _WorkflowProvider = require("./WorkflowProvider");
|