@nocobase/plugin-workflow 0.7.6-alpha.2 → 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 (45) 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 +13 -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/lib/server/triggers/schedule.js +25 -15
  45. package/package.json +9 -8
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ interface AddButtonProps {
3
+ upstream: any;
4
+ branchIndex?: number;
5
+ }
6
+ export declare function AddButton({ upstream, branchIndex }: AddButtonProps): JSX.Element;
7
+ export {};
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AddButton = AddButton;
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 _css() {
19
+ const data = require("@emotion/css");
20
+
21
+ _css = function _css() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _antd() {
29
+ const data = require("antd");
30
+
31
+ _antd = function _antd() {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ function _icons() {
39
+ const data = require("@ant-design/icons");
40
+
41
+ _icons = function _icons() {
42
+ return data;
43
+ };
44
+
45
+ return data;
46
+ }
47
+
48
+ function _client() {
49
+ const data = require("@nocobase/client");
50
+
51
+ _client = function _client() {
52
+ return data;
53
+ };
54
+
55
+ return data;
56
+ }
57
+
58
+ var _FlowContext = require("./FlowContext");
59
+
60
+ var _nodes = require("./nodes");
61
+
62
+ var _style = require("./style");
63
+
64
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
65
+
66
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
67
+
68
+ 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."); }
69
+
70
+ 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); }
71
+
72
+ 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; }
73
+
74
+ 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; }
75
+
76
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
77
+
78
+ 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); } }
79
+
80
+ 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); }); }; }
81
+
82
+ ;
83
+
84
+ function AddButton({
85
+ upstream,
86
+ branchIndex = null
87
+ }) {
88
+ var _useFlowContext;
89
+
90
+ const compile = (0, _client().useCompile)();
91
+ const api = (0, _client().useAPIClient)();
92
+
93
+ const _ref = (_useFlowContext = (0, _FlowContext.useFlowContext)()) !== null && _useFlowContext !== void 0 ? _useFlowContext : {},
94
+ workflow = _ref.workflow,
95
+ onNodeAdded = _ref.onNodeAdded;
96
+
97
+ if (!workflow) {
98
+ return null;
99
+ }
100
+
101
+ const resource = api.resource('workflows.nodes', workflow.id);
102
+
103
+ function onCreate(_x) {
104
+ return _onCreate.apply(this, arguments);
105
+ }
106
+
107
+ function _onCreate() {
108
+ _onCreate = _asyncToGenerator(function* ({
109
+ keyPath
110
+ }) {
111
+ var _upstream$id;
112
+
113
+ const type = keyPath.pop();
114
+ const config = {};
115
+
116
+ const _keyPath = _slicedToArray(keyPath, 1),
117
+ optionKey = _keyPath[0];
118
+
119
+ if (optionKey) {
120
+ const _instructions$get$opt = _nodes.instructions.get(type).options.find(item => item.key === optionKey),
121
+ value = _instructions$get$opt.value;
122
+
123
+ Object.assign(config, value);
124
+ }
125
+
126
+ const _yield$resource$creat = yield resource.create({
127
+ values: {
128
+ type,
129
+ upstreamId: (_upstream$id = upstream === null || upstream === void 0 ? void 0 : upstream.id) !== null && _upstream$id !== void 0 ? _upstream$id : null,
130
+ branchIndex,
131
+ config
132
+ }
133
+ }),
134
+ node = _yield$resource$creat.data.data;
135
+
136
+ onNodeAdded(node);
137
+ });
138
+ return _onCreate.apply(this, arguments);
139
+ }
140
+
141
+ const groups = [{
142
+ value: 'control',
143
+ name: '{{t("Control")}}'
144
+ }, {
145
+ value: 'collection',
146
+ name: '{{t("Collection operations")}}'
147
+ }];
148
+ const instructionList = Array.from(_nodes.instructions.getValues());
149
+ return _react().default.createElement("div", {
150
+ className: (0, _css().cx)(_style.addButtonClass)
151
+ }, _react().default.createElement(_antd().Dropdown, {
152
+ trigger: ['click'],
153
+ overlay: _react().default.createElement(_antd().Menu, {
154
+ onClick: ev => onCreate(ev)
155
+ }, groups.map(group => _react().default.createElement(_antd().Menu.ItemGroup, {
156
+ key: group.value,
157
+ title: compile(group.name)
158
+ }, instructionList.filter(item => item.group === group.value).map(item => item.options ? _react().default.createElement(_antd().Menu.SubMenu, {
159
+ key: item.type,
160
+ title: compile(item.title)
161
+ }, item.options.map(option => _react().default.createElement(_antd().Menu.Item, {
162
+ key: option.key
163
+ }, compile(option.label)))) : _react().default.createElement(_antd().Menu.Item, {
164
+ key: item.type
165
+ }, compile(item.title)))))),
166
+ disabled: workflow.executed
167
+ }, _react().default.createElement(_antd().Button, {
168
+ shape: "circle",
169
+ icon: _react().default.createElement(_icons().PlusOutlined, null)
170
+ })));
171
+ }
172
+
173
+ ;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare function Branch({ from, entry, branchIndex, controller }: {
3
+ from?: any;
4
+ entry?: any;
5
+ branchIndex?: any;
6
+ controller?: any;
7
+ }): JSX.Element;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Branch = Branch;
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 _css() {
19
+ const data = require("@emotion/css");
20
+
21
+ _css = function _css() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ var _style = require("./style");
29
+
30
+ var _AddButton = require("./AddButton");
31
+
32
+ var _nodes = require("./nodes");
33
+
34
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
+
36
+ function Branch({
37
+ from = null,
38
+ entry = null,
39
+ branchIndex = null,
40
+ controller = null
41
+ }) {
42
+ const list = [];
43
+
44
+ for (let node = entry; node; node = node.downstream) {
45
+ list.push(node);
46
+ }
47
+
48
+ return _react().default.createElement("div", {
49
+ className: (0, _css().cx)(_style.branchClass)
50
+ }, _react().default.createElement("div", {
51
+ className: "workflow-branch-lines"
52
+ }), controller, _react().default.createElement(_AddButton.AddButton, {
53
+ upstream: from,
54
+ branchIndex: branchIndex
55
+ }), _react().default.createElement("div", {
56
+ className: "workflow-node-list"
57
+ }, list.map(item => _react().default.createElement(_nodes.Node, {
58
+ data: item,
59
+ key: item.id
60
+ }))));
61
+ }
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function ExecutionCanvas(): JSX.Element;
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ExecutionCanvas = ExecutionCanvas;
7
+
8
+ function _react() {
9
+ const data = _interopRequireWildcard(require("react"));
10
+
11
+ _react = function _react() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _antd() {
19
+ const data = require("antd");
20
+
21
+ _antd = function _antd() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _css() {
29
+ const data = require("@emotion/css");
30
+
31
+ _css = function _css() {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ function _reactI18next() {
39
+ const data = require("react-i18next");
40
+
41
+ _reactI18next = function _reactI18next() {
42
+ return data;
43
+ };
44
+
45
+ return data;
46
+ }
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
+
58
+ function _client() {
59
+ const data = require("@nocobase/client");
60
+
61
+ _client = function _client() {
62
+ return data;
63
+ };
64
+
65
+ return data;
66
+ }
67
+
68
+ function _client2() {
69
+ const data = require("@nocobase/utils/client");
70
+
71
+ _client2 = function _client2() {
72
+ return data;
73
+ };
74
+
75
+ return data;
76
+ }
77
+
78
+ var _FlowContext = require("./FlowContext");
79
+
80
+ var _style = require("./style");
81
+
82
+ var _triggers = require("./triggers");
83
+
84
+ var _Branch = require("./Branch");
85
+
86
+ var _constants = require("./constants");
87
+
88
+ const _excluded = ["nodes", "revisions"],
89
+ _excluded2 = ["jobs", "workflow"];
90
+
91
+ 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); }
92
+
93
+ 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; }
94
+
95
+ 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; }
96
+
97
+ 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; }
98
+
99
+ 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; } } }; }
100
+
101
+ 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); }
102
+
103
+ 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; }
104
+
105
+ function makeNodes(nodes, jobs = []) {
106
+ const nodesMap = new Map();
107
+ nodes.forEach(item => nodesMap.set(item.id, item));
108
+ const jobsMap = new Map();
109
+ jobs.forEach(item => jobsMap.set(item.nodeId, item));
110
+
111
+ var _iterator = _createForOfIteratorHelper(nodesMap.values()),
112
+ _step;
113
+
114
+ try {
115
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
116
+ let node = _step.value;
117
+
118
+ if (node.upstreamId) {
119
+ node.upstream = nodesMap.get(node.upstreamId);
120
+ }
121
+
122
+ if (node.downstreamId) {
123
+ node.downstream = nodesMap.get(node.downstreamId);
124
+ }
125
+
126
+ if (jobsMap.has(node.id)) {
127
+ node.job = jobsMap.get(node.id);
128
+ }
129
+ }
130
+ } catch (err) {
131
+ _iterator.e(err);
132
+ } finally {
133
+ _iterator.f();
134
+ }
135
+ }
136
+
137
+ function ExecutionCanvas() {
138
+ var _data$data2;
139
+
140
+ const _useTranslation = (0, _reactI18next().useTranslation)(),
141
+ t = _useTranslation.t;
142
+
143
+ const compile = (0, _client().useCompile)();
144
+
145
+ const _useResourceActionCon = (0, _client().useResourceActionContext)(),
146
+ data = _useResourceActionCon.data,
147
+ refresh = _useResourceActionCon.refresh,
148
+ loading = _useResourceActionCon.loading;
149
+
150
+ const _useDocumentTitle = (0, _client().useDocumentTitle)(),
151
+ setTitle = _useDocumentTitle.setTitle;
152
+
153
+ (0, _react().useEffect)(() => {
154
+ var _data$data;
155
+
156
+ const _ref = (_data$data = data === null || data === void 0 ? void 0 : data.data) !== null && _data$data !== void 0 ? _data$data : {},
157
+ workflow = _ref.workflow;
158
+
159
+ setTitle(`${(workflow === null || workflow === void 0 ? void 0 : workflow.title) ? `${workflow.title} - ` : ''}${t('Execution history')}`);
160
+ }, [data === null || data === void 0 ? void 0 : data.data]);
161
+
162
+ if (!(data === null || data === void 0 ? void 0 : data.data)) {
163
+ if (loading) {
164
+ return _react().default.createElement("div", null, t('Loading'));
165
+ } else {
166
+ return _react().default.createElement("div", null, t('Load failed'));
167
+ }
168
+ }
169
+
170
+ const _ref2 = (_data$data2 = data === null || data === void 0 ? void 0 : data.data) !== null && _data$data2 !== void 0 ? _data$data2 : {},
171
+ _ref2$jobs = _ref2.jobs,
172
+ jobs = _ref2$jobs === void 0 ? [] : _ref2$jobs,
173
+ _ref2$workflow = _ref2.workflow,
174
+ _ref2$workflow2 = _ref2$workflow === void 0 ? {} : _ref2$workflow,
175
+ _ref2$workflow2$nodes = _ref2$workflow2.nodes,
176
+ nodes = _ref2$workflow2$nodes === void 0 ? [] : _ref2$workflow2$nodes,
177
+ _ref2$workflow2$revis = _ref2$workflow2.revisions,
178
+ revisions = _ref2$workflow2$revis === void 0 ? [] : _ref2$workflow2$revis,
179
+ workflow = _objectWithoutProperties(_ref2$workflow2, _excluded),
180
+ execution = _objectWithoutProperties(_ref2, _excluded2);
181
+
182
+ makeNodes(nodes, jobs);
183
+ const entry = nodes.find(item => !item.upstream);
184
+ const statusOption = _constants.ExecutionStatusOptionsMap[execution.status];
185
+ return _react().default.createElement(_FlowContext.FlowContext.Provider, {
186
+ value: {
187
+ workflow: workflow.type ? workflow : null,
188
+ nodes,
189
+ execution
190
+ }
191
+ }, _react().default.createElement("div", {
192
+ className: "workflow-toolbar"
193
+ }, _react().default.createElement("header", null, _react().default.createElement("span", null, _react().default.createElement(_reactRouterDom().Link, {
194
+ to: `/admin/settings/workflow/workflows`
195
+ }, t('Workflow'))), _react().default.createElement("span", null, _react().default.createElement(_reactRouterDom().Link, {
196
+ to: `/admin/settings/workflow/workflows/${workflow.id}`
197
+ }, workflow.title)), _react().default.createElement("strong", null, `#${execution.id}`)), _react().default.createElement("aside", null, _react().default.createElement(_antd().Tag, {
198
+ color: statusOption.color
199
+ }, compile(statusOption.label)), _react().default.createElement("time", null, (0, _client2().str2moment)(execution.updatedAt).format('YYYY-MM-DD HH:mm:ss')))), _react().default.createElement("div", {
200
+ className: "workflow-canvas"
201
+ }, _react().default.createElement(_triggers.TriggerConfig, {
202
+ workflow: workflow
203
+ }), _react().default.createElement("div", {
204
+ className: _style.branchBlockClass
205
+ }, _react().default.createElement(_Branch.Branch, {
206
+ entry: entry
207
+ })), _react().default.createElement("div", {
208
+ className: (0, _css().cx)(_style.nodeCardClass)
209
+ }, _react().default.createElement("div", {
210
+ className: (0, _css().cx)(_style.nodeMetaClass)
211
+ }, _react().default.createElement(_antd().Tag, {
212
+ color: "#333"
213
+ }, t('End'))))));
214
+ }
@@ -0,0 +1 @@
1
+ export declare const ExecutionLink: () => JSX.Element;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ExecutionLink = 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 _reactI18next() {
19
+ const data = require("react-i18next");
20
+
21
+ _reactI18next = function _reactI18next() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _reactRouterDom() {
29
+ const data = require("react-router-dom");
30
+
31
+ _reactRouterDom = function _reactRouterDom() {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ function _client() {
39
+ const data = require("@nocobase/client");
40
+
41
+ _client = function _client() {
42
+ return data;
43
+ };
44
+
45
+ return data;
46
+ }
47
+
48
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
49
+
50
+ const ExecutionLink = () => {
51
+ const _useTranslation = (0, _reactI18next().useTranslation)(),
52
+ t = _useTranslation.t;
53
+
54
+ const _useRecord = (0, _client().useRecord)(),
55
+ id = _useRecord.id;
56
+
57
+ const _useActionContext = (0, _client().useActionContext)(),
58
+ setVisible = _useActionContext.setVisible;
59
+
60
+ return _react().default.createElement(_reactRouterDom().Link, {
61
+ to: `/admin/settings/workflow/executions/${id}`,
62
+ onClick: () => setVisible(false)
63
+ }, t('View'));
64
+ };
65
+
66
+ exports.ExecutionLink = ExecutionLink;
@@ -0,0 +1 @@
1
+ export declare const ExecutionPage: () => JSX.Element;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ExecutionPage = 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 _css() {
19
+ const data = require("@emotion/css");
20
+
21
+ _css = function _css() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _reactRouterDom() {
29
+ const data = require("react-router-dom");
30
+
31
+ _reactRouterDom = function _reactRouterDom() {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ function _client() {
39
+ const data = require("@nocobase/client");
40
+
41
+ _client = function _client() {
42
+ return data;
43
+ };
44
+
45
+ return data;
46
+ }
47
+
48
+ var _style = require("./style");
49
+
50
+ var _ExecutionCanvas = require("./ExecutionCanvas");
51
+
52
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
53
+
54
+ const ExecutionPage = () => {
55
+ const _useRouteMatch = (0, _reactRouterDom().useRouteMatch)(),
56
+ params = _useRouteMatch.params;
57
+
58
+ return _react().default.createElement("div", {
59
+ className: (0, _css().cx)(_style.workflowPageClass)
60
+ }, _react().default.createElement(_client().SchemaComponent, {
61
+ schema: {
62
+ type: 'void',
63
+ properties: {
64
+ [`execution_${params.id}`]: {
65
+ type: 'void',
66
+ 'x-decorator': 'ResourceActionProvider',
67
+ 'x-decorator-props': {
68
+ collection: {
69
+ name: 'executions',
70
+ fields: []
71
+ },
72
+ resourceName: 'executions',
73
+ request: {
74
+ resource: 'executions',
75
+ action: 'get',
76
+ params: {
77
+ filter: params,
78
+ appends: ['jobs', 'workflow', 'workflow.nodes']
79
+ }
80
+ }
81
+ },
82
+ 'x-component': 'ExecutionCanvas'
83
+ }
84
+ }
85
+ },
86
+ components: {
87
+ ExecutionCanvas: _ExecutionCanvas.ExecutionCanvas
88
+ }
89
+ }));
90
+ };
91
+
92
+ exports.ExecutionPage = ExecutionPage;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ export declare const FlowContext: React.Context<any>;
3
+ export declare function useFlowContext(): any;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FlowContext = void 0;
7
+ exports.useFlowContext = useFlowContext;
8
+
9
+ function _react() {
10
+ const data = _interopRequireWildcard(require("react"));
11
+
12
+ _react = function _react() {
13
+ return data;
14
+ };
15
+
16
+ return data;
17
+ }
18
+
19
+ 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); }
20
+
21
+ 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; }
22
+
23
+ const FlowContext = _react().default.createContext(null);
24
+
25
+ exports.FlowContext = FlowContext;
26
+
27
+ function useFlowContext() {
28
+ return (0, _react().useContext)(FlowContext);
29
+ }
@@ -1,15 +1,2 @@
1
1
  /// <reference types="react" />
2
- export declare function useFlowContext(): any;
3
2
  export declare function WorkflowCanvas(): JSX.Element;
4
- export declare function Branch({ from, entry, branchIndex, controller }: {
5
- from?: any;
6
- entry?: any;
7
- branchIndex?: any;
8
- controller?: any;
9
- }): JSX.Element;
10
- interface AddButtonProps {
11
- upstream: any;
12
- branchIndex?: number;
13
- }
14
- export declare function AddButton({ upstream, branchIndex }: AddButtonProps): JSX.Element;
15
- export {};