@nocobase/plugin-workflow 0.7.7-alpha.1 → 0.8.0-alpha.4

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.
Files changed (44) hide show
  1. package/lib/client/AddButton.d.ts +7 -0
  2. package/lib/client/AddButton.js +173 -0
  3. package/lib/client/Branch.d.ts +7 -0
  4. package/lib/client/Branch.js +61 -0
  5. package/lib/client/ExecutionCanvas.d.ts +2 -0
  6. package/lib/client/ExecutionCanvas.js +214 -0
  7. package/lib/client/ExecutionLink.d.ts +1 -0
  8. package/lib/client/ExecutionLink.js +66 -0
  9. package/lib/client/ExecutionPage.d.ts +1 -0
  10. package/lib/client/ExecutionPage.js +92 -0
  11. package/lib/client/FlowContext.d.ts +3 -0
  12. package/lib/client/FlowContext.js +29 -0
  13. package/lib/client/WorkflowCanvas.d.ts +0 -13
  14. package/lib/client/WorkflowCanvas.js +33 -142
  15. package/lib/client/WorkflowLink.js +1 -1
  16. package/lib/client/WorkflowPage.js +1 -1
  17. package/lib/client/WorkflowProvider.js +30 -10
  18. package/lib/client/WorkflowShortcut.d.ts +1 -0
  19. package/lib/client/WorkflowShortcut.js +36 -52
  20. package/lib/client/calculators.js +3 -3
  21. package/lib/client/constants.d.ts +30 -0
  22. package/lib/client/constants.js +95 -0
  23. package/lib/client/nodes/condition.js +6 -4
  24. package/lib/client/nodes/create.js +2 -2
  25. package/lib/client/nodes/index.d.ts +2 -1
  26. package/lib/client/nodes/index.js +168 -46
  27. package/lib/client/nodes/parallel.js +6 -4
  28. package/lib/client/nodes/query.js +2 -2
  29. package/lib/client/nodes/update.js +2 -2
  30. package/lib/client/schemas/executions.d.ts +22 -0
  31. package/lib/client/schemas/executions.js +75 -40
  32. package/lib/client/schemas/workflows.js +7 -5
  33. package/lib/client/style.js +44 -3
  34. package/lib/client/triggers/collection.js +2 -2
  35. package/lib/client/triggers/index.d.ts +3 -1
  36. package/lib/client/triggers/index.js +96 -13
  37. package/lib/client/triggers/schedule/index.js +2 -2
  38. package/lib/server/Plugin.d.ts +4 -5
  39. package/lib/server/Plugin.js +12 -16
  40. package/lib/server/actions/jobs.js +1 -1
  41. package/lib/server/actions/workflows.d.ts +1 -0
  42. package/lib/server/actions/workflows.js +37 -7
  43. package/lib/server/extensions/assignees/actions.js +1 -1
  44. package/package.json +9 -8
@@ -67,7 +67,9 @@ function _client() {
67
67
 
68
68
  var _ = require(".");
69
69
 
70
- var _WorkflowCanvas = require("../WorkflowCanvas");
70
+ var _Branch = require("../Branch");
71
+
72
+ var _FlowContext = require("../FlowContext");
71
73
 
72
74
  var _style = require("../style");
73
75
 
@@ -292,7 +294,7 @@ var _default = {
292
294
  const id = data.id,
293
295
  rejectOnFalse = data.config.rejectOnFalse;
294
296
 
295
- const _useFlowContext = (0, _WorkflowCanvas.useFlowContext)(),
297
+ const _useFlowContext = (0, _FlowContext.useFlowContext)(),
296
298
  nodes = _useFlowContext.nodes;
297
299
 
298
300
  const trueEntry = nodes.find(item => item.upstreamId === id && item.branchIndex === 1);
@@ -309,11 +311,11 @@ var _default = {
309
311
  }
310
312
  }
311
313
  `)
312
- }, _react().default.createElement(_WorkflowCanvas.Branch, {
314
+ }, _react().default.createElement(_Branch.Branch, {
313
315
  from: data,
314
316
  entry: falseEntry,
315
317
  branchIndex: 0
316
- }), _react().default.createElement(_WorkflowCanvas.Branch, {
318
+ }), _react().default.createElement(_Branch.Branch, {
317
319
  from: data,
318
320
  entry: trueEntry,
319
321
  branchIndex: 1
@@ -27,7 +27,7 @@ function _client() {
27
27
 
28
28
  var _collection = require("../schemas/collection");
29
29
 
30
- var _WorkflowCanvas = require("../WorkflowCanvas");
30
+ var _FlowContext = require("../FlowContext");
31
31
 
32
32
  var _CollectionFieldSelect = _interopRequireDefault(require("../components/CollectionFieldSelect"));
33
33
 
@@ -74,7 +74,7 @@ var _default = {
74
74
  options = props.options,
75
75
  _onChange = props.onChange;
76
76
 
77
- const _useFlowContext = (0, _WorkflowCanvas.useFlowContext)(),
77
+ const _useFlowContext = (0, _FlowContext.useFlowContext)(),
78
78
  nodes = _useFlowContext.nodes;
79
79
 
80
80
  const _nodes$find = nodes.find(n => n.id == options.nodeId),
@@ -1,6 +1,6 @@
1
+ import React from 'react';
1
2
  import { ISchema } from '@formily/react';
2
3
  import { Registry } from '@nocobase/utils/client';
3
- import React from 'react';
4
4
  export interface Instruction {
5
5
  title: string;
6
6
  type: string;
@@ -30,4 +30,5 @@ export declare function Node({ data }: {
30
30
  data: any;
31
31
  }): JSX.Element;
32
32
  export declare function RemoveButton(): JSX.Element;
33
+ export declare function JobButton(): JSX.Element;
33
34
  export declare function NodeDefaultView(props: any): JSX.Element;
@@ -3,46 +3,47 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.JobButton = JobButton;
6
7
  exports.Node = Node;
7
8
  exports.NodeDefaultView = NodeDefaultView;
8
9
  exports.RemoveButton = RemoveButton;
9
10
  exports.instructions = void 0;
10
11
  exports.useNodeContext = useNodeContext;
11
12
 
12
- function _icons() {
13
- const data = require("@ant-design/icons");
13
+ function _react() {
14
+ const data = _interopRequireWildcard(require("react"));
14
15
 
15
- _icons = function _icons() {
16
+ _react = function _react() {
16
17
  return data;
17
18
  };
18
19
 
19
20
  return data;
20
21
  }
21
22
 
22
- function _css() {
23
- const data = require("@emotion/css");
23
+ function _icons() {
24
+ const data = require("@ant-design/icons");
24
25
 
25
- _css = function _css() {
26
+ _icons = function _icons() {
26
27
  return data;
27
28
  };
28
29
 
29
30
  return data;
30
31
  }
31
32
 
32
- function _react() {
33
- const data = require("@formily/react");
33
+ function _css() {
34
+ const data = require("@emotion/css");
34
35
 
35
- _react = function _react() {
36
+ _css = function _css() {
36
37
  return data;
37
38
  };
38
39
 
39
40
  return data;
40
41
  }
41
42
 
42
- function _client() {
43
- const data = require("@nocobase/utils/client");
43
+ function _react2() {
44
+ const data = require("@formily/react");
44
45
 
45
- _client = function _client() {
46
+ _react2 = function _react2() {
46
47
  return data;
47
48
  };
48
49
 
@@ -59,20 +60,20 @@ function _antd() {
59
60
  return data;
60
61
  }
61
62
 
62
- function _react2() {
63
- const data = _interopRequireWildcard(require("react"));
63
+ function _reactI18next() {
64
+ const data = require("react-i18next");
64
65
 
65
- _react2 = function _react2() {
66
+ _reactI18next = function _reactI18next() {
66
67
  return data;
67
68
  };
68
69
 
69
70
  return data;
70
71
  }
71
72
 
72
- function _reactI18next() {
73
- const data = require("react-i18next");
73
+ function _client() {
74
+ const data = require("@nocobase/utils/client");
74
75
 
75
- _reactI18next = function _reactI18next() {
76
+ _client = function _client() {
76
77
  return data;
77
78
  };
78
79
 
@@ -91,7 +92,9 @@ function _client2() {
91
92
 
92
93
  var _style = require("../style");
93
94
 
94
- var _WorkflowCanvas = require("../WorkflowCanvas");
95
+ var _AddButton = require("../AddButton");
96
+
97
+ var _FlowContext = require("../FlowContext");
95
98
 
96
99
  var _calculation = _interopRequireDefault(require("./calculation"));
97
100
 
@@ -109,6 +112,8 @@ var _update = _interopRequireDefault(require("./update"));
109
112
 
110
113
  var _destroy = _interopRequireDefault(require("./destroy"));
111
114
 
115
+ var _constants = require("../constants");
116
+
112
117
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
113
118
 
114
119
  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); }
@@ -135,7 +140,7 @@ function useUpdateAction() {
135
140
  const _useTranslation = (0, _reactI18next().useTranslation)(),
136
141
  t = _useTranslation.t;
137
142
 
138
- const form = (0, _react().useForm)();
143
+ const form = (0, _react2().useForm)();
139
144
  const api = (0, _client2().useAPIClient)();
140
145
  const ctx = (0, _client2().useActionContext)();
141
146
 
@@ -144,7 +149,7 @@ function useUpdateAction() {
144
149
 
145
150
  const data = useNodeContext();
146
151
 
147
- const _useFlowContext = (0, _WorkflowCanvas.useFlowContext)(),
152
+ const _useFlowContext = (0, _FlowContext.useFlowContext)(),
148
153
  workflow = _useFlowContext.workflow;
149
154
 
150
155
  return {
@@ -175,25 +180,25 @@ function useUpdateAction() {
175
180
 
176
181
  ;
177
182
 
178
- const NodeContext = _react2().default.createContext(null);
183
+ const NodeContext = _react().default.createContext(null);
179
184
 
180
185
  function useNodeContext() {
181
- return (0, _react2().useContext)(NodeContext);
186
+ return (0, _react().useContext)(NodeContext);
182
187
  }
183
188
 
184
189
  function Node({
185
190
  data
186
191
  }) {
187
192
  const instruction = instructions.get(data.type);
188
- return _react2().default.createElement(NodeContext.Provider, {
193
+ return _react().default.createElement(NodeContext.Provider, {
189
194
  value: data
190
- }, _react2().default.createElement("div", {
195
+ }, _react().default.createElement("div", {
191
196
  className: (0, _css().cx)(_style.nodeBlockClass)
192
- }, instruction.render ? instruction.render(data) : _react2().default.createElement(NodeDefaultView, {
197
+ }, instruction.render ? instruction.render(data) : _react().default.createElement(NodeDefaultView, {
193
198
  data: data
194
- }), !instruction.endding ? _react2().default.createElement(_WorkflowCanvas.AddButton, {
199
+ }), !instruction.endding ? _react().default.createElement(_AddButton.AddButton, {
195
200
  upstream: data
196
- }) : _react2().default.createElement("div", {
201
+ }) : _react().default.createElement("div", {
197
202
  className: (0, _css().css)`
198
203
  flex-grow: 1;
199
204
  display: flex;
@@ -210,24 +215,29 @@ function Node({
210
215
  line-height: 100%;
211
216
  }
212
217
  `
213
- }, _react2().default.createElement(_icons().CloseOutlined, null))));
218
+ }, _react().default.createElement(_icons().CloseOutlined, null))));
214
219
  }
215
220
 
216
221
  function RemoveButton() {
222
+ var _useFlowContext2;
223
+
217
224
  const _useTranslation2 = (0, _reactI18next().useTranslation)(),
218
225
  t = _useTranslation2.t;
219
226
 
220
227
  const api = (0, _client2().useAPIClient)();
221
228
 
222
- const _useFlowContext2 = (0, _WorkflowCanvas.useFlowContext)(),
223
- workflow = _useFlowContext2.workflow;
229
+ const _ref = (_useFlowContext2 = (0, _FlowContext.useFlowContext)()) !== null && _useFlowContext2 !== void 0 ? _useFlowContext2 : {},
230
+ workflow = _ref.workflow,
231
+ nodes = _ref.nodes,
232
+ onNodeRemoved = _ref.onNodeRemoved;
224
233
 
225
- const resource = api.resource('workflows.nodes', workflow.id);
226
234
  const current = useNodeContext();
227
235
 
228
- const _useFlowContext3 = (0, _WorkflowCanvas.useFlowContext)(),
229
- nodes = _useFlowContext3.nodes,
230
- onNodeRemoved = _useFlowContext3.onNodeRemoved;
236
+ if (!workflow) {
237
+ return null;
238
+ }
239
+
240
+ const resource = api.resource('workflows.nodes', workflow.id);
231
241
 
232
242
  function onRemove() {
233
243
  return _onRemove.apply(this, arguments);
@@ -263,38 +273,150 @@ function RemoveButton() {
263
273
  return _onRemove.apply(this, arguments);
264
274
  }
265
275
 
266
- return workflow.executed ? null : _react2().default.createElement(_antd().Button, {
276
+ return workflow.executed ? null : _react().default.createElement(_antd().Button, {
267
277
  type: "text",
268
278
  shape: "circle",
269
- icon: _react2().default.createElement(_icons().DeleteOutlined, null),
279
+ icon: _react().default.createElement(_icons().DeleteOutlined, null),
270
280
  onClick: onRemove,
271
281
  className: "workflow-node-remove-button"
272
282
  });
273
283
  }
274
284
 
285
+ function JobButton() {
286
+ var _useNodeContext;
287
+
288
+ const _useTranslation3 = (0, _reactI18next().useTranslation)(),
289
+ t = _useTranslation3.t;
290
+
291
+ const compile = (0, _client2().useCompile)();
292
+
293
+ const _useFlowContext3 = (0, _FlowContext.useFlowContext)(),
294
+ execution = _useFlowContext3.execution;
295
+
296
+ const _ref2 = (_useNodeContext = useNodeContext()) !== null && _useNodeContext !== void 0 ? _useNodeContext : {},
297
+ id = _ref2.id,
298
+ type = _ref2.type,
299
+ title = _ref2.title,
300
+ job = _ref2.job;
301
+
302
+ if (!execution) {
303
+ return null;
304
+ }
305
+
306
+ if (!job) {
307
+ return _react().default.createElement("span", {
308
+ className: (0, _css().cx)('workflow-node-job-button', (0, _css().css)`
309
+ border: 2px solid #d9d9d9;
310
+ border-radius: 50%;
311
+ `)
312
+ });
313
+ }
314
+
315
+ const instruction = instructions.get(type);
316
+ const _JobStatusOptionsMap$ = _constants.JobStatusOptionsMap[job.status],
317
+ value = _JobStatusOptionsMap$.value,
318
+ icon = _JobStatusOptionsMap$.icon,
319
+ color = _JobStatusOptionsMap$.color;
320
+ return _react().default.createElement(_client2().SchemaComponent, {
321
+ schema: {
322
+ type: 'void',
323
+ properties: {
324
+ [job.id]: {
325
+ type: 'void',
326
+ 'x-component': 'Action',
327
+ 'x-component-props': {
328
+ title: icon,
329
+ shape: 'circle',
330
+ className: ['workflow-node-job-button', (0, _css().css)`
331
+ background-color: ${color};
332
+ &:hover,&:focus{
333
+ background-color: ${color}
334
+ }
335
+ `]
336
+ },
337
+ properties: {
338
+ [job.id]: {
339
+ type: 'void',
340
+ 'x-decorator': 'Form',
341
+ 'x-decorator-props': {
342
+ initialValue: job
343
+ },
344
+ 'x-component': 'Action.Modal',
345
+ title: _react().default.createElement("div", {
346
+ className: (0, _css().cx)(_style.nodeTitleClass)
347
+ }, _react().default.createElement(_antd().Tag, null, compile(instruction.title)), _react().default.createElement("strong", null, title), _react().default.createElement("span", {
348
+ className: "workflow-node-id"
349
+ }, "#", id)),
350
+ properties: {
351
+ status: {
352
+ type: 'number',
353
+ title: '{{t("Status")}}',
354
+ 'x-decorator': 'FormItem',
355
+ 'x-component': 'Select',
356
+ enum: _constants.JobStatusOptions,
357
+ 'x-read-pretty': true
358
+ },
359
+ updatedAt: {
360
+ type: 'string',
361
+ title: '{{t("Executed at")}}',
362
+ 'x-decorator': 'FormItem',
363
+ 'x-component': 'DatePicker',
364
+ 'x-component-props': {
365
+ showTime: true
366
+ },
367
+ 'x-read-pretty': true
368
+ },
369
+ result: {
370
+ type: 'object',
371
+ title: '{{t("Node result")}}',
372
+ 'x-decorator': 'FormItem',
373
+ 'x-component': 'Input.JSON',
374
+ 'x-component-props': {
375
+ className: (0, _css().css)`
376
+ padding: 1em;
377
+ background-color: #eee;
378
+ `
379
+ },
380
+ 'x-read-pretty': true
381
+ }
382
+ }
383
+ }
384
+ }
385
+ }
386
+ }
387
+ }
388
+ });
389
+ }
390
+
275
391
  function NodeDefaultView(props) {
392
+ var _useFlowContext4;
393
+
276
394
  const compile = (0, _client2().useCompile)();
277
395
 
278
- const _useFlowContext4 = (0, _WorkflowCanvas.useFlowContext)(),
279
- workflow = _useFlowContext4.workflow;
396
+ const _ref3 = (_useFlowContext4 = (0, _FlowContext.useFlowContext)()) !== null && _useFlowContext4 !== void 0 ? _useFlowContext4 : {},
397
+ workflow = _ref3.workflow;
398
+
399
+ if (!workflow) {
400
+ return null;
401
+ }
280
402
 
281
403
  const data = props.data,
282
404
  children = props.children;
283
405
  const instruction = instructions.get(data.type);
284
406
  const detailText = workflow.executed ? '{{t("View")}}' : '{{t("Configure")}}';
285
- return _react2().default.createElement("div", {
407
+ return _react().default.createElement("div", {
286
408
  className: (0, _css().cx)(_style.nodeClass, `workflow-node-type-${data.type}`)
287
- }, _react2().default.createElement("div", {
409
+ }, _react().default.createElement("div", {
288
410
  className: (0, _css().cx)(_style.nodeCardClass)
289
- }, _react2().default.createElement("div", {
411
+ }, _react().default.createElement("div", {
290
412
  className: (0, _css().cx)(_style.nodeHeaderClass)
291
- }, _react2().default.createElement("div", {
413
+ }, _react().default.createElement("div", {
292
414
  className: (0, _css().cx)(_style.nodeMetaClass)
293
- }, _react2().default.createElement(_antd().Tag, null, compile(instruction.title))), _react2().default.createElement("h4", {
415
+ }, _react().default.createElement(_antd().Tag, null, compile(instruction.title))), _react().default.createElement("h4", {
294
416
  className: (0, _css().cx)(_style.nodeTitleClass)
295
- }, _react2().default.createElement("strong", null, data.title), _react2().default.createElement("span", {
417
+ }, _react().default.createElement("strong", null, data.title), _react().default.createElement("span", {
296
418
  className: "workflow-node-id"
297
- }, "#", data.id)), _react2().default.createElement(RemoveButton, null)), _react2().default.createElement(_client2().SchemaComponent, {
419
+ }, "#", data.id)), _react().default.createElement(RemoveButton, null), _react().default.createElement(JobButton, null)), _react().default.createElement(_client2().SchemaComponent, {
298
420
  scope: instruction.scope,
299
421
  components: instruction.components,
300
422
  schema: {
@@ -67,7 +67,9 @@ function _client() {
67
67
 
68
68
  var _2 = require(".");
69
69
 
70
- var _WorkflowCanvas = require("../WorkflowCanvas");
70
+ var _Branch = require("../Branch");
71
+
72
+ var _FlowContext = require("../FlowContext");
71
73
 
72
74
  var _style = require("../style");
73
75
 
@@ -142,7 +144,7 @@ var _default = {
142
144
  const _useTranslation = (0, _reactI18next().useTranslation)(),
143
145
  t = _useTranslation.t;
144
146
 
145
- const _useFlowContext = (0, _WorkflowCanvas.useFlowContext)(),
147
+ const _useFlowContext = (0, _FlowContext.useFlowContext)(),
146
148
  nodes = _useFlowContext.nodes;
147
149
 
148
150
  const branches = nodes.reduce((result, node) => {
@@ -166,12 +168,12 @@ var _default = {
166
168
  className: (0, _css().cx)(_style.nodeSubtreeClass)
167
169
  }, _react().default.createElement("div", {
168
170
  className: (0, _css().cx)(_style.branchBlockClass)
169
- }, branches.map(branch => _react().default.createElement(_WorkflowCanvas.Branch, {
171
+ }, branches.map(branch => _react().default.createElement(_Branch.Branch, {
170
172
  key: branch.id,
171
173
  from: data,
172
174
  entry: branch,
173
175
  branchIndex: branch.branchIndex
174
- })), tempBranches.map((_, i) => _react().default.createElement(_WorkflowCanvas.Branch, {
176
+ })), tempBranches.map((_, i) => _react().default.createElement(_Branch.Branch, {
175
177
  key: `temp_${branches.length + i}`,
176
178
  from: data,
177
179
  branchIndex: (lastBranchHead ? lastBranchHead.branchIndex : 0) + i + 1,
@@ -25,7 +25,7 @@ function _client() {
25
25
  return data;
26
26
  }
27
27
 
28
- var _WorkflowCanvas = require("../WorkflowCanvas");
28
+ var _FlowContext = require("../FlowContext");
29
29
 
30
30
  var _calculators = require("../calculators");
31
31
 
@@ -80,7 +80,7 @@ var _default = {
80
80
  options = props.options,
81
81
  _onChange = props.onChange;
82
82
 
83
- const _useFlowContext = (0, _WorkflowCanvas.useFlowContext)(),
83
+ const _useFlowContext = (0, _FlowContext.useFlowContext)(),
84
84
  nodes = _useFlowContext.nodes;
85
85
 
86
86
  const _nodes$find = nodes.find(n => n.id == options.nodeId),
@@ -17,10 +17,10 @@ function _client() {
17
17
 
18
18
  var _calculators = require("../calculators");
19
19
 
20
- var _collection = require("../schemas/collection");
21
-
22
20
  var _CollectionFieldset = _interopRequireDefault(require("../components/CollectionFieldset"));
23
21
 
22
+ var _collection = require("../schemas/collection");
23
+
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
25
 
26
26
  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; }
@@ -72,6 +72,7 @@ export declare const executionSchema: {
72
72
  resource: string;
73
73
  action: string;
74
74
  params: {
75
+ appends: string[];
75
76
  pageSize: number;
76
77
  sort: string[];
77
78
  };
@@ -202,6 +203,27 @@ export declare const executionSchema: {
202
203
  };
203
204
  };
204
205
  };
206
+ actions: {
207
+ type: string;
208
+ title: string;
209
+ 'x-component': string;
210
+ properties: {
211
+ actions: {
212
+ type: string;
213
+ 'x-component': string;
214
+ 'x-component-props': {
215
+ split: string;
216
+ };
217
+ properties: {
218
+ config: {
219
+ type: string;
220
+ title: string;
221
+ 'x-component': string;
222
+ };
223
+ };
224
+ };
225
+ };
226
+ };
205
227
  };
206
228
  };
207
229
  };
@@ -4,6 +4,41 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.executionSchema = 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 _reactRouterDom() {
19
+ const data = require("react-router-dom");
20
+
21
+ _reactRouterDom = function _reactRouterDom() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _client() {
29
+ const data = require("@nocobase/client");
30
+
31
+ _client = function _client() {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ var _constants = require("../constants");
39
+
40
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
+
7
42
  const collection = {
8
43
  name: 'executions',
9
44
  fields: [{
@@ -13,20 +48,31 @@ const collection = {
13
48
  name: 'createdAt',
14
49
  uiSchema: {
15
50
  type: 'datetime',
16
- title: '{{t("Created at")}}',
51
+ title: '{{t("Triggered at")}}',
17
52
  'x-component': 'DatePicker',
18
53
  'x-component-props': {},
19
54
  'x-read-pretty': true
20
55
  }
21
56
  }, {
22
- interface: 'number',
23
- type: 'number',
57
+ interface: 'object',
58
+ type: 'belongsTo',
24
59
  name: 'workflowId',
25
60
  uiSchema: {
26
61
  type: 'number',
27
62
  title: '{{t("Version")}}',
28
- 'x-component': 'InputNumber',
29
- 'x-read-pretty': true
63
+
64
+ ['x-component']({
65
+ value
66
+ }) {
67
+ const _useActionContext = (0, _client().useActionContext)(),
68
+ setVisible = _useActionContext.setVisible;
69
+
70
+ return _react().default.createElement(_reactRouterDom().Link, {
71
+ to: `/admin/settings/workflow/workflows/${value}`,
72
+ onClick: () => setVisible(false)
73
+ }, `#${value}`);
74
+ }
75
+
30
76
  }
31
77
  }, {
32
78
  type: 'number',
@@ -37,19 +83,7 @@ const collection = {
37
83
  type: 'string',
38
84
  'x-component': 'Select',
39
85
  'x-decorator': 'FormItem',
40
- enum: [{
41
- value: 0,
42
- label: '{{t("On going")}}'
43
- }, {
44
- value: 1,
45
- label: '{{t("Succeeded")}}'
46
- }, {
47
- value: -1,
48
- label: '{{t("Failed")}}'
49
- }, {
50
- value: -2,
51
- label: '{{t("Canceled")}}'
52
- }]
86
+ enum: _constants.ExecutionStatusOptions
53
87
  }
54
88
  }]
55
89
  };
@@ -64,6 +98,7 @@ const executionSchema = {
64
98
  resource: 'executions',
65
99
  action: 'list',
66
100
  params: {
101
+ appends: ['workflow.id', 'workflow.title'],
67
102
  pageSize: 50,
68
103
  sort: ['-createdAt']
69
104
  }
@@ -134,28 +169,28 @@ const executionSchema = {
134
169
  'x-read-pretty': true
135
170
  }
136
171
  }
137
- } // actions: {
138
- // type: 'void',
139
- // title: '{{ t("Actions") }}',
140
- // 'x-component': 'Table.Column',
141
- // properties: {
142
- // actions: {
143
- // type: 'void',
144
- // 'x-component': 'Space',
145
- // 'x-component-props': {
146
- // split: '|',
147
- // },
148
- // properties: {
149
- // config: {
150
- // type: 'void',
151
- // title: '查看',
152
- // 'x-component': 'ExecutionLink'
153
- // },
154
- // }
155
- // }
156
- // }
157
- // }
158
-
172
+ },
173
+ actions: {
174
+ type: 'void',
175
+ title: '{{ t("Actions") }}',
176
+ 'x-component': 'Table.Column',
177
+ properties: {
178
+ actions: {
179
+ type: 'void',
180
+ 'x-component': 'Space',
181
+ 'x-component-props': {
182
+ split: '|'
183
+ },
184
+ properties: {
185
+ config: {
186
+ type: 'void',
187
+ title: '{{t("Details")}}',
188
+ 'x-component': 'ExecutionLink'
189
+ }
190
+ }
191
+ }
192
+ }
193
+ }
159
194
  }
160
195
  }
161
196
  }