ronds-metadata 1.2.98 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/es/api/index.d.ts +10 -0
- package/es/api/index.js +62 -1
- package/es/comps/DynamicPorts/comps/NodeElement.js +36 -4
- package/es/comps/DynamicPorts/comps/NodeStatus.d.ts +8 -0
- package/es/comps/DynamicPorts/comps/NodeStatus.js +56 -0
- package/es/comps/DynamicPorts/graph.d.ts +16 -0
- package/es/comps/DynamicPorts/graph.js +187 -58
- package/es/comps/DynamicPorts/index.d.ts +4 -0
- package/es/comps/DynamicPorts/index.js +6 -1
- package/es/comps/DynamicPorts/index.less +9 -4
- package/es/comps/DynamicPorts/interface.d.ts +11 -0
- package/es/comps/DynamicPorts/interface.js +1 -1
- package/es/framework/graph/index.js +1 -1
- package/es/framework/metadata/MetadataService.d.ts +4 -0
- package/es/framework/metadata/MetadataService.js +39 -1
- package/es/framework/metadata/types.d.ts +6 -1
- package/package.json +1 -1
package/es/api/index.d.ts
CHANGED
@@ -16,4 +16,14 @@ export default class Api implements IAPI {
|
|
16
16
|
SaveMetadata(data: any, metadataTag: string): Promise<any>;
|
17
17
|
GetMetadataObjList(data: any): Promise<any>;
|
18
18
|
GetEnumDataByUrl(url: string, method: 'get' | 'post', body?: any): Promise<any>;
|
19
|
+
GetGraphStatus(data: any): Promise<{
|
20
|
+
data: {
|
21
|
+
instStatus: {};
|
22
|
+
execInfo: {};
|
23
|
+
status: string;
|
24
|
+
};
|
25
|
+
}>;
|
26
|
+
StopGraphRun(data: any): Promise<{
|
27
|
+
success: boolean;
|
28
|
+
}>;
|
19
29
|
}
|
package/es/api/index.js
CHANGED
@@ -5,7 +5,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
5
|
/*
|
6
6
|
* @Author:wangxian
|
7
7
|
* @Date: 2021-09-18 14:15:04
|
8
|
-
* @LastEditTime: 2023-
|
8
|
+
* @LastEditTime: 2023-08-22 17:22:47
|
9
9
|
*/
|
10
10
|
import { guid, md5 } from '../utils';
|
11
11
|
import { addInterceptor, HttpHelper } from '../framework/http';
|
@@ -28,6 +28,7 @@ addInterceptor(function (httpClient) {
|
|
28
28
|
return _config;
|
29
29
|
});
|
30
30
|
});
|
31
|
+
var idx = 0;
|
31
32
|
var Api = /*#__PURE__*/function () {
|
32
33
|
function Api() {
|
33
34
|
_classCallCheck(this, Api);
|
@@ -194,6 +195,66 @@ var Api = /*#__PURE__*/function () {
|
|
194
195
|
return _GetEnumDataByUrl.apply(this, arguments);
|
195
196
|
}
|
196
197
|
return GetEnumDataByUrl;
|
198
|
+
}() // 获取元数据的值
|
199
|
+
}, {
|
200
|
+
key: "GetGraphStatus",
|
201
|
+
value: function () {
|
202
|
+
var _GetGraphStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data) {
|
203
|
+
var nodes, _execInfo, _instStatus, i, obj;
|
204
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
205
|
+
while (1) switch (_context6.prev = _context6.next) {
|
206
|
+
case 0:
|
207
|
+
idx++;
|
208
|
+
nodes = data.nodes;
|
209
|
+
_execInfo = {};
|
210
|
+
_instStatus = {};
|
211
|
+
for (i = 0; i < nodes.length; i++) {
|
212
|
+
obj = {
|
213
|
+
jobStatus: idx === 2 ? 'success' : 'running',
|
214
|
+
id: nodes[i].id
|
215
|
+
};
|
216
|
+
_execInfo[nodes[i].id] = obj;
|
217
|
+
_instStatus[nodes[i].id] = idx === 2 ? 'success' : 'running';
|
218
|
+
}
|
219
|
+
return _context6.abrupt("return", {
|
220
|
+
data: {
|
221
|
+
instStatus: _instStatus,
|
222
|
+
execInfo: _execInfo,
|
223
|
+
status: idx === 2 ? 'default' : 'running'
|
224
|
+
}
|
225
|
+
});
|
226
|
+
case 6:
|
227
|
+
case "end":
|
228
|
+
return _context6.stop();
|
229
|
+
}
|
230
|
+
}, _callee6);
|
231
|
+
}));
|
232
|
+
function GetGraphStatus(_x9) {
|
233
|
+
return _GetGraphStatus.apply(this, arguments);
|
234
|
+
}
|
235
|
+
return GetGraphStatus;
|
236
|
+
}()
|
237
|
+
}, {
|
238
|
+
key: "StopGraphRun",
|
239
|
+
value: function () {
|
240
|
+
var _StopGraphRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
|
241
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
242
|
+
while (1) switch (_context7.prev = _context7.next) {
|
243
|
+
case 0:
|
244
|
+
idx = 0;
|
245
|
+
return _context7.abrupt("return", {
|
246
|
+
success: true
|
247
|
+
});
|
248
|
+
case 2:
|
249
|
+
case "end":
|
250
|
+
return _context7.stop();
|
251
|
+
}
|
252
|
+
}, _callee7);
|
253
|
+
}));
|
254
|
+
function StopGraphRun(_x10) {
|
255
|
+
return _StopGraphRun.apply(this, arguments);
|
256
|
+
}
|
257
|
+
return StopGraphRun;
|
197
258
|
}()
|
198
259
|
}]);
|
199
260
|
return Api;
|
@@ -1,17 +1,45 @@
|
|
1
|
-
import
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
3
|
/*
|
3
4
|
* @Author: wangxian
|
4
5
|
* @Date: 2022-05-24 08:50:16
|
5
|
-
* @LastEditTime: 2023-
|
6
|
+
* @LastEditTime: 2023-08-22 17:15:13
|
6
7
|
*/
|
7
8
|
import { GlobalOutlined } from '@ant-design/icons';
|
9
|
+
import { filter, map } from 'rxjs/operators';
|
8
10
|
import '../index.less';
|
9
11
|
import Icon from '../../../comps/Icons';
|
12
|
+
import { NodeStatus } from './NodeStatus';
|
13
|
+
import { gDPGraph } from '../graph';
|
14
|
+
import React from 'react';
|
10
15
|
var NodeElement = function NodeElement(props) {
|
11
16
|
var node = props.node;
|
12
17
|
var data = (node === null || node === void 0 ? void 0 : node.getData()) || {};
|
13
|
-
var
|
18
|
+
var id = data.id,
|
19
|
+
name = data.name,
|
14
20
|
icon = data.icon;
|
21
|
+
var _React$useState = React.useState({}),
|
22
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
23
|
+
nodeStatus = _React$useState2[0],
|
24
|
+
setNodeStatus = _React$useState2[1];
|
25
|
+
React.useEffect(function () {
|
26
|
+
var sub = gDPGraph && gDPGraph.factory$.executionStatus.pipe(filter(function (x) {
|
27
|
+
return !!x;
|
28
|
+
}), map(function (x) {
|
29
|
+
return x.execInfo;
|
30
|
+
})).subscribe(function (v) {
|
31
|
+
setNodeStatus(v);
|
32
|
+
});
|
33
|
+
return function () {
|
34
|
+
sub.unsubscribe();
|
35
|
+
};
|
36
|
+
}, [gDPGraph]);
|
37
|
+
var onStatusClick = function onStatusClick(e) {
|
38
|
+
e.stopPropagation();
|
39
|
+
gDPGraph.factory$.statusClick.next(_objectSpread(_objectSpread({}, data), {}, {
|
40
|
+
status: nodeStatus[id].jobStatus
|
41
|
+
}));
|
42
|
+
};
|
15
43
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
16
44
|
className: "node-element"
|
17
45
|
}, /*#__PURE__*/React.createElement("div", {
|
@@ -23,6 +51,10 @@ var NodeElement = function NodeElement(props) {
|
|
23
51
|
}, /*#__PURE__*/React.createElement("div", {
|
24
52
|
className: "name",
|
25
53
|
title: name
|
26
|
-
}, name)
|
54
|
+
}, name), nodeStatus && nodeStatus[id] && nodeStatus[id].jobStatus && /*#__PURE__*/React.createElement(NodeStatus, {
|
55
|
+
onClick: onStatusClick,
|
56
|
+
className: "statusIcon",
|
57
|
+
status: nodeStatus[id].jobStatus
|
58
|
+
}))));
|
27
59
|
};
|
28
60
|
export default NodeElement;
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: wangxian
|
3
|
+
* @Date: 2023-08-22 14:00:47
|
4
|
+
* @LastEditTime: 2023-08-22 17:15:20
|
5
|
+
*/
|
6
|
+
import React from 'react';
|
7
|
+
import { CheckCircleOutlined, CloseCircleOutlined, SyncOutlined, LineChartOutlined } from '@ant-design/icons';
|
8
|
+
export var NodeStatus = function NodeStatus(props) {
|
9
|
+
var className = props.className,
|
10
|
+
onClick = props.onClick,
|
11
|
+
status = props.status;
|
12
|
+
switch (status) {
|
13
|
+
case 'fail':
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
15
|
+
className: className,
|
16
|
+
onClick: onClick
|
17
|
+
}, /*#__PURE__*/React.createElement(CloseCircleOutlined, {
|
18
|
+
style: {
|
19
|
+
color: '#ff4d4f'
|
20
|
+
}
|
21
|
+
}));
|
22
|
+
case 'trend':
|
23
|
+
return /*#__PURE__*/React.createElement("div", {
|
24
|
+
className: className,
|
25
|
+
onClick: onClick
|
26
|
+
}, /*#__PURE__*/React.createElement(LineChartOutlined, {
|
27
|
+
style: {
|
28
|
+
color: '#1890ff'
|
29
|
+
}
|
30
|
+
}));
|
31
|
+
case 'success':
|
32
|
+
{
|
33
|
+
var color = '#2ecc71';
|
34
|
+
return /*#__PURE__*/React.createElement("div", {
|
35
|
+
className: className,
|
36
|
+
onClick: onClick
|
37
|
+
}, /*#__PURE__*/React.createElement(CheckCircleOutlined, {
|
38
|
+
style: {
|
39
|
+
color: color
|
40
|
+
}
|
41
|
+
}));
|
42
|
+
}
|
43
|
+
case 'running':
|
44
|
+
return /*#__PURE__*/React.createElement("div", {
|
45
|
+
className: className,
|
46
|
+
onClick: onClick
|
47
|
+
}, /*#__PURE__*/React.createElement(SyncOutlined, {
|
48
|
+
spin: true,
|
49
|
+
style: {
|
50
|
+
color: '#1890ff'
|
51
|
+
}
|
52
|
+
}));
|
53
|
+
default:
|
54
|
+
return null;
|
55
|
+
}
|
56
|
+
};
|
@@ -12,6 +12,11 @@ interface IFactory$ {
|
|
12
12
|
* 实验图加载状态
|
13
13
|
*/
|
14
14
|
loading: BehaviorSubject<boolean>;
|
15
|
+
/**
|
16
|
+
* 实验图加载状态
|
17
|
+
*/
|
18
|
+
running: BehaviorSubject<boolean>;
|
19
|
+
executionStatus: BehaviorSubject<NDPGraph.ExecutionStatus>;
|
15
20
|
/**
|
16
21
|
* 图数据流
|
17
22
|
*/
|
@@ -20,6 +25,10 @@ interface IFactory$ {
|
|
20
25
|
* 选中的节点
|
21
26
|
*/
|
22
27
|
selectedNodes: BehaviorSubject<NDPGraph.Node[]>;
|
28
|
+
/**
|
29
|
+
* 选中的节点
|
30
|
+
*/
|
31
|
+
statusClick: BehaviorSubject<any>;
|
23
32
|
/**
|
24
33
|
* 右击菜单
|
25
34
|
*/
|
@@ -28,6 +37,7 @@ interface IFactory$ {
|
|
28
37
|
declare class DPGraph extends GraphCore<BaseNode, BaseEdge> {
|
29
38
|
factory$: IFactory$;
|
30
39
|
dpGraphSub?: Subscription;
|
40
|
+
queryStatusSub?: Subscription;
|
31
41
|
constructor(graphData?: NDPGraph.GraphData);
|
32
42
|
initialize(graphData?: NDPGraph.GraphData): Promise<void>;
|
33
43
|
loadDPGraph(graphData: any): Promise<void>;
|
@@ -58,6 +68,12 @@ declare class DPGraph extends GraphCore<BaseNode, BaseEdge> {
|
|
58
68
|
clearContextMenuInfo: () => void;
|
59
69
|
clearGraphCells: () => void;
|
60
70
|
onMoveNodes(movedNodes: any[]): Promise<void>;
|
71
|
+
updateEdgeStatus: () => void;
|
72
|
+
runGraph: () => Promise<{
|
73
|
+
success: boolean;
|
74
|
+
}>;
|
75
|
+
loadExecutionStatus: () => Promise<void>;
|
76
|
+
stopRunGraph: () => Promise<any>;
|
61
77
|
dispose(): void;
|
62
78
|
}
|
63
79
|
export declare let gDPGraph: DPGraph;
|
@@ -13,7 +13,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
13
13
|
/*
|
14
14
|
* @Author: wangxian
|
15
15
|
* @Date: 2022-05-24 14:31:01
|
16
|
-
* @LastEditTime: 2023-
|
16
|
+
* @LastEditTime: 2023-08-25 16:03:31
|
17
17
|
*/
|
18
18
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
19
19
|
import produce from 'immer';
|
@@ -21,6 +21,7 @@ import React from 'react';
|
|
21
21
|
import ReactDOM from 'react-dom';
|
22
22
|
import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
|
23
23
|
import { filter, take } from 'rxjs/operators';
|
24
|
+
import { timer } from 'rxjs';
|
24
25
|
import { round } from 'lodash-es';
|
25
26
|
import { GraphCore } from '../../framework/graph';
|
26
27
|
import NodeElement from './comps/NodeElement';
|
@@ -28,6 +29,7 @@ import { DPEdge } from './comps/shape/edge';
|
|
28
29
|
import { DPNode } from './comps/shape/node';
|
29
30
|
import { formatGraphData, formatNodeInfoToNodeMeta } from './utils';
|
30
31
|
import { deepClone } from '../../utils';
|
32
|
+
import { MetadataService } from '../../framework/metadata/MetadataService';
|
31
33
|
var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
32
34
|
_inherits(DPGraph, _GraphCore);
|
33
35
|
var _super = _createSuper(DPGraph);
|
@@ -167,12 +169,17 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
167
169
|
});
|
168
170
|
_this.factory$ = {
|
169
171
|
loading: new BehaviorSubject(false),
|
172
|
+
running: new BehaviorSubject(false),
|
173
|
+
executionStatus: new BehaviorSubject(null),
|
170
174
|
dpGraph: new BehaviorSubject(null),
|
175
|
+
statusClick: new BehaviorSubject(null),
|
171
176
|
selectedNodes: new BehaviorSubject([]),
|
172
177
|
contextMenuInfo: new BehaviorSubject(null)
|
173
178
|
};
|
174
179
|
// 图数据的订阅
|
175
180
|
_this.dpGraphSub = void 0;
|
181
|
+
// 查询执行状态的定时器订阅
|
182
|
+
_this.queryStatusSub = void 0;
|
176
183
|
// 渲染画布
|
177
184
|
_this.renderGraph = function (wrapper, container) {
|
178
185
|
_this.dpGraphSub = _this.factory$.dpGraph.pipe(filter(function (x) {
|
@@ -201,13 +208,6 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
201
208
|
while (1) switch (_context.prev = _context.next) {
|
202
209
|
case 0:
|
203
210
|
// 清除已有的图谱
|
204
|
-
// const oldGraph = this.factory$.dpGraph.getValue();
|
205
|
-
// console.log('清除已有的图谱', oldGraph);
|
206
|
-
// this.deleteNodes(
|
207
|
-
// oldGraph.nodes.map((it) => {
|
208
|
-
// return it.id;
|
209
|
-
// }),
|
210
|
-
// );
|
211
211
|
_this.clearGraphCells();
|
212
212
|
_formatGraphData2 = formatGraphData(graphData), nodes = _formatGraphData2.nodes, edges = _formatGraphData2.edges;
|
213
213
|
dpNodes = nodes.map(function (it) {
|
@@ -218,8 +218,7 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
218
218
|
});
|
219
219
|
dpEdges = edges.map(function (it) {
|
220
220
|
return new DPEdge(it);
|
221
|
-
});
|
222
|
-
// edges!.forEach((edgeMeta) => this.renderEdge(edgeMeta));
|
221
|
+
});
|
223
222
|
_this.graph.addNodes(dpNodes);
|
224
223
|
_this.graph.addEdges(dpEdges);
|
225
224
|
_this.zoomGraphRealSize();
|
@@ -269,6 +268,136 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
269
268
|
_this.clearGraphCells = function () {
|
270
269
|
_this.graph.clearCells();
|
271
270
|
};
|
271
|
+
// 更新边的执行状态
|
272
|
+
_this.updateEdgeStatus = function () {
|
273
|
+
if (_this.graph) {
|
274
|
+
var _assertThisInitialize = _assertThisInitialized(_this),
|
275
|
+
graph = _assertThisInitialize.graph;
|
276
|
+
var executionStatus = _this.factory$.executionStatus.getValue();
|
277
|
+
var instStatus = executionStatus.instStatus;
|
278
|
+
var nodeIds = Object.keys(instStatus);
|
279
|
+
var runningNodeIds = nodeIds.filter(function (id) {
|
280
|
+
return instStatus[id] === 'running';
|
281
|
+
}).map(function (i) {
|
282
|
+
return i.toString();
|
283
|
+
});
|
284
|
+
_this.updateEdges(function (edges) {
|
285
|
+
edges.forEach(function (edge) {
|
286
|
+
var nodeId = edge.target.cell,
|
287
|
+
id = edge.id;
|
288
|
+
var view = graph === null || graph === void 0 ? void 0 : graph.findViewByCell(id);
|
289
|
+
if (!view) {
|
290
|
+
return;
|
291
|
+
}
|
292
|
+
// view!.addClass('edgeProcessing');
|
293
|
+
if (runningNodeIds.includes(nodeId.toString())) {
|
294
|
+
view.addClass('edgeProcessing');
|
295
|
+
} else {
|
296
|
+
view.removeClass('edgeProcessing');
|
297
|
+
}
|
298
|
+
});
|
299
|
+
});
|
300
|
+
}
|
301
|
+
};
|
302
|
+
// 运行画布或节点
|
303
|
+
_this.runGraph = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
304
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
305
|
+
while (1) switch (_context2.prev = _context2.next) {
|
306
|
+
case 0:
|
307
|
+
_context2.prev = 0;
|
308
|
+
_this.factory$.running.next(true);
|
309
|
+
_this.loadExecutionStatus(); // 发起执行状态查询
|
310
|
+
return _context2.abrupt("return", {
|
311
|
+
success: true
|
312
|
+
});
|
313
|
+
case 6:
|
314
|
+
_context2.prev = 6;
|
315
|
+
_context2.t0 = _context2["catch"](0);
|
316
|
+
console.error("\u6267\u884C\u5931\u8D25", _context2.t0);
|
317
|
+
return _context2.abrupt("return", {
|
318
|
+
success: false
|
319
|
+
});
|
320
|
+
case 10:
|
321
|
+
case "end":
|
322
|
+
return _context2.stop();
|
323
|
+
}
|
324
|
+
}, _callee2, null, [[0, 6]]);
|
325
|
+
}));
|
326
|
+
// 获取执行状态
|
327
|
+
_this.loadExecutionStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
328
|
+
var _this$queryStatusSub;
|
329
|
+
var server;
|
330
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
331
|
+
while (1) switch (_context4.prev = _context4.next) {
|
332
|
+
case 0:
|
333
|
+
(_this$queryStatusSub = _this.queryStatusSub) === null || _this$queryStatusSub === void 0 ? void 0 : _this$queryStatusSub.unsubscribe();
|
334
|
+
// 每三秒查询一次执行状态
|
335
|
+
server = new MetadataService();
|
336
|
+
_this.queryStatusSub = timer(0, 5000).subscribe( /*#__PURE__*/function () {
|
337
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(resPromise) {
|
338
|
+
var execStatusRes, status, _this$queryStatusSub2;
|
339
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
340
|
+
while (1) switch (_context3.prev = _context3.next) {
|
341
|
+
case 0:
|
342
|
+
_context3.next = 2;
|
343
|
+
return server.GetGraphStatus(_this.factory$.dpGraph.getValue());
|
344
|
+
case 2:
|
345
|
+
execStatusRes = _context3.sent;
|
346
|
+
_this.factory$.executionStatus.next(execStatusRes.data);
|
347
|
+
_this.updateEdgeStatus();
|
348
|
+
// 执行完成时停止查询状态
|
349
|
+
status = execStatusRes.data.status;
|
350
|
+
if (status === 'default') {
|
351
|
+
_this.factory$.running.next(false);
|
352
|
+
server.StopGraphRun({});
|
353
|
+
(_this$queryStatusSub2 = _this.queryStatusSub) === null || _this$queryStatusSub2 === void 0 ? void 0 : _this$queryStatusSub2.unsubscribe();
|
354
|
+
} else {
|
355
|
+
_this.factory$.running.next(true);
|
356
|
+
}
|
357
|
+
case 7:
|
358
|
+
case "end":
|
359
|
+
return _context3.stop();
|
360
|
+
}
|
361
|
+
}, _callee3);
|
362
|
+
}));
|
363
|
+
return function (_x2) {
|
364
|
+
return _ref6.apply(this, arguments);
|
365
|
+
};
|
366
|
+
}());
|
367
|
+
case 3:
|
368
|
+
case "end":
|
369
|
+
return _context4.stop();
|
370
|
+
}
|
371
|
+
}, _callee4);
|
372
|
+
}));
|
373
|
+
// 停止实验的执行
|
374
|
+
_this.stopRunGraph = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
375
|
+
var server, stopRes;
|
376
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
377
|
+
while (1) switch (_context5.prev = _context5.next) {
|
378
|
+
case 0:
|
379
|
+
_context5.prev = 0;
|
380
|
+
server = new MetadataService();
|
381
|
+
_context5.next = 4;
|
382
|
+
return server.StopGraphRun({});
|
383
|
+
case 4:
|
384
|
+
stopRes = _context5.sent;
|
385
|
+
_this.factory$.running.next(false);
|
386
|
+
_this.loadExecutionStatus(); // 发起执行状态查询
|
387
|
+
return _context5.abrupt("return", stopRes);
|
388
|
+
case 10:
|
389
|
+
_context5.prev = 10;
|
390
|
+
_context5.t0 = _context5["catch"](0);
|
391
|
+
console.error("\u505C\u6B62\u5931\u8D25", _context5.t0);
|
392
|
+
return _context5.abrupt("return", {
|
393
|
+
success: false
|
394
|
+
});
|
395
|
+
case 14:
|
396
|
+
case "end":
|
397
|
+
return _context5.stop();
|
398
|
+
}
|
399
|
+
}, _callee5, null, [[0, 10]]);
|
400
|
+
}));
|
272
401
|
_this.initialize(_graphData);
|
273
402
|
return _this;
|
274
403
|
}
|
@@ -276,33 +405,33 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
276
405
|
_createClass(DPGraph, [{
|
277
406
|
key: "initialize",
|
278
407
|
value: function () {
|
279
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
280
|
-
return _regeneratorRuntime.wrap(function
|
281
|
-
while (1) switch (
|
408
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(graphData) {
|
409
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
410
|
+
while (1) switch (_context6.prev = _context6.next) {
|
282
411
|
case 0:
|
283
412
|
this.factory$.loading.next(true);
|
284
|
-
|
285
|
-
|
413
|
+
_context6.prev = 1;
|
414
|
+
_context6.next = 4;
|
286
415
|
return this.loadDPGraph(graphData || {
|
287
416
|
nodes: [],
|
288
417
|
edges: []
|
289
418
|
});
|
290
419
|
case 4:
|
291
420
|
this.factory$.loading.next(false);
|
292
|
-
|
421
|
+
_context6.next = 11;
|
293
422
|
break;
|
294
423
|
case 7:
|
295
|
-
|
296
|
-
|
424
|
+
_context6.prev = 7;
|
425
|
+
_context6.t0 = _context6["catch"](1);
|
297
426
|
this.factory$.loading.next(false);
|
298
|
-
console.error('加载实验错误',
|
427
|
+
console.error('加载实验错误', _context6.t0);
|
299
428
|
case 11:
|
300
429
|
case "end":
|
301
|
-
return
|
430
|
+
return _context6.stop();
|
302
431
|
}
|
303
|
-
},
|
432
|
+
}, _callee6, this, [[1, 7]]);
|
304
433
|
}));
|
305
|
-
function initialize(
|
434
|
+
function initialize(_x3) {
|
306
435
|
return _initialize.apply(this, arguments);
|
307
436
|
}
|
308
437
|
return initialize;
|
@@ -310,18 +439,18 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
310
439
|
}, {
|
311
440
|
key: "loadDPGraph",
|
312
441
|
value: function () {
|
313
|
-
var _loadDPGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
314
|
-
return _regeneratorRuntime.wrap(function
|
315
|
-
while (1) switch (
|
442
|
+
var _loadDPGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(graphData) {
|
443
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
444
|
+
while (1) switch (_context7.prev = _context7.next) {
|
316
445
|
case 0:
|
317
446
|
this.factory$.dpGraph.next(graphData);
|
318
447
|
case 1:
|
319
448
|
case "end":
|
320
|
-
return
|
449
|
+
return _context7.stop();
|
321
450
|
}
|
322
|
-
},
|
451
|
+
}, _callee7, this);
|
323
452
|
}));
|
324
|
-
function loadDPGraph(
|
453
|
+
function loadDPGraph(_x4) {
|
325
454
|
return _loadDPGraph.apply(this, arguments);
|
326
455
|
}
|
327
456
|
return loadDPGraph;
|
@@ -370,17 +499,17 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
370
499
|
}, {
|
371
500
|
key: "updateDPGraph",
|
372
501
|
value: function () {
|
373
|
-
var _updateDPGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
502
|
+
var _updateDPGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
374
503
|
var nodes,
|
375
504
|
edges,
|
376
505
|
oldGraph,
|
377
506
|
newGraph,
|
378
|
-
|
379
|
-
return _regeneratorRuntime.wrap(function
|
380
|
-
while (1) switch (
|
507
|
+
_args8 = arguments;
|
508
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
509
|
+
while (1) switch (_context8.prev = _context8.next) {
|
381
510
|
case 0:
|
382
|
-
nodes =
|
383
|
-
edges =
|
511
|
+
nodes = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : [];
|
512
|
+
edges = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : [];
|
384
513
|
oldGraph = this.factory$.dpGraph.getValue();
|
385
514
|
newGraph = produce(oldGraph, function (nextGraph) {
|
386
515
|
if (nodes.length) {
|
@@ -395,9 +524,9 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
395
524
|
this.factory$.dpGraph.next(newGraph);
|
396
525
|
case 5:
|
397
526
|
case "end":
|
398
|
-
return
|
527
|
+
return _context8.stop();
|
399
528
|
}
|
400
|
-
},
|
529
|
+
}, _callee8, this);
|
401
530
|
}));
|
402
531
|
function updateDPGraph() {
|
403
532
|
return _updateDPGraph.apply(this, arguments);
|
@@ -407,17 +536,17 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
407
536
|
}, {
|
408
537
|
key: "delDPGraphElement",
|
409
538
|
value: function () {
|
410
|
-
var _delDPGraphElement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
539
|
+
var _delDPGraphElement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
411
540
|
var nodes,
|
412
541
|
edges,
|
413
542
|
oldGraph,
|
414
543
|
newGraph,
|
415
|
-
|
416
|
-
return _regeneratorRuntime.wrap(function
|
417
|
-
while (1) switch (
|
544
|
+
_args9 = arguments;
|
545
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
546
|
+
while (1) switch (_context9.prev = _context9.next) {
|
418
547
|
case 0:
|
419
|
-
nodes =
|
420
|
-
edges =
|
548
|
+
nodes = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : [];
|
549
|
+
edges = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : [];
|
421
550
|
oldGraph = this.factory$.dpGraph.getValue();
|
422
551
|
newGraph = produce(oldGraph, function (nextGraph) {
|
423
552
|
if (nodes.length) {
|
@@ -432,7 +561,7 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
432
561
|
} else {
|
433
562
|
nextGraph.edges = oldGraph.edges.filter(function (edge) {
|
434
563
|
return !edges.find(function (delEdge) {
|
435
|
-
return delEdge.inPortId.toString() === edge.inPortId.toString() && delEdge.outPortId.toString() === edge.outPortId.toString();
|
564
|
+
return delEdge.inPortId.toString() === edge.inPortId.toString() && delEdge.outPortId.toString() === edge.outPortId.toString() && delEdge.source.toString() === edge.source.toString() && delEdge.target.toString() === edge.target.toString();
|
436
565
|
});
|
437
566
|
});
|
438
567
|
}
|
@@ -440,9 +569,9 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
440
569
|
this.factory$.dpGraph.next(newGraph);
|
441
570
|
case 5:
|
442
571
|
case "end":
|
443
|
-
return
|
572
|
+
return _context9.stop();
|
444
573
|
}
|
445
|
-
},
|
574
|
+
}, _callee9, this);
|
446
575
|
}));
|
447
576
|
function delDPGraphElement() {
|
448
577
|
return _delDPGraphElement.apply(this, arguments);
|
@@ -453,10 +582,10 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
453
582
|
key: "onConnectNode",
|
454
583
|
value: // 处理连线事件
|
455
584
|
function () {
|
456
|
-
var _onConnectNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
585
|
+
var _onConnectNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(args) {
|
457
586
|
var _args$edge, edge, isNew, source, target, _edge$getTargetCell, _edge$getTargetCell$p, _ports$find, node, portId, ports, color, data;
|
458
|
-
return _regeneratorRuntime.wrap(function
|
459
|
-
while (1) switch (
|
587
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
588
|
+
while (1) switch (_context10.prev = _context10.next) {
|
460
589
|
case 0:
|
461
590
|
_args$edge = args.edge, edge = _args$edge === void 0 ? {} : _args$edge, isNew = args.isNew;
|
462
591
|
source = edge.source, target = edge.target;
|
@@ -492,16 +621,16 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
492
621
|
this.updateDPGraph([], [data]);
|
493
622
|
}
|
494
623
|
}
|
495
|
-
return
|
624
|
+
return _context10.abrupt("return", {
|
496
625
|
success: true
|
497
626
|
});
|
498
627
|
case 4:
|
499
628
|
case "end":
|
500
|
-
return
|
629
|
+
return _context10.stop();
|
501
630
|
}
|
502
|
-
},
|
631
|
+
}, _callee10, this);
|
503
632
|
}));
|
504
|
-
function onConnectNode(
|
633
|
+
function onConnectNode(_x5) {
|
505
634
|
return _onConnectNode.apply(this, arguments);
|
506
635
|
}
|
507
636
|
return onConnectNode;
|
@@ -596,11 +725,11 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
596
725
|
}, {
|
597
726
|
key: "onMoveNodes",
|
598
727
|
value: function () {
|
599
|
-
var _onMoveNodes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
728
|
+
var _onMoveNodes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(movedNodes) {
|
600
729
|
var _this2 = this;
|
601
730
|
var targetNodes, newPos, oldGraph, newGraph;
|
602
|
-
return _regeneratorRuntime.wrap(function
|
603
|
-
while (1) switch (
|
731
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
732
|
+
while (1) switch (_context11.prev = _context11.next) {
|
604
733
|
case 0:
|
605
734
|
targetNodes = movedNodes.filter(function (arg) {
|
606
735
|
var node = arg.node;
|
@@ -644,11 +773,11 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
644
773
|
}
|
645
774
|
case 2:
|
646
775
|
case "end":
|
647
|
-
return
|
776
|
+
return _context11.stop();
|
648
777
|
}
|
649
|
-
},
|
778
|
+
}, _callee11, this);
|
650
779
|
}));
|
651
|
-
function onMoveNodes(
|
780
|
+
function onMoveNodes(_x6) {
|
652
781
|
return _onMoveNodes.apply(this, arguments);
|
653
782
|
}
|
654
783
|
return onMoveNodes;
|
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
/*
|
4
4
|
* @Author: wangxian
|
5
5
|
* @Date: 2022-05-16 18:53:31
|
6
|
-
* @LastEditTime: 2023-
|
6
|
+
* @LastEditTime: 2023-08-22 17:06:28
|
7
7
|
*/
|
8
8
|
import React from 'react';
|
9
9
|
import { filter } from 'rxjs';
|
@@ -20,6 +20,7 @@ var DynamicPorts = function DynamicPorts(props) {
|
|
20
20
|
var defaultValue = props.defaultValue,
|
21
21
|
onChange = props.onChange,
|
22
22
|
onNodeSelect = props.onNodeSelect,
|
23
|
+
onStatusClick = props.onStatusClick,
|
23
24
|
getDPGraphInstance = props.getDPGraphInstance;
|
24
25
|
var divRef = React.useRef(null);
|
25
26
|
var containerRef = React.useRef(null);
|
@@ -63,6 +64,10 @@ var DynamicPorts = function DynamicPorts(props) {
|
|
63
64
|
_dpGraph.factory$.selectedNodes.subscribe(function (v) {
|
64
65
|
onNodeSelect && onNodeSelect(v[0]);
|
65
66
|
});
|
67
|
+
// 获取选中节点的订阅
|
68
|
+
_dpGraph.factory$.statusClick.subscribe(function (v) {
|
69
|
+
onStatusClick && onStatusClick(v);
|
70
|
+
});
|
66
71
|
getDPGraphInstance && getDPGraphInstance(_dpGraph);
|
67
72
|
firstLoadRef.current = false;
|
68
73
|
}
|
@@ -64,6 +64,7 @@
|
|
64
64
|
flex-grow: 0;
|
65
65
|
align-items: center;
|
66
66
|
font-size: 14px;
|
67
|
+
cursor: pointer;
|
67
68
|
transform: translateZ(0);
|
68
69
|
}
|
69
70
|
}
|
@@ -205,12 +206,16 @@
|
|
205
206
|
}
|
206
207
|
.edgeProcessing {
|
207
208
|
path:nth-child(2) {
|
208
|
-
stroke: rgba(57, 202, 116, 0.8);
|
209
|
+
// stroke: rgba(57, 202, 116, 0.8);
|
209
210
|
stroke-width: 2px;
|
210
211
|
stroke-dasharray: 8px, 2px;
|
211
|
-
|
212
|
-
|
213
|
-
|
212
|
+
animation: processing-line 30s infinite linear;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
@keyframes processing-line {
|
217
|
+
to {
|
218
|
+
stroke-dashoffset: -1000;
|
214
219
|
}
|
215
220
|
}
|
216
221
|
}
|
@@ -62,4 +62,15 @@ export declare namespace NDPGraph {
|
|
62
62
|
interface Param {
|
63
63
|
[key: string]: any;
|
64
64
|
}
|
65
|
+
interface ExecutionStatus {
|
66
|
+
instStatus: InstStatus;
|
67
|
+
execInfo: ExecInfo;
|
68
|
+
status: string;
|
69
|
+
}
|
70
|
+
interface InstStatus {
|
71
|
+
[k: string]: string;
|
72
|
+
}
|
73
|
+
interface ExecInfo {
|
74
|
+
[k: string]: any;
|
75
|
+
}
|
65
76
|
}
|
@@ -6,7 +6,7 @@ var _excluded = ["wrapper", "container", "nodes", "edges"];
|
|
6
6
|
/*
|
7
7
|
* @Author: wangxian
|
8
8
|
* @Date: 2022-05-24 13:55:44
|
9
|
-
* @LastEditTime: 2023-
|
9
|
+
* @LastEditTime: 2023-08-25 16:03:45
|
10
10
|
*/
|
11
11
|
import { Graph } from '@antv/x6';
|
12
12
|
import { debounceTime, fromEventPattern, map, merge, scan, tap } from 'rxjs';
|
@@ -17,4 +17,8 @@ export declare class MetadataService {
|
|
17
17
|
GetMetadataObjList(data: any): Promise<any[]>;
|
18
18
|
/** 通过扩展规则获取枚举类型的值 */
|
19
19
|
GetEnumDataByUrl(url: string, method?: 'get' | 'post', body?: any): Promise<any>;
|
20
|
+
/** 获取执行状态 */
|
21
|
+
GetGraphStatus(data: any): Promise<any>;
|
22
|
+
/** 获取执行状态 */
|
23
|
+
StopGraphRun(data: any): Promise<any>;
|
20
24
|
}
|
@@ -5,7 +5,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
5
|
/*
|
6
6
|
* @Author: wangxian
|
7
7
|
* @Date: 2021-09-18 14:15:04
|
8
|
-
* @LastEditTime: 2023-
|
8
|
+
* @LastEditTime: 2023-08-22 15:40:30
|
9
9
|
*/
|
10
10
|
import Api from '../../api';
|
11
11
|
var globalAPI = new Api();
|
@@ -124,6 +124,44 @@ export var MetadataService = /*#__PURE__*/function () {
|
|
124
124
|
return _GetEnumDataByUrl.apply(this, arguments);
|
125
125
|
}
|
126
126
|
return GetEnumDataByUrl;
|
127
|
+
}() /** 获取执行状态 */
|
128
|
+
}, {
|
129
|
+
key: "GetGraphStatus",
|
130
|
+
value: function () {
|
131
|
+
var _GetGraphStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data) {
|
132
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
133
|
+
while (1) switch (_context6.prev = _context6.next) {
|
134
|
+
case 0:
|
135
|
+
return _context6.abrupt("return", this.api.GetGraphStatus(data));
|
136
|
+
case 1:
|
137
|
+
case "end":
|
138
|
+
return _context6.stop();
|
139
|
+
}
|
140
|
+
}, _callee6, this);
|
141
|
+
}));
|
142
|
+
function GetGraphStatus(_x7) {
|
143
|
+
return _GetGraphStatus.apply(this, arguments);
|
144
|
+
}
|
145
|
+
return GetGraphStatus;
|
146
|
+
}() /** 获取执行状态 */
|
147
|
+
}, {
|
148
|
+
key: "StopGraphRun",
|
149
|
+
value: function () {
|
150
|
+
var _StopGraphRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
|
151
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
152
|
+
while (1) switch (_context7.prev = _context7.next) {
|
153
|
+
case 0:
|
154
|
+
return _context7.abrupt("return", this.api.StopGraphRun(data));
|
155
|
+
case 1:
|
156
|
+
case "end":
|
157
|
+
return _context7.stop();
|
158
|
+
}
|
159
|
+
}, _callee7, this);
|
160
|
+
}));
|
161
|
+
function StopGraphRun(_x8) {
|
162
|
+
return _StopGraphRun.apply(this, arguments);
|
163
|
+
}
|
164
|
+
return StopGraphRun;
|
127
165
|
}()
|
128
166
|
}]);
|
129
167
|
return MetadataService;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* @Author: wangxian
|
3
3
|
* @Date: 2021-09-18 14:15:04
|
4
|
-
* @LastEditTime: 2023-
|
4
|
+
* @LastEditTime: 2023-08-22 16:30:28
|
5
5
|
*/
|
6
6
|
export type IMetaType = 'object' | 'ref' | 'bool' | 'number' | 'text' | 'enum' | 'array' | string;
|
7
7
|
|
@@ -95,4 +95,9 @@ export interface IAPI {
|
|
95
95
|
GetMetadataObjList(data: any): Promise<any[]>;
|
96
96
|
/** 通过扩展规则获取枚举类型的值 */
|
97
97
|
GetEnumDataByUrl(url: string, method: 'get' | 'post', body: any): Promise<any>;
|
98
|
+
// 获取执行状态
|
99
|
+
|
100
|
+
GetGraphStatus(data: any): Promise<any>;
|
101
|
+
// 获取执行状态
|
102
|
+
StopGraphRun(data: any): Promise<any>;
|
98
103
|
}
|