@riil-frontend/component-topology 9.0.0-a.8 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/1.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +15 -15
- package/es/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
- package/es/core/components/TopoView/GraphViewPanel.js +17 -4
- package/es/core/components/TopoView/TopoView.module.scss +17 -3
- package/es/core/editor/components/BackgroundView/index.module.scss +3 -0
- package/es/core/editor/components/EditorPlugin.js +4 -1
- package/es/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
- package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
- package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
- package/es/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
- package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
- package/es/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +20 -5
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +5 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +31 -12
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +12 -2
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +6 -0
- package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +1 -1
- package/es/core/editor/components/settings/core/getPropertyViewType.js +3 -0
- package/es/core/editor/components/settings/core/updateElementProperty.js +6 -1
- package/es/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +4 -3
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +3 -2
- package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +95 -0
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +46 -14
- package/es/core/editor/config/themes.js +53 -2
- package/es/core/editor/utils/edgeTypeStyleUtil.js +38 -0
- package/es/core/hooks/useCanvasTheme.js +12 -4
- package/es/core/hooks/useResourceConfig.js +2 -1
- package/es/core/hooks/useTopoEdit.js +120 -19
- package/es/core/hooks/useTopoFullscreen.js +32 -0
- package/es/core/models/AttributeMetricDisplay.js +89 -74
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/attributeFormatter/index.js +16 -16
- package/es/core/models/topoData.js +16 -9
- package/es/core/models/utils/linkUtils.js +52 -27
- package/es/core/store/models/topoConfig.js +51 -20
- package/es/core/test/Test.js +52 -0
- package/es/core/utils/graphLinkUtil.js +11 -6
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +16 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +8 -78
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +14 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +27 -37
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +57 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +6 -0
- package/es/networkTopo/getTopoData.js +2 -1
- package/es/networkTopo/models/IpNodeTagsTipsBuilder.js +113 -0
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +8 -8
- package/es/networkTopo/models/TopoCenter.js +4 -3
- package/es/networkTopo/services/link.js +1 -1
- package/es/networkTopo/services/topo/basic.js +27 -26
- package/es/networkTopo/services/topo/networkLink.js +45 -3
- package/es/networkTopo/utils/exitLinkUtil.js +257 -0
- package/es/style.js +1 -0
- package/es/utils/ResourceConfigUtil.js +5 -4
- package/es/utils/htElementDataUtil.js +1 -7
- package/es/utils/htElementUtils.js +21 -21
- package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
- package/lib/core/components/TopoView/GraphViewPanel.js +18 -3
- package/lib/core/components/TopoView/TopoView.module.scss +17 -3
- package/lib/core/editor/components/BackgroundView/index.module.scss +3 -0
- package/lib/core/editor/components/EditorPlugin.js +7 -1
- package/lib/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
- package/lib/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
- package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
- package/lib/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +19 -3
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +5 -1
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +31 -12
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +12 -2
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +6 -0
- package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +1 -1
- package/lib/core/editor/components/settings/core/getPropertyViewType.js +3 -0
- package/lib/core/editor/components/settings/core/updateElementProperty.js +6 -1
- package/lib/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +3 -3
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +3 -1
- package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +111 -0
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +48 -14
- package/lib/core/editor/config/themes.js +53 -2
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +39 -0
- package/lib/core/hooks/useCanvasTheme.js +12 -4
- package/lib/core/hooks/useResourceConfig.js +2 -1
- package/lib/core/hooks/useTopoEdit.js +121 -18
- package/lib/core/hooks/useTopoFullscreen.js +42 -0
- package/lib/core/models/AttributeMetricDisplay.js +85 -74
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/attributeFormatter/index.js +14 -14
- package/lib/core/models/topoData.js +16 -9
- package/lib/core/models/utils/linkUtils.js +53 -26
- package/lib/core/store/models/topoConfig.js +56 -19
- package/lib/core/test/Test.js +52 -0
- package/lib/core/utils/graphLinkUtil.js +10 -5
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +15 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +7 -78
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +14 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +27 -36
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +58 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +6 -0
- package/lib/networkTopo/getTopoData.js +2 -1
- package/lib/networkTopo/models/IpNodeTagsTipsBuilder.js +123 -0
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +8 -8
- package/lib/networkTopo/models/TopoCenter.js +4 -3
- package/lib/networkTopo/services/topo/basic.js +28 -28
- package/lib/networkTopo/services/topo/networkLink.js +45 -3
- package/lib/networkTopo/utils/exitLinkUtil.js +269 -0
- package/lib/style.js +1 -0
- package/lib/utils/ResourceConfigUtil.js +4 -4
- package/lib/utils/htElementDataUtil.js +0 -10
- package/lib/utils/htElementUtils.js +21 -21
- package/package.json +2 -2
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.getEdgesBySelection = getEdgesBySelection;
|
5
|
+
exports.isNodeAllEdges = isNodeAllEdges;
|
5
6
|
exports.loopEdgesAndChildren = loopEdgesAndChildren;
|
6
7
|
exports.setEdgesAndChildren = setEdgesAndChildren;
|
7
8
|
exports.setEdgesType = setEdgesType;
|
@@ -52,6 +53,44 @@ function getEdgesBySelection(topo) {
|
|
52
53
|
|
53
54
|
return getSelectedEdges(topo.getGraphView());
|
54
55
|
}
|
56
|
+
/**
|
57
|
+
* 根据选中的线查找对应节点下所有的线是否都选中
|
58
|
+
* @param {*} topo
|
59
|
+
* @param {*} edges
|
60
|
+
* @param {*} operateEdgeFn
|
61
|
+
*/
|
62
|
+
|
63
|
+
|
64
|
+
function isNodeAllEdges(topo) {
|
65
|
+
var selection = topo.getSelectionModel().getSelection().toArray(); // 选中的连线
|
66
|
+
|
67
|
+
var edges = selection.filter(function (element) {
|
68
|
+
return element instanceof ht.Edge;
|
69
|
+
});
|
70
|
+
var inEdges = false;
|
71
|
+
edges.forEach(function (edge) {
|
72
|
+
//根据两边节点查询到所有节点有关的线,过滤出相同的线(两个节点间的线)
|
73
|
+
var sourceNode = edge.getSource();
|
74
|
+
var targetNode = edge.getTarget();
|
75
|
+
var nodeLineList = (0, _htElementUtils.getEdgesBetweenNodes)(sourceNode, targetNode);
|
76
|
+
|
77
|
+
var _loop = function _loop(i) {
|
78
|
+
if (edges.filter(function (edge) {
|
79
|
+
return nodeLineList[i]._id == edge._id;
|
80
|
+
}).length == 0) {
|
81
|
+
inEdges = true;
|
82
|
+
return "break";
|
83
|
+
}
|
84
|
+
};
|
85
|
+
|
86
|
+
for (var i = 0; i < nodeLineList.length; i++) {
|
87
|
+
var _ret = _loop(i);
|
88
|
+
|
89
|
+
if (_ret === "break") break;
|
90
|
+
}
|
91
|
+
});
|
92
|
+
return inEdges;
|
93
|
+
}
|
55
94
|
/**
|
56
95
|
* 遍历连线及子连线
|
57
96
|
* @param {*} topo
|
@@ -17,7 +17,7 @@ var themeMap = [{
|
|
17
17
|
name: 'white',
|
18
18
|
label: '白色',
|
19
19
|
color: null,
|
20
|
-
toolsTheme: '
|
20
|
+
toolsTheme: 'white'
|
21
21
|
}, {
|
22
22
|
name: 'lightblue',
|
23
23
|
label: '蓝色',
|
@@ -35,7 +35,12 @@ var themeMap = [{
|
|
35
35
|
name: 'dark',
|
36
36
|
label: '深色',
|
37
37
|
color: '#031425',
|
38
|
-
toolsTheme: '
|
38
|
+
toolsTheme: 'dark'
|
39
|
+
}, {
|
40
|
+
name: 'poly',
|
41
|
+
label: 'Poly',
|
42
|
+
toolsTheme: 'dark',
|
43
|
+
backgroundImage: '/img/topo/themes/poly.png'
|
39
44
|
}].reduce(function (map, item) {
|
40
45
|
var _extends2;
|
41
46
|
|
@@ -52,12 +57,13 @@ function useCanvasTheme(props) {
|
|
52
57
|
|
53
58
|
var themeConfig = themeMap[themeName || 'white'];
|
54
59
|
var canvasColor = hideBackgroundColor ? null : themeConfig.color;
|
60
|
+
var canvasbackgroundImage = hideBackgroundColor ? null : themeConfig.backgroundImage;
|
55
61
|
(0, _react.useEffect)(function () {
|
56
62
|
// 设置
|
57
63
|
if (graphLoaded && themeConfig) {
|
58
64
|
try {
|
59
65
|
topo.getHtTopo().setTheme(themeName);
|
60
|
-
topo.getHtTopo().setToolsTheme(
|
66
|
+
topo.getHtTopo().setToolsTheme(themeConfig.toolsTheme);
|
61
67
|
} catch (error) {
|
62
68
|
console.error('切换主题失败', error);
|
63
69
|
}
|
@@ -68,12 +74,14 @@ function useCanvasTheme(props) {
|
|
68
74
|
if (graphLoaded) {
|
69
75
|
try {
|
70
76
|
topo.getHtTopo().getGraphView().dm().setBackground(canvasColor);
|
77
|
+
topo.getHtTopo().getGraphView().dm().setBackground(canvasbackgroundImage);
|
71
78
|
} catch (error) {
|
72
79
|
console.error('切换主题失败', error);
|
73
80
|
}
|
74
81
|
}
|
75
82
|
}, [graphLoaded, canvasColor]);
|
76
83
|
return {
|
77
|
-
canvasColor: canvasColor
|
84
|
+
canvasColor: canvasColor,
|
85
|
+
canvasbackgroundImage: canvasbackgroundImage
|
78
86
|
};
|
79
87
|
}
|
@@ -59,7 +59,8 @@ function _default(props) {
|
|
59
59
|
resources: config.resources,
|
60
60
|
groups: config.groups,
|
61
61
|
exportLinkIdList: config.exportLinkIdList,
|
62
|
-
relateTopoIdList: config.relateTopoIdList
|
62
|
+
relateTopoIdList: config.relateTopoIdList //linkIps: config.linkIps,
|
63
|
+
|
63
64
|
};
|
64
65
|
};
|
65
66
|
|
@@ -17,14 +17,14 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
17
17
|
|
18
18
|
var _react = require("react");
|
19
19
|
|
20
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
21
|
+
|
20
22
|
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
21
23
|
|
22
24
|
var _componentTopologyGraph = require("@riil-frontend/component-topology-graph");
|
23
25
|
|
24
26
|
var _template = require("../../utils/template");
|
25
27
|
|
26
|
-
var _topoPermissionUtil = _interopRequireDefault(require("../../utils/topoPermissionUtil"));
|
27
|
-
|
28
28
|
var _htElementUtils = require("../../utils/htElementUtils");
|
29
29
|
|
30
30
|
var _useResourceConfig = _interopRequireDefault(require("./useResourceConfig"));
|
@@ -37,6 +37,10 @@ var _htElementDataUtil = require("../../utils/htElementDataUtil");
|
|
37
37
|
|
38
38
|
var _clusterUtil = require("../../utils/clusterUtil");
|
39
39
|
|
40
|
+
var _linkUtils = require("../models/utils/linkUtils");
|
41
|
+
|
42
|
+
var _exitLinkUtil = require("../../networkTopo/utils/exitLinkUtil");
|
43
|
+
|
40
44
|
var useTopoEdit = function useTopoEdit(params) {
|
41
45
|
var topo = params.topo,
|
42
46
|
topoId = params.topoId,
|
@@ -247,7 +251,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
247
251
|
return;
|
248
252
|
}
|
249
253
|
|
250
|
-
if (!(0,
|
254
|
+
if (!(0, _htElementUtils.getGroupChildren)(group).filter(_htElementDataUtil.isResourceElement).length || (0, _clusterUtil.isClusterHtElement)(group)) {
|
251
255
|
doDelete();
|
252
256
|
return;
|
253
257
|
} // 有子节点时需要确认
|
@@ -342,7 +346,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
342
346
|
|
343
347
|
edges.map(function (edge) {
|
344
348
|
if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
|
345
|
-
// exLink.push(edge);
|
349
|
+
// exLink.push(edge);
|
346
350
|
topo.getGraphView().dm().remove(edge);
|
347
351
|
exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
|
348
352
|
}
|
@@ -406,8 +410,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
406
410
|
};
|
407
411
|
/**
|
408
412
|
* 获得未存在的连线元素
|
409
|
-
* @param {*} elements
|
410
|
-
* @returns
|
413
|
+
* @param {*} elements
|
414
|
+
* @returns
|
411
415
|
*/
|
412
416
|
|
413
417
|
|
@@ -420,8 +424,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
420
424
|
}
|
421
425
|
/**
|
422
426
|
* 获得未存在的元素
|
423
|
-
* @param {Array} elements
|
424
|
-
* @returns
|
427
|
+
* @param {Array} elements
|
428
|
+
* @returns
|
425
429
|
*/
|
426
430
|
|
427
431
|
|
@@ -600,7 +604,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
600
604
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
601
605
|
newElements = findUNExistedElements(elements);
|
602
606
|
|
603
|
-
_rlog["default"].debug(
|
607
|
+
_rlog["default"].debug("添加分层资源", {
|
604
608
|
layer: group,
|
605
609
|
newElements: newElements
|
606
610
|
});
|
@@ -674,8 +678,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
674
678
|
}
|
675
679
|
/**
|
676
680
|
* 未选中元素添加资源
|
677
|
-
*
|
678
|
-
* @param {*} data
|
681
|
+
*
|
682
|
+
* @param {*} data
|
679
683
|
*/
|
680
684
|
|
681
685
|
|
@@ -835,7 +839,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
835
839
|
newLinkElements = findUNExistedLinkElements(elements);
|
836
840
|
createElementsData = null;
|
837
841
|
|
838
|
-
if (newData.type ===
|
842
|
+
if (newData.type === "group") {
|
839
843
|
groupChildren = (0, _topoData.findGroupChildren)(elements, newData);
|
840
844
|
newGroupChildren = [];
|
841
845
|
existedGroupChildren = [];
|
@@ -852,10 +856,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
852
856
|
groups: [newData],
|
853
857
|
nodes: newGroupChildren,
|
854
858
|
links: newLinkElements.filter(function (item) {
|
855
|
-
return item.type ===
|
859
|
+
return item.type === "link";
|
856
860
|
}),
|
857
861
|
linkGroups: newLinkElements.filter(function (item) {
|
858
|
-
return item.type ===
|
862
|
+
return item.type === "linkGroup";
|
859
863
|
})
|
860
864
|
};
|
861
865
|
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
@@ -870,16 +874,16 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
870
874
|
groups: [],
|
871
875
|
nodes: [newData],
|
872
876
|
links: newLinkElements.filter(function (item) {
|
873
|
-
return item.type ===
|
877
|
+
return item.type === "link";
|
874
878
|
}),
|
875
879
|
linkGroups: newLinkElements.filter(function (item) {
|
876
|
-
return item.type ===
|
880
|
+
return item.type === "linkGroup";
|
877
881
|
})
|
878
882
|
};
|
879
883
|
htTopo.createElements(createElementsData);
|
880
884
|
}
|
881
885
|
|
882
|
-
_rlog["default"].debug(
|
886
|
+
_rlog["default"].debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
|
883
887
|
|
884
888
|
|
885
889
|
newElement = dm.getDataByTag(newData.id);
|
@@ -999,6 +1003,100 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
999
1003
|
return _ref8.apply(this, arguments);
|
1000
1004
|
};
|
1001
1005
|
}();
|
1006
|
+
/**
|
1007
|
+
* 关联IP的图片节点
|
1008
|
+
*/
|
1009
|
+
|
1010
|
+
|
1011
|
+
function relateNodeIp(_x15, _x16) {
|
1012
|
+
return _relateNodeIp.apply(this, arguments);
|
1013
|
+
}
|
1014
|
+
|
1015
|
+
function _relateNodeIp() {
|
1016
|
+
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(txtValue, nodeElement) {
|
1017
|
+
var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1018
|
+
|
1019
|
+
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
1020
|
+
while (1) {
|
1021
|
+
switch (_context16.prev = _context16.next) {
|
1022
|
+
case 0:
|
1023
|
+
console.log("bindIPtoNode", txtValue, nodeElement);
|
1024
|
+
|
1025
|
+
if (txtValue) {
|
1026
|
+
_context16.next = 3;
|
1027
|
+
break;
|
1028
|
+
}
|
1029
|
+
|
1030
|
+
return _context16.abrupt("return");
|
1031
|
+
|
1032
|
+
case 3:
|
1033
|
+
// if (txtValue === nodeElement.a('bindIp')) {
|
1034
|
+
// return;
|
1035
|
+
// }
|
1036
|
+
// 根据配置查询拓扑数据
|
1037
|
+
dm = topo.getDataModel(); // 执行唯一性验证
|
1038
|
+
|
1039
|
+
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
|
1040
|
+
|
1041
|
+
if (!isUnique) {
|
1042
|
+
_context16.next = 25;
|
1043
|
+
break;
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
|
1047
|
+
_context16.next = 9;
|
1048
|
+
return deleteExLink(nodeElement);
|
1049
|
+
|
1050
|
+
case 9:
|
1051
|
+
nodeElement.a(ip);
|
1052
|
+
nodeElement.setName(txtValue);
|
1053
|
+
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1054
|
+
|
1055
|
+
configObj = topo.resourceConfig.getConfig();
|
1056
|
+
_context16.next = 15;
|
1057
|
+
return resourceConfig.updateConfig(configObj);
|
1058
|
+
|
1059
|
+
case 15:
|
1060
|
+
_context16.next = 17;
|
1061
|
+
return editDispatchers.fetchDataByConfig();
|
1062
|
+
|
1063
|
+
case 17:
|
1064
|
+
configData = _context16.sent;
|
1065
|
+
// console.log("configData",configObj, configData);
|
1066
|
+
_elements = configData.elements;
|
1067
|
+
newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
|
1068
|
+
|
1069
|
+
newLink = newLinkElements.filter(function (item) {
|
1070
|
+
return item.type === "link";
|
1071
|
+
});
|
1072
|
+
newLinkGroup = newLinkElements.filter(function (item) {
|
1073
|
+
return item.type === "linkGroup";
|
1074
|
+
}); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
|
1075
|
+
// console.log("newData",newLinkElements, newLink);
|
1076
|
+
|
1077
|
+
createElementsData = {
|
1078
|
+
groups: [],
|
1079
|
+
nodes: [],
|
1080
|
+
links: newLink,
|
1081
|
+
linkGroups: newLinkGroup
|
1082
|
+
};
|
1083
|
+
console.log("createElementsData", createElementsData);
|
1084
|
+
|
1085
|
+
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1086
|
+
_htTopo = topo.getHtTopo();
|
1087
|
+
|
1088
|
+
_htTopo.createElements(createElementsData);
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
case 25:
|
1092
|
+
case "end":
|
1093
|
+
return _context16.stop();
|
1094
|
+
}
|
1095
|
+
}
|
1096
|
+
}, _callee16);
|
1097
|
+
}));
|
1098
|
+
return _relateNodeIp.apply(this, arguments);
|
1099
|
+
}
|
1002
1100
|
|
1003
1101
|
var onEvent = function onEvent(e) {
|
1004
1102
|
var map = {};
|
@@ -1016,7 +1114,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1016
1114
|
*/
|
1017
1115
|
|
1018
1116
|
var setViewMouseMode = function setViewMouseMode(mode) {
|
1019
|
-
_rlog["default"].debug(
|
1117
|
+
_rlog["default"].debug("设置视图鼠标模式", mode);
|
1020
1118
|
|
1021
1119
|
topo.getHtTopo().setViewMouseMode(mode);
|
1022
1120
|
topoEditDispatchers.update({
|
@@ -1095,6 +1193,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1095
1193
|
*/
|
1096
1194
|
onDeleteElement: onDeleteElement,
|
1097
1195
|
|
1196
|
+
/**
|
1197
|
+
* 绑定图片ip
|
1198
|
+
*/
|
1199
|
+
relateNodeIp: relateNodeIp,
|
1200
|
+
|
1098
1201
|
/**
|
1099
1202
|
* 拓扑图保存回调
|
1100
1203
|
*/
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports["default"] = useTopoFullscreen;
|
5
|
+
|
6
|
+
var _react = _interopRequireWildcard(require("react"));
|
7
|
+
|
8
|
+
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); }
|
9
|
+
|
10
|
+
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; }
|
11
|
+
|
12
|
+
function useTopoFullscreen(props) {
|
13
|
+
var topo = props.topo,
|
14
|
+
panelRef = props.panelRef;
|
15
|
+
var topoModState = topo.store.useModelState('topoMod');
|
16
|
+
var graphLoaded = topoModState.graphLoaded,
|
17
|
+
graphLoaded2 = topoModState.graphLoaded2,
|
18
|
+
topoData = topoModState.data;
|
19
|
+
(0, _react.useEffect)(function () {
|
20
|
+
var htTopo = topo.getHtTopo();
|
21
|
+
|
22
|
+
if ((graphLoaded || graphLoaded2) && topoData && htTopo.setFullScreenFunc) {
|
23
|
+
htTopo.setFullScreenFunc(function () {
|
24
|
+
panelRef.current.requestFullscreen();
|
25
|
+
});
|
26
|
+
}
|
27
|
+
}, [topoData, graphLoaded, graphLoaded2]); // 监听退出全屏
|
28
|
+
|
29
|
+
var panelDom = panelRef.current;
|
30
|
+
(0, _react.useEffect)(function () {
|
31
|
+
panelDom === null || panelDom === void 0 ? void 0 : panelDom.addEventListener('fullscreenchange', handleFullscreenChange); // 监听退出全屏
|
32
|
+
|
33
|
+
function handleFullscreenChange() {
|
34
|
+
var htTopo = topo.getHtTopo();
|
35
|
+
htTopo.setToolsVisible(!document.fullscreenElement);
|
36
|
+
}
|
37
|
+
|
38
|
+
return function () {
|
39
|
+
panelDom === null || panelDom === void 0 ? void 0 : panelDom.removeEventListener('fullscreenchange', handleFullscreenChange);
|
40
|
+
};
|
41
|
+
}, [panelDom]);
|
42
|
+
}
|