@riil-frontend/component-topology 9.0.0-a.3 → 9.0.0-a.31
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 +12 -12
- 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/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 +21 -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/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/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/event/topoEventListener.js +22 -0
- package/es/core/hooks/useAlarm.js +18 -12
- package/es/core/hooks/useCanvasTheme.js +12 -4
- package/es/core/hooks/useResourceConfig.js +2 -1
- package/es/core/hooks/useTopoEdit.js +113 -19
- package/es/core/hooks/useTopoEventListener.js +4 -18
- package/es/core/hooks/useTopoFullscreen.js +32 -0
- package/es/core/models/Alarm.js +4 -13
- package/es/core/models/TopoApp.js +1 -1
- 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/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +11 -35
- 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/LinkTopoCard.js +8 -6
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +28 -56
- 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/hooks/useMetricModels.js +13 -52
- package/es/networkTopo/getTopoData.js +2 -1
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +5 -5
- 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 +262 -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/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 +21 -4
- 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/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/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/event/topoEventListener.js +27 -0
- package/lib/core/hooks/useAlarm.js +19 -12
- package/lib/core/hooks/useCanvasTheme.js +12 -4
- package/lib/core/hooks/useResourceConfig.js +2 -1
- package/lib/core/hooks/useTopoEdit.js +114 -18
- package/lib/core/hooks/useTopoEventListener.js +3 -17
- package/lib/core/hooks/useTopoFullscreen.js +42 -0
- package/lib/core/models/Alarm.js +5 -16
- package/lib/core/models/TopoApp.js +1 -1
- 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/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +10 -35
- 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/LinkTopoCard.js +8 -6
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +28 -55
- 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/hooks/useMetricModels.js +13 -53
- package/lib/networkTopo/getTopoData.js +2 -1
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +5 -5
- package/lib/networkTopo/services/topo/basic.js +28 -28
- package/lib/networkTopo/services/topo/networkLink.js +45 -3
- package/lib/networkTopo/utils/exitLinkUtil.js +274 -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 +3 -3
@@ -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,93 @@ 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, htTopo, elementNodes, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData;
|
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
|
+
// 根据配置查询拓扑数据
|
1034
|
+
dm = topo.getDataModel();
|
1035
|
+
htTopo = topo.getHtTopo();
|
1036
|
+
elementNodes = (0, _htElementUtils.getNodes)(dm); // 执行唯一性验证
|
1037
|
+
|
1038
|
+
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement);
|
1039
|
+
ip = (0, _exitLinkUtil.buildIpNode)(txtValue); // 获取关联链路
|
1040
|
+
|
1041
|
+
if (!isUnique) {
|
1042
|
+
_context16.next = 26;
|
1043
|
+
break;
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
// deleteExLink(nodeElement);
|
1047
|
+
nodeElement.a(ip);
|
1048
|
+
nodeElement.setName(txtValue);
|
1049
|
+
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1050
|
+
|
1051
|
+
configObj = topo.resourceConfig.getConfig();
|
1052
|
+
_context16.next = 15;
|
1053
|
+
return resourceConfig.updateConfig(configObj);
|
1054
|
+
|
1055
|
+
case 15:
|
1056
|
+
_context16.next = 17;
|
1057
|
+
return editDispatchers.fetchDataByConfig();
|
1058
|
+
|
1059
|
+
case 17:
|
1060
|
+
configData = _context16.sent;
|
1061
|
+
// console.log("configData", configData);
|
1062
|
+
_elements = configData.elements;
|
1063
|
+
newLinkElements = findUNExistedLinkElements(_elements);
|
1064
|
+
newLink = newLinkElements.filter(function (item) {
|
1065
|
+
return item.type === "link";
|
1066
|
+
});
|
1067
|
+
newLinkGroup = newLinkElements.filter(function (item) {
|
1068
|
+
return item.type === "linkGroup";
|
1069
|
+
}); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
|
1070
|
+
|
1071
|
+
console.log("newData", newLink);
|
1072
|
+
createElementsData = {
|
1073
|
+
groups: [],
|
1074
|
+
nodes: [],
|
1075
|
+
links: newLink,
|
1076
|
+
linkGroups: newLinkGroup
|
1077
|
+
};
|
1078
|
+
console.log("createElementsData", createElementsData);
|
1079
|
+
|
1080
|
+
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1081
|
+
htTopo.createElements(createElementsData);
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
case 26:
|
1085
|
+
case "end":
|
1086
|
+
return _context16.stop();
|
1087
|
+
}
|
1088
|
+
}
|
1089
|
+
}, _callee16);
|
1090
|
+
}));
|
1091
|
+
return _relateNodeIp.apply(this, arguments);
|
1092
|
+
}
|
1002
1093
|
|
1003
1094
|
var onEvent = function onEvent(e) {
|
1004
1095
|
var map = {};
|
@@ -1016,7 +1107,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1016
1107
|
*/
|
1017
1108
|
|
1018
1109
|
var setViewMouseMode = function setViewMouseMode(mode) {
|
1019
|
-
_rlog["default"].debug(
|
1110
|
+
_rlog["default"].debug("设置视图鼠标模式", mode);
|
1020
1111
|
|
1021
1112
|
topo.getHtTopo().setViewMouseMode(mode);
|
1022
1113
|
topoEditDispatchers.update({
|
@@ -1095,6 +1186,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1095
1186
|
*/
|
1096
1187
|
onDeleteElement: onDeleteElement,
|
1097
1188
|
|
1189
|
+
/**
|
1190
|
+
* 绑定图片ip
|
1191
|
+
*/
|
1192
|
+
relateNodeIp: relateNodeIp,
|
1193
|
+
|
1098
1194
|
/**
|
1099
1195
|
* 拓扑图保存回调
|
1100
1196
|
*/
|
@@ -5,29 +5,15 @@ exports["default"] = useTopoEventListener;
|
|
5
5
|
|
6
6
|
var _react = require("react");
|
7
7
|
|
8
|
-
var
|
8
|
+
var _topoEventListener = require("../event/topoEventListener");
|
9
9
|
|
10
10
|
function useTopoEventListener(props) {
|
11
11
|
var type = props.type,
|
12
12
|
onMessage = props.onMessage;
|
13
|
-
var eventListenerName = (0, _react.useMemo)(function () {
|
14
|
-
return "topo_" + n++;
|
15
|
-
}, []);
|
16
13
|
(0, _react.useEffect)(function () {
|
17
|
-
var
|
18
|
-
|
19
|
-
if (EE) {
|
20
|
-
window.EE.on('topo', eventListenerName, function (data) {
|
21
|
-
if (data.type === type) {
|
22
|
-
onMessage(data.data);
|
23
|
-
}
|
24
|
-
});
|
25
|
-
}
|
26
|
-
|
14
|
+
var listener = (0, _topoEventListener.createTopoEventListener)(type, onMessage);
|
27
15
|
return function () {
|
28
|
-
|
29
|
-
window.EE.removeListener('topo', eventListenerName);
|
30
|
-
}
|
16
|
+
listener.close();
|
31
17
|
};
|
32
18
|
}, [type, onMessage]);
|
33
19
|
}
|
@@ -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
|
+
}
|
package/lib/core/models/Alarm.js
CHANGED
@@ -19,8 +19,8 @@ var _componentRiilEventEmitter = require("@riil-frontend/component-riil-event-em
|
|
19
19
|
|
20
20
|
var _utils = require("@riil-frontend/utils");
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
var _topoEventListener = require("../event/topoEventListener");
|
23
|
+
|
24
24
|
var Alarm = /*#__PURE__*/function () {
|
25
25
|
function Alarm() {
|
26
26
|
this.topo = void 0;
|
@@ -394,8 +394,6 @@ var Alarm = /*#__PURE__*/function () {
|
|
394
394
|
/*#__PURE__*/
|
395
395
|
function () {
|
396
396
|
var _openTopoAlarm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(id) {
|
397
|
-
var _this2 = this;
|
398
|
-
|
399
397
|
var _this$getState2, alarmOpening, topoAlarmIsOpen, alarmDispatchers;
|
400
398
|
|
401
399
|
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
@@ -427,20 +425,13 @@ var Alarm = /*#__PURE__*/function () {
|
|
427
425
|
|
428
426
|
case 10:
|
429
427
|
this.secretKey = _context6.sent;
|
430
|
-
|
431
428
|
// rlog.debug("openTopoAlarm 获取初始化告警-------------------开始");
|
432
|
-
_componentRiilEventEmitter.EE.on("topo", "topo", function (data, other) {
|
433
|
-
_rlog["default"].debug("openTopoAlarm 获取初始化告警------收到信息", data);
|
434
|
-
|
435
|
-
_this2.handleAlarmEvent(data);
|
436
|
-
});
|
437
|
-
|
438
429
|
this.updateState({
|
439
430
|
alarmOpening: false,
|
440
431
|
alarmIsOpened: true
|
441
432
|
});
|
442
433
|
|
443
|
-
case
|
434
|
+
case 12:
|
444
435
|
case "end":
|
445
436
|
return _context6.stop();
|
446
437
|
}
|
@@ -486,17 +477,15 @@ var Alarm = /*#__PURE__*/function () {
|
|
486
477
|
|
487
478
|
_rlog["default"].debug("useAlarm.useEffect 告警WebSocket 结束");
|
488
479
|
|
489
|
-
_componentRiilEventEmitter.EE.removeListener("topo", "topo");
|
490
|
-
|
491
480
|
this.updateState({
|
492
481
|
topoAlarmIsOpen: false,
|
493
482
|
alarmOpening: false,
|
494
483
|
alarmPanelIsOpen: false
|
495
484
|
});
|
496
|
-
_context7.next =
|
485
|
+
_context7.next = 8;
|
497
486
|
return this.topo.serverApi.closeTopoAlarm(id, this.secretKey);
|
498
487
|
|
499
|
-
case
|
488
|
+
case 8:
|
500
489
|
case "end":
|
501
490
|
return _context7.stop();
|
502
491
|
}
|
@@ -56,7 +56,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
|
56
56
|
var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
|
57
57
|
|
58
58
|
// eslint-disable-next-line no-undef
|
59
|
-
var version = typeof "9.0.0-a.
|
59
|
+
var version = typeof "9.0.0-a.31" === 'string' ? "9.0.0-a.31" : null;
|
60
60
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
61
61
|
/**
|
62
62
|
* 拓扑显示和编辑
|
@@ -25,8 +25,8 @@ function getLayoutId(layout) {
|
|
25
25
|
|
26
26
|
if (typeof layout === "string") {
|
27
27
|
return {
|
28
|
-
v:
|
29
|
-
h:
|
28
|
+
v: "towardeast",
|
29
|
+
h: "towardsouth"
|
30
30
|
}[layout] || layout;
|
31
31
|
}
|
32
32
|
|
@@ -57,7 +57,7 @@ function saveTopo(_x) {
|
|
57
57
|
|
58
58
|
function _saveTopo() {
|
59
59
|
_saveTopo = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
|
60
|
-
var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, exportLinkIdList, relateTopoIdList, viewGroupId, groupInfo, viewResources;
|
60
|
+
var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, exportLinkIdList, relateTopoIdList, viewGroupId, groupInfo, viewResources, linkIps;
|
61
61
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
62
62
|
while (1) {
|
63
63
|
switch (_context.prev = _context.next) {
|
@@ -91,7 +91,7 @@ function _saveTopo() {
|
|
91
91
|
|
92
92
|
case 8:
|
93
93
|
if (!(resources || groups)) {
|
94
|
-
_context.next =
|
94
|
+
_context.next = 16;
|
95
95
|
break;
|
96
96
|
}
|
97
97
|
|
@@ -113,25 +113,32 @@ function _saveTopo() {
|
|
113
113
|
});
|
114
114
|
}
|
115
115
|
|
116
|
+
linkIps = []; // resources?.static.map((nodeId) => {
|
117
|
+
// if (nodeId.startsWith("ip_")) {
|
118
|
+
// linkIps.push(nodeId.replace("ip_", ""));
|
119
|
+
// }
|
120
|
+
// });
|
121
|
+
|
116
122
|
_rlog["default"].debug("saveTopo-groupInfo", groupInfo);
|
117
123
|
|
118
|
-
_context.next =
|
124
|
+
_context.next = 16;
|
119
125
|
return topoService.bindResourceToTopo(topoId, {
|
120
126
|
groups: groupInfo,
|
127
|
+
linkIps: linkIps,
|
121
128
|
exportLinkIdList: exportLinkIdList,
|
122
129
|
relateTopoIdList: relateTopoIdList
|
123
130
|
});
|
124
131
|
|
125
|
-
case
|
132
|
+
case 16:
|
126
133
|
if (!serialize) {
|
127
|
-
_context.next =
|
134
|
+
_context.next = 19;
|
128
135
|
break;
|
129
136
|
}
|
130
137
|
|
131
|
-
_context.next =
|
138
|
+
_context.next = 19;
|
132
139
|
return topoService.saveSerializeData(topoId, serialize);
|
133
140
|
|
134
|
-
case
|
141
|
+
case 19:
|
135
142
|
case "end":
|
136
143
|
return _context.stop();
|
137
144
|
}
|
@@ -8,6 +8,7 @@ exports.compatibleWith = void 0;
|
|
8
8
|
exports.getLinksDetail = getLinksDetail;
|
9
9
|
exports.isCrucialLink = isCrucialLink;
|
10
10
|
exports.isExitLink = isExitLink;
|
11
|
+
exports.mergeExportLinkData = void 0;
|
11
12
|
exports.mergeLinksData = mergeLinksData;
|
12
13
|
exports.showLinkByConfig = exports.plurals = void 0;
|
13
14
|
|
@@ -41,44 +42,51 @@ var _CiCache = _interopRequireDefault(require("../cache/CiCache"));
|
|
41
42
|
|
42
43
|
/**
|
43
44
|
* 是否关键链路
|
44
|
-
* @param {*} link
|
45
|
-
* @returns
|
45
|
+
* @param {*} link
|
46
|
+
* @returns
|
46
47
|
*/
|
47
48
|
function isCrucialLink(link) {
|
48
|
-
return !!link.attributes[
|
49
|
+
return !!link.attributes["network_link.is_crucial"];
|
49
50
|
}
|
50
51
|
/**
|
51
52
|
* 是否出口链路
|
52
|
-
* @param {*} link
|
53
|
-
* @returns
|
53
|
+
* @param {*} link
|
54
|
+
* @returns
|
54
55
|
*/
|
55
56
|
|
56
57
|
|
57
58
|
function isExitLink(link) {
|
58
|
-
return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes[
|
59
|
+
return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes["destination_id"]);
|
59
60
|
}
|
60
61
|
|
61
62
|
function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
|
62
|
-
var linkCiMap = (0, _keyBy["default"])(links,
|
63
|
+
var linkCiMap = (0, _keyBy["default"])(links, "id");
|
63
64
|
return links.map(function (link) {
|
64
65
|
var _interfaceCiMap$attri, _interfaceCiMap$attri2;
|
65
66
|
|
66
67
|
var linkCi = linkCiMap[link.id];
|
67
68
|
var attributes = (0, _extends2["default"])({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes);
|
68
69
|
var sourceNode = nodes.find(function (node) {
|
69
|
-
return node.id === attributes[
|
70
|
+
return node.id === attributes["network_link.source_device_id"];
|
70
71
|
});
|
71
72
|
var targetNode = nodes.find(function (node) {
|
72
|
-
return node.id === attributes[
|
73
|
-
});
|
73
|
+
return node.id === attributes["network_link.destination_device_id"];
|
74
|
+
});
|
75
|
+
var target = link.target; // 目的端为ip节点
|
76
|
+
|
77
|
+
if (attributes["destination_type"] === "ip") {
|
78
|
+
target = "ip:" + attributes["network_link.destination_ipv4"];
|
79
|
+
} // 翻译
|
80
|
+
|
74
81
|
|
75
82
|
return (0, _extends2["default"])({}, link, {
|
83
|
+
target: target,
|
76
84
|
attributes: (0, _extends2["default"])({}, attributes, {
|
77
85
|
// 源/目的设备
|
78
|
-
|
86
|
+
"network_link.source_device_id_object": {
|
79
87
|
displayName: sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.name
|
80
88
|
},
|
81
|
-
|
89
|
+
"network_link.destination_device_id_object": {
|
82
90
|
displayName: targetNode === null || targetNode === void 0 ? void 0 : targetNode.name
|
83
91
|
},
|
84
92
|
// 源/目的接口类型
|
@@ -86,10 +94,10 @@ function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
|
|
86
94
|
destination_type_object: interfaceDoc[attributes.destination_type],
|
87
95
|
// 源/目的接口
|
88
96
|
source_id_object: {
|
89
|
-
displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes[
|
97
|
+
displayName: (_interfaceCiMap$attri = interfaceCiMap[attributes.source_id]) === null || _interfaceCiMap$attri === void 0 ? void 0 : _interfaceCiMap$attri.attributes["display_name"]
|
90
98
|
},
|
91
99
|
destination_id_object: {
|
92
|
-
displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes[
|
100
|
+
displayName: (_interfaceCiMap$attri2 = interfaceCiMap[attributes.destination_id]) === null || _interfaceCiMap$attri2 === void 0 ? void 0 : _interfaceCiMap$attri2.attributes["display_name"]
|
93
101
|
}
|
94
102
|
})
|
95
103
|
});
|
@@ -129,7 +137,7 @@ function _getLinksDetail() {
|
|
129
137
|
}), linkCis.map(function (item) {
|
130
138
|
return item.attributes.destination_type;
|
131
139
|
})))).filter(function (item) {
|
132
|
-
return item !==
|
140
|
+
return item !== "ip";
|
133
141
|
});
|
134
142
|
_context.next = 7;
|
135
143
|
return _CiCache["default"].load(interfaceIds);
|
@@ -173,10 +181,10 @@ var compatibleWith = function compatibleWith(value) {
|
|
173
181
|
exports.compatibleWith = compatibleWith;
|
174
182
|
var plurals = {
|
175
183
|
0: [],
|
176
|
-
1: [
|
177
|
-
2: [
|
178
|
-
3: [
|
179
|
-
4: [
|
184
|
+
1: ["phy"],
|
185
|
+
2: ["phy"],
|
186
|
+
3: ["agg"],
|
187
|
+
4: ["phy", "agg"]
|
180
188
|
};
|
181
189
|
exports.plurals = plurals;
|
182
190
|
|
@@ -193,29 +201,48 @@ var showLinkByConfig = function showLinkByConfig(props) {
|
|
193
201
|
var dm = gv.getDataModel();
|
194
202
|
var edges = (0, _htElementUtils.getEdges)(dm); // console.log("edges", edges);
|
195
203
|
|
196
|
-
var showPhy = types.indexOf(
|
197
|
-
var showAgg = types.indexOf(
|
204
|
+
var showPhy = types.indexOf("phy") >= 0;
|
205
|
+
var showAgg = types.indexOf("agg") >= 0; // console.log("edges----types",showType, types,showPhy, showAgg);
|
198
206
|
|
199
207
|
if (Array.isArray(edges) && edges.length > 0) {
|
200
208
|
edges.map(function (edge) {
|
201
209
|
if (showType === 1 || showType === true) {
|
202
210
|
// 单链路全部显示
|
203
211
|
// console.log("单链路全部显示", edge);
|
204
|
-
edge.s(
|
212
|
+
edge.s("2d.visible", true);
|
205
213
|
} else {
|
206
214
|
var _d$attributes, _d$attributes2;
|
207
215
|
|
208
216
|
var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
|
209
217
|
|
210
|
-
if ((d === null || d === void 0 ? void 0 : (_d$attributes = d.attributes) === null || _d$attributes === void 0 ? void 0 : _d$attributes.destination_type) ===
|
211
|
-
edge.s(
|
218
|
+
if ((d === null || d === void 0 ? void 0 : (_d$attributes = d.attributes) === null || _d$attributes === void 0 ? void 0 : _d$attributes.destination_type) === "network.agg_interface" && (d === null || d === void 0 ? void 0 : (_d$attributes2 = d.attributes) === null || _d$attributes2 === void 0 ? void 0 : _d$attributes2.source_type) === "network.agg_interface") {
|
219
|
+
edge.s("2d.visible", showAgg);
|
212
220
|
} else {
|
213
221
|
// console.log("edge", edge, d, showAgg);
|
214
|
-
edge.s(
|
222
|
+
edge.s("2d.visible", showPhy);
|
215
223
|
}
|
216
224
|
}
|
217
225
|
});
|
218
226
|
}
|
219
227
|
};
|
220
228
|
|
221
|
-
exports.showLinkByConfig = showLinkByConfig;
|
229
|
+
exports.showLinkByConfig = showLinkByConfig;
|
230
|
+
|
231
|
+
var mergeExportLinkData = function mergeExportLinkData(props) {
|
232
|
+
var source = props.source,
|
233
|
+
target = props.target,
|
234
|
+
link = props.link;
|
235
|
+
var attrObj = link.attributes;
|
236
|
+
var linkData = (0, _extends2["default"])({}, link, {
|
237
|
+
name: attrObj.name,
|
238
|
+
source: attrObj["network_link.source_device_id"],
|
239
|
+
target: attrObj.destination_type === "ip" ? target.getTag() : attrObj["network_link.destination_device_id"],
|
240
|
+
operation: attrObj.operation,
|
241
|
+
interfaceSource: attrObj["source_id"],
|
242
|
+
interfaceTarget: attrObj["destination_id"],
|
243
|
+
ciType: link.typeCode
|
244
|
+
});
|
245
|
+
return linkData;
|
246
|
+
};
|
247
|
+
|
248
|
+
exports.mergeExportLinkData = mergeExportLinkData;
|