@riil-frontend/component-topology 12.1.0-dev.11 → 12.1.0-dev.12
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/build/index.js +2 -2
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/es/core/hooks/useTopoEdit.js +42 -16
- package/es/core/models/AttributeMetricDisplay.js +2 -2
- package/es/core/models/HistoryManager.js +1 -1
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/store/models/topoConfig.js +1 -7
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/lib/core/hooks/useTopoEdit.js +41 -15
- package/lib/core/models/AttributeMetricDisplay.js +2 -2
- package/lib/core/models/HistoryManager.js +1 -1
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/store/models/topoConfig.js +1 -7
- package/package.json +2 -2
@@ -64,7 +64,7 @@ function ResourceSelectDrawer(props) {
|
|
64
64
|
_context.prev = 9;
|
65
65
|
_context.t0 = _context["catch"](1);
|
66
66
|
setLoading(false);
|
67
|
-
rlog.error('ResourceSelectDrawer.handleOk', _context.t0);
|
67
|
+
rlog.error('ResourceSelectDrawer.handleOk', _context.t0, _context.t0.stack);
|
68
68
|
|
69
69
|
case 13:
|
70
70
|
case "end":
|
@@ -8,7 +8,7 @@ import React, { useCallback, useState } from "react";
|
|
8
8
|
import Logger from 'loglevel';
|
9
9
|
import { TopoEvent } from "@riil-frontend/component-topology-graph";
|
10
10
|
import { TPL_BLANK, TPL_TREE } from "../../utils/template";
|
11
|
-
import { getGroupElementByTag, isEdge, containsElement, isGroup, isLayer, isNode, getGroupChildren } from "../../utils/htElementUtils";
|
11
|
+
import { getGroupElementByTag, isEdge, containsElement, isGroup, isLayer, isNode, getGroupChildren, getElements } from "../../utils/htElementUtils";
|
12
12
|
import useResourceConfig from "./useResourceConfig";
|
13
13
|
import useGroupAddResource from "./useGroupAddResource";
|
14
14
|
import { findGroupChildren } from "../../utils/topoData";
|
@@ -280,7 +280,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
280
280
|
if (typeof onNodeDelete === "function") {
|
281
281
|
onNodeDelete(data);
|
282
282
|
} else {
|
283
|
-
emitEvent(TopoEvent.EVENT_TRIGGER_DELETE,
|
283
|
+
emitEvent(TopoEvent.EVENT_TRIGGER_DELETE, data);
|
284
284
|
}
|
285
285
|
}
|
286
286
|
}; // 删除关联在节点上的出口链路
|
@@ -369,13 +369,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
369
369
|
|
370
370
|
function findUNExistedElements(elements) {
|
371
371
|
var dm = topo.getDataModel();
|
372
|
-
var
|
372
|
+
var unExistedElements = elements.filter(function (element) {
|
373
373
|
return !containsElement(dm, element);
|
374
374
|
});
|
375
|
-
return
|
375
|
+
return unExistedElements;
|
376
376
|
}
|
377
377
|
/**
|
378
|
-
*
|
378
|
+
* 区域关联资源
|
379
|
+
* @param {{ id, tag }} group
|
380
|
+
* @param {*} resources
|
379
381
|
*/
|
380
382
|
|
381
383
|
|
@@ -385,25 +387,39 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
385
387
|
|
386
388
|
function _bindGroupResources() {
|
387
389
|
_bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(group, resources) {
|
388
|
-
var
|
390
|
+
var _yield$editDispatcher2, elements, dm, needDeleteHtDatas, nodeElements, newLinkElements, updateElements;
|
389
391
|
|
390
392
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
391
393
|
while (1) switch (_context9.prev = _context9.next) {
|
392
394
|
case 0:
|
393
|
-
|
394
|
-
|
395
|
+
rlog.debug("区域关联资源", {
|
396
|
+
group: group,
|
397
|
+
resources: resources
|
398
|
+
});
|
395
399
|
topo.historyManager.beginTransaction();
|
396
|
-
_context9.next =
|
400
|
+
_context9.next = 4;
|
397
401
|
return resourceConfig.updateGroupResources(group, resources);
|
398
402
|
|
399
|
-
case
|
400
|
-
_context9.next =
|
403
|
+
case 4:
|
404
|
+
_context9.next = 6;
|
401
405
|
return editDispatchers.fetchDataByConfig();
|
402
406
|
|
403
|
-
case
|
407
|
+
case 6:
|
404
408
|
_yield$editDispatcher2 = _context9.sent;
|
405
409
|
elements = _yield$editDispatcher2.elements;
|
406
|
-
//
|
410
|
+
rlog.debug("区域关联资源: 元素列表", elements); // 先删除多余的元素
|
411
|
+
|
412
|
+
dm = topo.getDataModel();
|
413
|
+
needDeleteHtDatas = getElements(dm).filter(function (htData) {
|
414
|
+
return htData.a('id') && !elements.find(function (ele) {
|
415
|
+
return ele.id === htData.a('id');
|
416
|
+
});
|
417
|
+
});
|
418
|
+
needDeleteHtDatas.forEach(function (htData) {
|
419
|
+
return dm.remove(htData);
|
420
|
+
}); // 区域里的子区域及子区域的节点、新增的链路
|
421
|
+
// 区域里的所有节点
|
422
|
+
|
407
423
|
nodeElements = findGroupChildren(elements, group);
|
408
424
|
newLinkElements = findUNExistedLinkElements(elements);
|
409
425
|
updateElements = [].concat(nodeElements, newLinkElements);
|
@@ -414,11 +430,21 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
414
430
|
if (topo.linkDynamicStyleExecutor) {
|
415
431
|
topo.linkDynamicStyleExecutor.execute();
|
416
432
|
}
|
417
|
-
}
|
433
|
+
} // const unExistedElements = findUNExistedElements(elements)
|
434
|
+
// const createElementsData = {
|
435
|
+
// groups: unExistedElements.filter((item) => item.type === "group"),
|
436
|
+
// nodes: unExistedElements.filter((item) => item.type === "node"),
|
437
|
+
// links: unExistedElements.filter((item) => item.type === "link"),
|
438
|
+
// linkGroups: unExistedElements.filter((item) => item.type === "linkGroup"),
|
439
|
+
// };
|
440
|
+
// const htTopo = topo.getHtTopo()
|
441
|
+
// htTopo.createElements(createElementsData);
|
442
|
+
// rlog.debug('==> ht: createElements ', createElementsData)
|
443
|
+
|
418
444
|
|
419
445
|
topo.historyManager.endTransaction();
|
420
446
|
|
421
|
-
case
|
447
|
+
case 17:
|
422
448
|
case "end":
|
423
449
|
return _context9.stop();
|
424
450
|
}
|
@@ -714,7 +740,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
714
740
|
type: type,
|
715
741
|
data: data
|
716
742
|
};
|
717
|
-
rlog.debug("
|
743
|
+
rlog.debug("=> ht: saveBind", eventData);
|
718
744
|
emitEvent(TopoEvent.EVENT_DATA_RESULT, eventData);
|
719
745
|
};
|
720
746
|
/**
|
@@ -527,7 +527,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
527
527
|
tags: tags
|
528
528
|
});
|
529
529
|
});
|
530
|
-
rlog.debug('
|
530
|
+
rlog.debug(' ==> ht: 推送标注', elementTagsAndTips);
|
531
531
|
var htTopo = topo.getHtTopo();
|
532
532
|
|
533
533
|
if (htTopo) {
|
@@ -538,7 +538,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
538
538
|
try {
|
539
539
|
htTopo.loadTagAndTip(JSON.parse(JSON.stringify(elementTagsAndTips)));
|
540
540
|
} catch (error) {
|
541
|
-
rlog.error('
|
541
|
+
rlog.error(' ==> ht: 推送标注失败', error);
|
542
542
|
}
|
543
543
|
|
544
544
|
(_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '加载标注');
|
@@ -60,7 +60,7 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
60
60
|
|
61
61
|
_proto.setDisabled = function setDisabled(disabled, message) {
|
62
62
|
this.htHistoryManager.setDisabled(disabled);
|
63
|
-
log.debug("HistoryManager.setDisabled " + (disabled ? '禁用' : '启用') +
|
63
|
+
log.debug("HistoryManager.setDisabled: " + (disabled ? '禁用' : '启用') + ". <" + message + ">, " + this.toString() + ", ", 'Histories: ', this.getHistories());
|
64
64
|
};
|
65
65
|
|
66
66
|
_proto.beginTransaction = function beginTransaction(name) {
|
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
|
24
24
|
import SelectionModel from "./SelectionModel";
|
25
25
|
import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
|
26
26
|
|
27
|
-
var version = typeof "12.1.0-dev.
|
27
|
+
var version = typeof "12.1.0-dev.12" === 'string' ? "12.1.0-dev.12" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -260,13 +260,7 @@ export default function (topoApp) {
|
|
260
260
|
|
261
261
|
case 5:
|
262
262
|
data = _context2.sent;
|
263
|
-
rlog.debug("
|
264
|
-
config: {
|
265
|
-
resources: resources,
|
266
|
-
groups: groups
|
267
|
-
},
|
268
|
-
data: data
|
269
|
-
});
|
263
|
+
rlog.debug("按配置查询拓扑数据. 参数:", query, ", 返回结果: ", data);
|
270
264
|
return _context2.abrupt("return", data);
|
271
265
|
|
272
266
|
case 8:
|
@@ -83,7 +83,7 @@ function ResourceSelectDrawer(props) {
|
|
83
83
|
_context.t0 = _context["catch"](1);
|
84
84
|
setLoading(false);
|
85
85
|
|
86
|
-
_componentTopologyUtils.rlog.error('ResourceSelectDrawer.handleOk', _context.t0);
|
86
|
+
_componentTopologyUtils.rlog.error('ResourceSelectDrawer.handleOk', _context.t0, _context.t0.stack);
|
87
87
|
|
88
88
|
case 13:
|
89
89
|
case "end":
|
@@ -309,7 +309,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
309
309
|
if (typeof onNodeDelete === "function") {
|
310
310
|
onNodeDelete(data);
|
311
311
|
} else {
|
312
|
-
emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE,
|
312
|
+
emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE, data);
|
313
313
|
}
|
314
314
|
}
|
315
315
|
}; // 删除关联在节点上的出口链路
|
@@ -398,13 +398,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
398
398
|
|
399
399
|
function findUNExistedElements(elements) {
|
400
400
|
var dm = topo.getDataModel();
|
401
|
-
var
|
401
|
+
var unExistedElements = elements.filter(function (element) {
|
402
402
|
return !(0, _htElementUtils.containsElement)(dm, element);
|
403
403
|
});
|
404
|
-
return
|
404
|
+
return unExistedElements;
|
405
405
|
}
|
406
406
|
/**
|
407
|
-
*
|
407
|
+
* 区域关联资源
|
408
|
+
* @param {{ id, tag }} group
|
409
|
+
* @param {*} resources
|
408
410
|
*/
|
409
411
|
|
410
412
|
|
@@ -414,25 +416,39 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
414
416
|
|
415
417
|
function _bindGroupResources() {
|
416
418
|
_bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(group, resources) {
|
417
|
-
var
|
419
|
+
var _yield$editDispatcher2, elements, dm, needDeleteHtDatas, nodeElements, newLinkElements, updateElements;
|
418
420
|
|
419
421
|
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
420
422
|
while (1) switch (_context9.prev = _context9.next) {
|
421
423
|
case 0:
|
422
|
-
|
423
|
-
|
424
|
+
rlog.debug("区域关联资源", {
|
425
|
+
group: group,
|
426
|
+
resources: resources
|
427
|
+
});
|
424
428
|
topo.historyManager.beginTransaction();
|
425
|
-
_context9.next =
|
429
|
+
_context9.next = 4;
|
426
430
|
return resourceConfig.updateGroupResources(group, resources);
|
427
431
|
|
428
|
-
case
|
429
|
-
_context9.next =
|
432
|
+
case 4:
|
433
|
+
_context9.next = 6;
|
430
434
|
return editDispatchers.fetchDataByConfig();
|
431
435
|
|
432
|
-
case
|
436
|
+
case 6:
|
433
437
|
_yield$editDispatcher2 = _context9.sent;
|
434
438
|
elements = _yield$editDispatcher2.elements;
|
435
|
-
//
|
439
|
+
rlog.debug("区域关联资源: 元素列表", elements); // 先删除多余的元素
|
440
|
+
|
441
|
+
dm = topo.getDataModel();
|
442
|
+
needDeleteHtDatas = (0, _htElementUtils.getElements)(dm).filter(function (htData) {
|
443
|
+
return htData.a('id') && !elements.find(function (ele) {
|
444
|
+
return ele.id === htData.a('id');
|
445
|
+
});
|
446
|
+
});
|
447
|
+
needDeleteHtDatas.forEach(function (htData) {
|
448
|
+
return dm.remove(htData);
|
449
|
+
}); // 区域里的子区域及子区域的节点、新增的链路
|
450
|
+
// 区域里的所有节点
|
451
|
+
|
436
452
|
nodeElements = (0, _topoData.findGroupChildren)(elements, group);
|
437
453
|
newLinkElements = findUNExistedLinkElements(elements);
|
438
454
|
updateElements = [].concat(nodeElements, newLinkElements);
|
@@ -443,11 +459,21 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
443
459
|
if (topo.linkDynamicStyleExecutor) {
|
444
460
|
topo.linkDynamicStyleExecutor.execute();
|
445
461
|
}
|
446
|
-
}
|
462
|
+
} // const unExistedElements = findUNExistedElements(elements)
|
463
|
+
// const createElementsData = {
|
464
|
+
// groups: unExistedElements.filter((item) => item.type === "group"),
|
465
|
+
// nodes: unExistedElements.filter((item) => item.type === "node"),
|
466
|
+
// links: unExistedElements.filter((item) => item.type === "link"),
|
467
|
+
// linkGroups: unExistedElements.filter((item) => item.type === "linkGroup"),
|
468
|
+
// };
|
469
|
+
// const htTopo = topo.getHtTopo()
|
470
|
+
// htTopo.createElements(createElementsData);
|
471
|
+
// rlog.debug('==> ht: createElements ', createElementsData)
|
472
|
+
|
447
473
|
|
448
474
|
topo.historyManager.endTransaction();
|
449
475
|
|
450
|
-
case
|
476
|
+
case 17:
|
451
477
|
case "end":
|
452
478
|
return _context9.stop();
|
453
479
|
}
|
@@ -743,7 +769,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
743
769
|
type: type,
|
744
770
|
data: data
|
745
771
|
};
|
746
|
-
rlog.debug("
|
772
|
+
rlog.debug("=> ht: saveBind", eventData);
|
747
773
|
emitEvent(_componentTopologyGraph.TopoEvent.EVENT_DATA_RESULT, eventData);
|
748
774
|
};
|
749
775
|
/**
|
@@ -542,7 +542,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
542
542
|
tags: tags
|
543
543
|
});
|
544
544
|
});
|
545
|
-
rlog.debug('
|
545
|
+
rlog.debug(' ==> ht: 推送标注', elementTagsAndTips);
|
546
546
|
var htTopo = topo.getHtTopo();
|
547
547
|
|
548
548
|
if (htTopo) {
|
@@ -553,7 +553,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
553
553
|
try {
|
554
554
|
htTopo.loadTagAndTip(JSON.parse(JSON.stringify(elementTagsAndTips)));
|
555
555
|
} catch (error) {
|
556
|
-
rlog.error('
|
556
|
+
rlog.error(' ==> ht: 推送标注失败', error);
|
557
557
|
}
|
558
558
|
|
559
559
|
(_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '加载标注');
|
@@ -71,7 +71,7 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
71
71
|
|
72
72
|
_proto.setDisabled = function setDisabled(disabled, message) {
|
73
73
|
this.htHistoryManager.setDisabled(disabled);
|
74
|
-
log.debug("HistoryManager.setDisabled " + (disabled ? '禁用' : '启用') +
|
74
|
+
log.debug("HistoryManager.setDisabled: " + (disabled ? '禁用' : '启用') + ". <" + message + ">, " + this.toString() + ", ", 'Histories: ', this.getHistories());
|
75
75
|
};
|
76
76
|
|
77
77
|
_proto.beginTransaction = function beginTransaction(name) {
|
@@ -54,7 +54,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
|
54
54
|
var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
|
55
55
|
|
56
56
|
// eslint-disable-next-line no-undef
|
57
|
-
var version = typeof "12.1.0-dev.
|
57
|
+
var version = typeof "12.1.0-dev.12" === 'string' ? "12.1.0-dev.12" : null;
|
58
58
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
59
59
|
/**
|
60
60
|
* 拓扑显示和编辑
|
@@ -278,13 +278,7 @@ function _default(topoApp) {
|
|
278
278
|
|
279
279
|
case 5:
|
280
280
|
data = _context2.sent;
|
281
|
-
rlog.debug("
|
282
|
-
config: {
|
283
|
-
resources: resources,
|
284
|
-
groups: groups
|
285
|
-
},
|
286
|
-
data: data
|
287
|
-
});
|
281
|
+
rlog.debug("按配置查询拓扑数据. 参数:", query, ", 返回结果: ", data);
|
288
282
|
return _context2.abrupt("return", data);
|
289
283
|
|
290
284
|
case 8:
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "12.1.0-dev.
|
3
|
+
"version": "12.1.0-dev.12",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -123,6 +123,6 @@
|
|
123
123
|
"access": "public"
|
124
124
|
},
|
125
125
|
"license": "MIT",
|
126
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@12.1.0-dev.
|
126
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@12.1.0-dev.12/build/index.html",
|
127
127
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
128
128
|
}
|