@riil-frontend/component-topology 9.0.0-a.3 → 9.0.0-a.30
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 +97 -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 +257 -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 +98 -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 +269 -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
@@ -22,7 +22,9 @@ var baseLightTheme = {
|
|
22
22
|
'group.title.color': '#4D6277',
|
23
23
|
// 标题文字颜色
|
24
24
|
'group.background': 'rgba(255, 255, 255, 0.9)',
|
25
|
-
'group.border.color': '#E4E9EE'
|
25
|
+
'group.border.color': '#E4E9EE',
|
26
|
+
// 边框颜色
|
27
|
+
'group.splitLine': false // 标题底部边框
|
26
28
|
|
27
29
|
}
|
28
30
|
},
|
@@ -84,7 +86,56 @@ var THEMES = [_extends({}, baseLightTheme, {
|
|
84
86
|
'group.title.color': '#FFFFFF',
|
85
87
|
// 标题文字颜色
|
86
88
|
'group.background': 'rgba(29,55,113,0.6)',
|
87
|
-
'group.border.color': 'rgba(8,165,244,0.8)'
|
89
|
+
'group.border.color': 'rgba(8,165,244,0.8)',
|
90
|
+
// 边框颜色
|
91
|
+
'group.splitLine': false // 标题底部边框
|
92
|
+
|
93
|
+
}
|
94
|
+
},
|
95
|
+
cluster: {
|
96
|
+
style: {
|
97
|
+
'group.title.color': '#FFFFFF',
|
98
|
+
// 标题文字颜色
|
99
|
+
'group.title.background': 'rgba(14,44,69,1)',
|
100
|
+
// 标题背景颜色 #0E2C45
|
101
|
+
'group.background': 'rgba(14,44,69,1)',
|
102
|
+
// #0E2C45
|
103
|
+
'group.border.color': '#08A5F4',
|
104
|
+
// 边框颜色
|
105
|
+
'group.border.radius': 3
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}, {
|
109
|
+
name: 'poly',
|
110
|
+
label: 'Poly',
|
111
|
+
toolsTheme: 'black',
|
112
|
+
backgroundImage: '/img/topo/themes/poly.png',
|
113
|
+
backgroundImageThumbnail: '/img/topo/themes/poly_thumbnail.png',
|
114
|
+
globalNodeLabelStyle: {
|
115
|
+
color: '#ffffff'
|
116
|
+
},
|
117
|
+
globalEdgeTagStyle: {
|
118
|
+
color: '#E4E9EE',
|
119
|
+
background: 'rgba(6, 54, 88, 1)',
|
120
|
+
// 背景色,不传使用默认内置 @V1.2 index.js:1 #063658
|
121
|
+
borderColor: '#08A5F4' // 边框颜色,不传使用默认内置。用于主题切换 @V1.2
|
122
|
+
|
123
|
+
},
|
124
|
+
text: {
|
125
|
+
color: '#ffffff'
|
126
|
+
},
|
127
|
+
group: {
|
128
|
+
style: {
|
129
|
+
'group.title.background': 'rgba(0,0,0,0.01)',
|
130
|
+
// 标题背景颜色 #08A5F4
|
131
|
+
'group.title.color': '#8FECFF',
|
132
|
+
// 标题文字颜色
|
133
|
+
'group.title.border.color': '#ffffff',
|
134
|
+
// 边框颜色
|
135
|
+
'group.background': 'rgba(0,0,0,0.01)',
|
136
|
+
'group.border.color': '#ffffff',
|
137
|
+
// 边框颜色
|
138
|
+
'group.splitLine': true // 标题底部边框
|
88
139
|
|
89
140
|
}
|
90
141
|
},
|
@@ -0,0 +1,22 @@
|
|
1
|
+
var n = 0;
|
2
|
+
export function createTopoEventListener(type, onMessage) {
|
3
|
+
var eventListenerName = "topo_" + n++;
|
4
|
+
var EE = window.EE;
|
5
|
+
|
6
|
+
if (EE) {
|
7
|
+
EE.on('topo', eventListenerName, function (data) {
|
8
|
+
if (data.type === type) {
|
9
|
+
onMessage(data.data);
|
10
|
+
}
|
11
|
+
});
|
12
|
+
}
|
13
|
+
|
14
|
+
return {
|
15
|
+
eventListenerName: eventListenerName,
|
16
|
+
close: function close() {
|
17
|
+
if (EE) {
|
18
|
+
window.EE.removeListener('topo', eventListenerName);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
};
|
22
|
+
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import { useEffect } from "react";
|
3
3
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
4
|
-
import { useCbbEventListener } from "@riil-frontend/component-riil-event-emitter";
|
5
4
|
import useGraphAlarmDisplay from "./useGraphAlarmDisplay";
|
5
|
+
import useTopoEventListener from "./useTopoEventListener";
|
6
6
|
/**
|
7
7
|
*
|
8
8
|
*
|
@@ -104,20 +104,26 @@ export default function useAlarm(options) {
|
|
104
104
|
received: data,
|
105
105
|
all: relateTopoAlarm
|
106
106
|
});
|
107
|
-
};
|
107
|
+
}; // 订阅消息
|
108
|
+
|
108
109
|
|
109
|
-
|
110
|
-
|
110
|
+
useTopoEventListener({
|
111
|
+
type: 'alarm',
|
111
112
|
onMessage: function onMessage(data) {
|
112
113
|
rlog.debug("Topoget--AlertMesage------------", topo, data);
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
114
|
+
topo.alarm.handleAlarmEvent(data);
|
115
|
+
}
|
116
|
+
});
|
117
|
+
useTopoEventListener({
|
118
|
+
type: 'risk',
|
119
|
+
onMessage: function onMessage(data) {
|
120
|
+
handleRiskData(data);
|
121
|
+
}
|
122
|
+
});
|
123
|
+
useTopoEventListener({
|
124
|
+
type: 'relateTopoAlarm',
|
125
|
+
onMessage: function onMessage(data) {
|
126
|
+
handleRelateTopoAlarm(data);
|
121
127
|
}
|
122
128
|
});
|
123
129
|
}
|
@@ -4,7 +4,7 @@ var themeMap = [{
|
|
4
4
|
name: 'white',
|
5
5
|
label: '白色',
|
6
6
|
color: null,
|
7
|
-
toolsTheme: '
|
7
|
+
toolsTheme: 'white'
|
8
8
|
}, {
|
9
9
|
name: 'lightblue',
|
10
10
|
label: '蓝色',
|
@@ -22,7 +22,12 @@ var themeMap = [{
|
|
22
22
|
name: 'dark',
|
23
23
|
label: '深色',
|
24
24
|
color: '#031425',
|
25
|
-
toolsTheme: '
|
25
|
+
toolsTheme: 'dark'
|
26
|
+
}, {
|
27
|
+
name: 'poly',
|
28
|
+
label: 'Poly',
|
29
|
+
toolsTheme: 'dark',
|
30
|
+
backgroundImage: '/img/topo/themes/poly.png'
|
26
31
|
}].reduce(function (map, item) {
|
27
32
|
var _extends2;
|
28
33
|
|
@@ -38,12 +43,13 @@ export default function useCanvasTheme(props) {
|
|
38
43
|
|
39
44
|
var themeConfig = themeMap[themeName || 'white'];
|
40
45
|
var canvasColor = hideBackgroundColor ? null : themeConfig.color;
|
46
|
+
var canvasbackgroundImage = hideBackgroundColor ? null : themeConfig.backgroundImage;
|
41
47
|
useEffect(function () {
|
42
48
|
// 设置
|
43
49
|
if (graphLoaded && themeConfig) {
|
44
50
|
try {
|
45
51
|
topo.getHtTopo().setTheme(themeName);
|
46
|
-
topo.getHtTopo().setToolsTheme(
|
52
|
+
topo.getHtTopo().setToolsTheme(themeConfig.toolsTheme);
|
47
53
|
} catch (error) {
|
48
54
|
console.error('切换主题失败', error);
|
49
55
|
}
|
@@ -54,12 +60,14 @@ export default function useCanvasTheme(props) {
|
|
54
60
|
if (graphLoaded) {
|
55
61
|
try {
|
56
62
|
topo.getHtTopo().getGraphView().dm().setBackground(canvasColor);
|
63
|
+
topo.getHtTopo().getGraphView().dm().setBackground(canvasbackgroundImage);
|
57
64
|
} catch (error) {
|
58
65
|
console.error('切换主题失败', error);
|
59
66
|
}
|
60
67
|
}
|
61
68
|
}, [graphLoaded, canvasColor]);
|
62
69
|
return {
|
63
|
-
canvasColor: canvasColor
|
70
|
+
canvasColor: canvasColor,
|
71
|
+
canvasbackgroundImage: canvasbackgroundImage
|
64
72
|
};
|
65
73
|
}
|
@@ -45,7 +45,8 @@ export default function (props) {
|
|
45
45
|
resources: config.resources,
|
46
46
|
groups: config.groups,
|
47
47
|
exportLinkIdList: config.exportLinkIdList,
|
48
|
-
relateTopoIdList: config.relateTopoIdList
|
48
|
+
relateTopoIdList: config.relateTopoIdList //linkIps: config.linkIps,
|
49
|
+
|
49
50
|
};
|
50
51
|
};
|
51
52
|
|
@@ -4,16 +4,18 @@ import _Dialog from "@alifd/next/es/dialog";
|
|
4
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
6
6
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
7
|
+
import _ from "lodash";
|
7
8
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
8
9
|
import { TopoEvent } from "@riil-frontend/component-topology-graph";
|
9
10
|
import { TPL_BLANK, TPL_TREE } from "../../utils/template";
|
10
|
-
import
|
11
|
-
import { getElements, getGroupElementByTag, isEdge, isExistedElement, isGroup, isLayer, isNode } from "../../utils/htElementUtils";
|
11
|
+
import { getGroupElementByTag, isEdge, isExistedElement, isGroup, isLayer, isNode, getNodes, getGroupChildren } from "../../utils/htElementUtils";
|
12
12
|
import useResourceConfig from "./useResourceConfig";
|
13
13
|
import useGroupAddResource from "./useGroupAddResource";
|
14
14
|
import { findGroupChildren } from "../../utils/topoData";
|
15
|
-
import {
|
15
|
+
import { isResourceElement } from "../../utils/htElementDataUtil";
|
16
16
|
import { isClusterHtElement, isClusterMemberHtElement } from "../../utils/clusterUtil";
|
17
|
+
import { mergeExportLinkData } from "../models/utils/linkUtils";
|
18
|
+
import { isUniqueIp, buildIpNode } from "../../networkTopo/utils/exitLinkUtil";
|
17
19
|
|
18
20
|
var useTopoEdit = function useTopoEdit(params) {
|
19
21
|
var topo = params.topo,
|
@@ -220,7 +222,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
220
222
|
return;
|
221
223
|
}
|
222
224
|
|
223
|
-
if (!
|
225
|
+
if (!getGroupChildren(group).filter(isResourceElement).length || isClusterHtElement(group)) {
|
224
226
|
doDelete();
|
225
227
|
return;
|
226
228
|
} // 有子节点时需要确认
|
@@ -315,7 +317,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
315
317
|
|
316
318
|
edges.map(function (edge) {
|
317
319
|
if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
|
318
|
-
// exLink.push(edge);
|
320
|
+
// exLink.push(edge);
|
319
321
|
topo.getGraphView().dm().remove(edge);
|
320
322
|
exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
|
321
323
|
}
|
@@ -378,8 +380,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
378
380
|
};
|
379
381
|
/**
|
380
382
|
* 获得未存在的连线元素
|
381
|
-
* @param {*} elements
|
382
|
-
* @returns
|
383
|
+
* @param {*} elements
|
384
|
+
* @returns
|
383
385
|
*/
|
384
386
|
|
385
387
|
|
@@ -392,8 +394,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
392
394
|
}
|
393
395
|
/**
|
394
396
|
* 获得未存在的元素
|
395
|
-
* @param {Array} elements
|
396
|
-
* @returns
|
397
|
+
* @param {Array} elements
|
398
|
+
* @returns
|
397
399
|
*/
|
398
400
|
|
399
401
|
|
@@ -569,7 +571,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
569
571
|
elements = _yield$editDispatcher4.elements;
|
570
572
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
571
573
|
newElements = findUNExistedElements(elements);
|
572
|
-
rlog.debug(
|
574
|
+
rlog.debug("添加分层资源", {
|
573
575
|
layer: group,
|
574
576
|
newElements: newElements
|
575
577
|
});
|
@@ -642,8 +644,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
642
644
|
}
|
643
645
|
/**
|
644
646
|
* 未选中元素添加资源
|
645
|
-
*
|
646
|
-
* @param {*} data
|
647
|
+
*
|
648
|
+
* @param {*} data
|
647
649
|
*/
|
648
650
|
|
649
651
|
|
@@ -800,7 +802,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
800
802
|
newLinkElements = findUNExistedLinkElements(elements);
|
801
803
|
createElementsData = null;
|
802
804
|
|
803
|
-
if (newData.type ===
|
805
|
+
if (newData.type === "group") {
|
804
806
|
groupChildren = findGroupChildren(elements, newData);
|
805
807
|
newGroupChildren = [];
|
806
808
|
existedGroupChildren = [];
|
@@ -817,10 +819,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
817
819
|
groups: [newData],
|
818
820
|
nodes: newGroupChildren,
|
819
821
|
links: newLinkElements.filter(function (item) {
|
820
|
-
return item.type ===
|
822
|
+
return item.type === "link";
|
821
823
|
}),
|
822
824
|
linkGroups: newLinkElements.filter(function (item) {
|
823
|
-
return item.type ===
|
825
|
+
return item.type === "linkGroup";
|
824
826
|
})
|
825
827
|
};
|
826
828
|
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
@@ -835,16 +837,16 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
835
837
|
groups: [],
|
836
838
|
nodes: [newData],
|
837
839
|
links: newLinkElements.filter(function (item) {
|
838
|
-
return item.type ===
|
840
|
+
return item.type === "link";
|
839
841
|
}),
|
840
842
|
linkGroups: newLinkElements.filter(function (item) {
|
841
|
-
return item.type ===
|
843
|
+
return item.type === "linkGroup";
|
842
844
|
})
|
843
845
|
};
|
844
846
|
htTopo.createElements(createElementsData);
|
845
847
|
}
|
846
848
|
|
847
|
-
rlog.debug(
|
849
|
+
rlog.debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
|
848
850
|
|
849
851
|
newElement = dm.getDataByTag(newData.id);
|
850
852
|
|
@@ -960,6 +962,77 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
960
962
|
return _ref8.apply(this, arguments);
|
961
963
|
};
|
962
964
|
}();
|
965
|
+
/**
|
966
|
+
* 关联IP的图片节点
|
967
|
+
*/
|
968
|
+
|
969
|
+
|
970
|
+
function relateNodeIp(_x15, _x16) {
|
971
|
+
return _relateNodeIp.apply(this, arguments);
|
972
|
+
}
|
973
|
+
|
974
|
+
function _relateNodeIp() {
|
975
|
+
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(txtValue, nodeElement) {
|
976
|
+
var dm, htTopo, elementNodes, isUnique, ip, configObj, configData, _elements, newLinkElements, createElementsData;
|
977
|
+
|
978
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
979
|
+
while (1) {
|
980
|
+
switch (_context16.prev = _context16.next) {
|
981
|
+
case 0:
|
982
|
+
// console.log("bindIPtoNode", txtValue, nodeElement);
|
983
|
+
// 根据配置查询拓扑数据
|
984
|
+
dm = topo.getDataModel();
|
985
|
+
htTopo = topo.getHtTopo();
|
986
|
+
elementNodes = getNodes(dm); // 执行唯一性验证
|
987
|
+
|
988
|
+
isUnique = isUniqueIp(dm, txtValue, nodeElement);
|
989
|
+
ip = buildIpNode(txtValue); // 获取关联链路
|
990
|
+
|
991
|
+
if (!isUnique) {
|
992
|
+
_context16.next = 21;
|
993
|
+
break;
|
994
|
+
}
|
995
|
+
|
996
|
+
deleteExLink(nodeElement);
|
997
|
+
nodeElement.a(ip);
|
998
|
+
nodeElement.setName(txtValue);
|
999
|
+
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1000
|
+
|
1001
|
+
configObj = topo.resourceConfig.getConfig();
|
1002
|
+
_context16.next = 13;
|
1003
|
+
return resourceConfig.updateConfig(configObj);
|
1004
|
+
|
1005
|
+
case 13:
|
1006
|
+
_context16.next = 15;
|
1007
|
+
return editDispatchers.fetchDataByConfig();
|
1008
|
+
|
1009
|
+
case 15:
|
1010
|
+
configData = _context16.sent;
|
1011
|
+
// console.log("configData", configData);
|
1012
|
+
_elements = configData.elements;
|
1013
|
+
newLinkElements = findUNExistedLinkElements(_elements);
|
1014
|
+
createElementsData = {
|
1015
|
+
groups: [],
|
1016
|
+
nodes: [],
|
1017
|
+
links: newLinkElements.filter(function (item) {
|
1018
|
+
return item.type === "link";
|
1019
|
+
}),
|
1020
|
+
linkGroups: newLinkElements.filter(function (item) {
|
1021
|
+
return item.type === "linkGroup";
|
1022
|
+
})
|
1023
|
+
};
|
1024
|
+
console.log("createElementsData", createElementsData);
|
1025
|
+
htTopo.createElements(createElementsData);
|
1026
|
+
|
1027
|
+
case 21:
|
1028
|
+
case "end":
|
1029
|
+
return _context16.stop();
|
1030
|
+
}
|
1031
|
+
}
|
1032
|
+
}, _callee16);
|
1033
|
+
}));
|
1034
|
+
return _relateNodeIp.apply(this, arguments);
|
1035
|
+
}
|
963
1036
|
|
964
1037
|
var onEvent = function onEvent(e) {
|
965
1038
|
var map = {};
|
@@ -977,7 +1050,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
977
1050
|
*/
|
978
1051
|
|
979
1052
|
var setViewMouseMode = function setViewMouseMode(mode) {
|
980
|
-
rlog.debug(
|
1053
|
+
rlog.debug("设置视图鼠标模式", mode);
|
981
1054
|
topo.getHtTopo().setViewMouseMode(mode);
|
982
1055
|
topoEditDispatchers.update({
|
983
1056
|
viewMouseMode: mode
|
@@ -1055,6 +1128,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1055
1128
|
*/
|
1056
1129
|
onDeleteElement: onDeleteElement,
|
1057
1130
|
|
1131
|
+
/**
|
1132
|
+
* 绑定图片ip
|
1133
|
+
*/
|
1134
|
+
relateNodeIp: relateNodeIp,
|
1135
|
+
|
1058
1136
|
/**
|
1059
1137
|
* 拓扑图保存回调
|
1060
1138
|
*/
|
@@ -1,26 +1,12 @@
|
|
1
|
-
import { useEffect
|
2
|
-
|
1
|
+
import { useEffect } from 'react';
|
2
|
+
import { createTopoEventListener } from "../event/topoEventListener";
|
3
3
|
export default function useTopoEventListener(props) {
|
4
4
|
var type = props.type,
|
5
5
|
onMessage = props.onMessage;
|
6
|
-
var eventListenerName = useMemo(function () {
|
7
|
-
return "topo_" + n++;
|
8
|
-
}, []);
|
9
6
|
useEffect(function () {
|
10
|
-
var
|
11
|
-
|
12
|
-
if (EE) {
|
13
|
-
window.EE.on('topo', eventListenerName, function (data) {
|
14
|
-
if (data.type === type) {
|
15
|
-
onMessage(data.data);
|
16
|
-
}
|
17
|
-
});
|
18
|
-
}
|
19
|
-
|
7
|
+
var listener = createTopoEventListener(type, onMessage);
|
20
8
|
return function () {
|
21
|
-
|
22
|
-
window.EE.removeListener('topo', eventListenerName);
|
23
|
-
}
|
9
|
+
listener.close();
|
24
10
|
};
|
25
11
|
}, [type, onMessage]);
|
26
12
|
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import React, { useEffect } from 'react';
|
2
|
+
export default function useTopoFullscreen(props) {
|
3
|
+
var topo = props.topo,
|
4
|
+
panelRef = props.panelRef;
|
5
|
+
var topoModState = topo.store.useModelState('topoMod');
|
6
|
+
var graphLoaded = topoModState.graphLoaded,
|
7
|
+
graphLoaded2 = topoModState.graphLoaded2,
|
8
|
+
topoData = topoModState.data;
|
9
|
+
useEffect(function () {
|
10
|
+
var htTopo = topo.getHtTopo();
|
11
|
+
|
12
|
+
if ((graphLoaded || graphLoaded2) && topoData && htTopo.setFullScreenFunc) {
|
13
|
+
htTopo.setFullScreenFunc(function () {
|
14
|
+
panelRef.current.requestFullscreen();
|
15
|
+
});
|
16
|
+
}
|
17
|
+
}, [topoData, graphLoaded, graphLoaded2]); // 监听退出全屏
|
18
|
+
|
19
|
+
var panelDom = panelRef.current;
|
20
|
+
useEffect(function () {
|
21
|
+
panelDom === null || panelDom === void 0 ? void 0 : panelDom.addEventListener('fullscreenchange', handleFullscreenChange); // 监听退出全屏
|
22
|
+
|
23
|
+
function handleFullscreenChange() {
|
24
|
+
var htTopo = topo.getHtTopo();
|
25
|
+
htTopo.setToolsVisible(!document.fullscreenElement);
|
26
|
+
}
|
27
|
+
|
28
|
+
return function () {
|
29
|
+
panelDom === null || panelDom === void 0 ? void 0 : panelDom.removeEventListener('fullscreenchange', handleFullscreenChange);
|
30
|
+
};
|
31
|
+
}, [panelDom]);
|
32
|
+
}
|
package/es/core/models/Alarm.js
CHANGED
@@ -5,9 +5,8 @@ import topoService from "@riil-frontend/component-topology-common/es/services/to
|
|
5
5
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
6
6
|
import { EE } from "@riil-frontend/component-riil-event-emitter";
|
7
7
|
import { isAvailableArray } from "@riil-frontend/utils";
|
8
|
+
import { createTopoEventListener } from "../event/topoEventListener";
|
8
9
|
|
9
|
-
// import moment from "moment";
|
10
|
-
// import { alarmListDemo } from "./mocks";
|
11
10
|
var Alarm = /*#__PURE__*/function () {
|
12
11
|
function Alarm() {
|
13
12
|
this.topo = void 0;
|
@@ -375,8 +374,6 @@ var Alarm = /*#__PURE__*/function () {
|
|
375
374
|
/*#__PURE__*/
|
376
375
|
function () {
|
377
376
|
var _openTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
|
378
|
-
var _this2 = this;
|
379
|
-
|
380
377
|
var _this$getState2, alarmOpening, topoAlarmIsOpen, alarmDispatchers;
|
381
378
|
|
382
379
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
@@ -409,17 +406,12 @@ var Alarm = /*#__PURE__*/function () {
|
|
409
406
|
case 10:
|
410
407
|
this.secretKey = _context6.sent;
|
411
408
|
// rlog.debug("openTopoAlarm 获取初始化告警-------------------开始");
|
412
|
-
EE.on("topo", "topo", function (data, other) {
|
413
|
-
rlog.debug("openTopoAlarm 获取初始化告警------收到信息", data);
|
414
|
-
|
415
|
-
_this2.handleAlarmEvent(data);
|
416
|
-
});
|
417
409
|
this.updateState({
|
418
410
|
alarmOpening: false,
|
419
411
|
alarmIsOpened: true
|
420
412
|
});
|
421
413
|
|
422
|
-
case
|
414
|
+
case 12:
|
423
415
|
case "end":
|
424
416
|
return _context6.stop();
|
425
417
|
}
|
@@ -463,16 +455,15 @@ var Alarm = /*#__PURE__*/function () {
|
|
463
455
|
case 3:
|
464
456
|
this.currentTopoId = null;
|
465
457
|
rlog.debug("useAlarm.useEffect 告警WebSocket 结束");
|
466
|
-
EE.removeListener("topo", "topo");
|
467
458
|
this.updateState({
|
468
459
|
topoAlarmIsOpen: false,
|
469
460
|
alarmOpening: false,
|
470
461
|
alarmPanelIsOpen: false
|
471
462
|
});
|
472
|
-
_context7.next =
|
463
|
+
_context7.next = 8;
|
473
464
|
return this.topo.serverApi.closeTopoAlarm(id, this.secretKey);
|
474
465
|
|
475
|
-
case
|
466
|
+
case 8:
|
476
467
|
case "end":
|
477
468
|
return _context7.stop();
|
478
469
|
}
|
@@ -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 "9.0.0-a.
|
27
|
+
var version = typeof "9.0.0-a.30" === 'string' ? "9.0.0-a.30" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -11,8 +11,8 @@ export function getLayoutId(layout) {
|
|
11
11
|
|
12
12
|
if (typeof layout === "string") {
|
13
13
|
return {
|
14
|
-
v:
|
15
|
-
h:
|
14
|
+
v: "towardeast",
|
15
|
+
h: "towardsouth"
|
16
16
|
}[layout] || layout;
|
17
17
|
}
|
18
18
|
|
@@ -41,7 +41,7 @@ export function saveTopo(_x) {
|
|
41
41
|
|
42
42
|
function _saveTopo() {
|
43
43
|
_saveTopo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
44
|
-
var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, exportLinkIdList, relateTopoIdList, viewGroupId, groupInfo, viewResources;
|
44
|
+
var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, exportLinkIdList, relateTopoIdList, viewGroupId, groupInfo, viewResources, linkIps;
|
45
45
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
46
46
|
while (1) {
|
47
47
|
switch (_context.prev = _context.next) {
|
@@ -73,7 +73,7 @@ function _saveTopo() {
|
|
73
73
|
|
74
74
|
case 8:
|
75
75
|
if (!(resources || groups)) {
|
76
|
-
_context.next =
|
76
|
+
_context.next = 16;
|
77
77
|
break;
|
78
78
|
}
|
79
79
|
|
@@ -95,24 +95,31 @@ function _saveTopo() {
|
|
95
95
|
});
|
96
96
|
}
|
97
97
|
|
98
|
+
linkIps = []; // resources?.static.map((nodeId) => {
|
99
|
+
// if (nodeId.startsWith("ip_")) {
|
100
|
+
// linkIps.push(nodeId.replace("ip_", ""));
|
101
|
+
// }
|
102
|
+
// });
|
103
|
+
|
98
104
|
rlog.debug("saveTopo-groupInfo", groupInfo);
|
99
|
-
_context.next =
|
105
|
+
_context.next = 16;
|
100
106
|
return topoService.bindResourceToTopo(topoId, {
|
101
107
|
groups: groupInfo,
|
108
|
+
linkIps: linkIps,
|
102
109
|
exportLinkIdList: exportLinkIdList,
|
103
110
|
relateTopoIdList: relateTopoIdList
|
104
111
|
});
|
105
112
|
|
106
|
-
case
|
113
|
+
case 16:
|
107
114
|
if (!serialize) {
|
108
|
-
_context.next =
|
115
|
+
_context.next = 19;
|
109
116
|
break;
|
110
117
|
}
|
111
118
|
|
112
|
-
_context.next =
|
119
|
+
_context.next = 19;
|
113
120
|
return topoService.saveSerializeData(topoId, serialize);
|
114
121
|
|
115
|
-
case
|
122
|
+
case 19:
|
116
123
|
case "end":
|
117
124
|
return _context.stop();
|
118
125
|
}
|