@riil-frontend/component-topology 9.0.0-a.26 → 9.0.0-a.27
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 +13 -13
- package/es/core/components/TopoView/GraphViewPanel.js +8 -3
- package/es/core/components/TopoView/TopoView.module.scss +17 -3
- 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/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +4 -3
- package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +0 -8
- package/es/core/hooks/useCanvasTheme.js +1 -0
- package/es/core/hooks/useTopoEdit.js +15 -37
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/store/models/topoConfig.js +12 -11
- package/es/networkTopo/utils/exitLinkUtil.js +21 -6
- package/lib/core/components/TopoView/GraphViewPanel.js +9 -3
- package/lib/core/components/TopoView/TopoView.module.scss +17 -3
- 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/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +3 -3
- package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +0 -8
- package/lib/core/hooks/useCanvasTheme.js +1 -0
- package/lib/core/hooks/useTopoEdit.js +12 -35
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/store/models/topoConfig.js +13 -11
- package/lib/networkTopo/utils/exitLinkUtil.js +21 -6
- package/package.json +2 -2
@@ -1,7 +1,10 @@
|
|
1
1
|
import React, { useEffect } from 'react';
|
2
|
+
import classNames from 'classnames';
|
2
3
|
import useCanvasTheme from "../../hooks/useCanvasTheme";
|
3
4
|
import styles from "./TopoView.module.scss";
|
4
5
|
export default function GraphViewPanel(props) {
|
6
|
+
var _classNames;
|
7
|
+
|
5
8
|
var topo = props.topo,
|
6
9
|
hideBackgroundColor = props.hideBackgroundColor;
|
7
10
|
var displayConfig = topo.store.useModelState('displayConfig');
|
@@ -30,9 +33,11 @@ export default function GraphViewPanel(props) {
|
|
30
33
|
};
|
31
34
|
|
32
35
|
return /*#__PURE__*/React.createElement("div", {
|
33
|
-
className: styles.viewPanel,
|
34
|
-
style: {
|
35
|
-
background: canvasColor
|
36
|
+
className: classNames(styles.viewPanel, (_classNames = {}, _classNames[styles.backgroundImg] = !!canvasbackgroundImage, _classNames)),
|
37
|
+
style: canvasColor ? {
|
38
|
+
background: canvasColor
|
39
|
+
} : {
|
40
|
+
backgroundImage: "url(" + canvasbackgroundImage + ")"
|
36
41
|
},
|
37
42
|
onFocus: onFocus
|
38
43
|
}, props.children);
|
@@ -10,14 +10,28 @@
|
|
10
10
|
flex: 1;
|
11
11
|
overflow: hidden;
|
12
12
|
position: relative;
|
13
|
+
|
14
|
+
&.backgroundImg {
|
15
|
+
/* 背景图垂直、水平均居中 */
|
16
|
+
background-position: center center;
|
17
|
+
/* 背景图不平铺 */
|
18
|
+
background-repeat: no-repeat;
|
19
|
+
/* 当内容高度大于图片高度时,背景图像的位置相对于viewport固定 */
|
20
|
+
background-attachment: fixed;
|
21
|
+
/* 让背景图基于容器大小伸缩 */
|
22
|
+
background-size: cover;
|
23
|
+
/* 设置背景颜色,背景图加载过程中会显示背景色 */
|
24
|
+
// background-color: #464646;
|
25
|
+
}
|
13
26
|
}
|
14
27
|
|
15
28
|
// 解决拓扑图容器绝对定位z-index>0时浮层和右键菜单不显示问题
|
16
29
|
:global {
|
17
|
-
body
|
30
|
+
body>.ht-ui-view {
|
18
31
|
z-index: 10000;
|
19
32
|
}
|
20
|
-
|
33
|
+
|
34
|
+
body>div[ht="ht-view ht.ui.ContextMenu"] {
|
21
35
|
z-index: 1000;
|
22
36
|
}
|
23
|
-
}
|
37
|
+
}
|
@@ -1,7 +1,8 @@
|
|
1
|
+
import _Checkbox from "@alifd/next/es/checkbox";
|
1
2
|
import _Field from "@alifd/next/es/field";
|
2
3
|
import _Select from "@alifd/next/es/select";
|
3
4
|
import _Form from "@alifd/next/es/form";
|
4
|
-
import React, { useEffect } from 'react';
|
5
|
+
import React, { useEffect, useState } from 'react';
|
5
6
|
import { getEdgesBySelection, loopEdgesAndChildren } from "../../../../utils/edgeTypeStyleUtil";
|
6
7
|
import styles from "./EdgeType.module.scss";
|
7
8
|
import LineType from "./LineType";
|
@@ -76,10 +77,12 @@ function getValuesByEdges(topo) {
|
|
76
77
|
})[0] || 'nil';
|
77
78
|
}
|
78
79
|
|
79
|
-
function getEdgesValues(edges) {
|
80
|
+
function getEdgesValues(edges, topo) {
|
80
81
|
var edgeValues = [];
|
82
|
+
var htTopo = topo.getHtTopo();
|
81
83
|
edges.forEach(function (edge) {
|
82
84
|
edgeValues.push({
|
85
|
+
baseAgreement: htTopo.getEdgeMultarc(edges),
|
83
86
|
lineButton: edge.s('edge.type'),
|
84
87
|
startPoint: getStartPoint(edge),
|
85
88
|
endPoint: getEndPoint(edge),
|
@@ -90,8 +93,9 @@ function getValuesByEdges(topo) {
|
|
90
93
|
}
|
91
94
|
|
92
95
|
var selectionEdges = getEdgesBySelection(topo);
|
93
|
-
var edgeValues = getEdgesValues(selectionEdges);
|
96
|
+
var edgeValues = getEdgesValues(selectionEdges, topo);
|
94
97
|
var values = {
|
98
|
+
baseAgreement: false,
|
95
99
|
lineButton: undefined,
|
96
100
|
startPoint: undefined,
|
97
101
|
endPoint: undefined,
|
@@ -117,10 +121,18 @@ function EdgeType(props) {
|
|
117
121
|
selection = props.selection,
|
118
122
|
_onChange = props.onChange;
|
119
123
|
|
124
|
+
var _useState = useState(false),
|
125
|
+
disable = _useState[0],
|
126
|
+
setDisabel = _useState[1];
|
127
|
+
|
120
128
|
var field = _Field.useField({
|
121
129
|
autoUnmount: false,
|
122
130
|
values: getValuesByEdges(topo),
|
123
131
|
onChange: function onChange(name, value) {
|
132
|
+
if (name == 'baseAgreement') {
|
133
|
+
setDisabel(value);
|
134
|
+
}
|
135
|
+
|
124
136
|
if (['startPoint', 'endPoint'].includes(name) && value === 'nil') {
|
125
137
|
_onChange(name, null);
|
126
138
|
} else {
|
@@ -139,8 +151,12 @@ function EdgeType(props) {
|
|
139
151
|
inline: true,
|
140
152
|
labelAlign: "top"
|
141
153
|
}, /*#__PURE__*/React.createElement(FormItem, null, /*#__PURE__*/React.createElement(LineType, {
|
142
|
-
name: "lineButton"
|
143
|
-
|
154
|
+
name: "lineButton",
|
155
|
+
disable: disable
|
156
|
+
})), /*#__PURE__*/React.createElement(FormItem, null, /*#__PURE__*/React.createElement(_Checkbox, {
|
157
|
+
name: "baseAgreement",
|
158
|
+
onChange: _onChange
|
159
|
+
}, "\u81EA\u52A8\u8C03\u6574")), /*#__PURE__*/React.createElement(FormItem, {
|
144
160
|
label: "\u8D77\u70B9"
|
145
161
|
}, /*#__PURE__*/React.createElement(_Select, {
|
146
162
|
name: "startPoint",
|
@@ -5,7 +5,6 @@
|
|
5
5
|
background: #FFFFFF;
|
6
6
|
border-radius: 4px;
|
7
7
|
margin-bottom: -7px;
|
8
|
-
|
9
8
|
:global {
|
10
9
|
.#{$css-prefix}form-item:first-child{
|
11
10
|
margin-top: 0;
|
@@ -15,6 +14,11 @@
|
|
15
14
|
margin-top: 7px;
|
16
15
|
margin-bottom: 7px;
|
17
16
|
}
|
17
|
+
.#{$css-prefix}form-item:nth-child(2){
|
18
|
+
display: block !important;
|
19
|
+
margin-top: 7px;
|
20
|
+
margin-bottom: 0px;
|
21
|
+
}
|
18
22
|
.#{$css-prefix}form.#{$css-prefix}inline .#{$css-prefix}form-item:not(:last-child) {
|
19
23
|
margin-right: 8px;
|
20
24
|
.#{$css-prefix}select-trigger {
|
@@ -20,28 +20,47 @@ var LINE_TYPE_OPTIONS = [{
|
|
20
20
|
value: 'ortho',
|
21
21
|
label: '双折线',
|
22
22
|
icon: 'topo_linear_icon_bilinear'
|
23
|
+
}, {
|
24
|
+
value: 'arc',
|
25
|
+
label: '单弧线',
|
26
|
+
icon: 'topo_linear_icon_arc_line'
|
23
27
|
}, {
|
24
28
|
value: 'doublearc',
|
25
29
|
label: '双弧线',
|
26
30
|
icon: 'topo_linear_icon_arcline'
|
31
|
+
}, {
|
32
|
+
value: 'points',
|
33
|
+
label: '自由线形',
|
34
|
+
icon: 'topo_linear_icon_pointsline'
|
27
35
|
}];
|
28
36
|
var LineType = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
29
37
|
var value = props.value,
|
30
|
-
onChange = props.onChange
|
38
|
+
onChange = props.onChange,
|
39
|
+
disable = props.disable;
|
31
40
|
|
32
41
|
function lineButton(item) {
|
33
|
-
|
42
|
+
if (disable) {
|
43
|
+
return /*#__PURE__*/React.createElement(_Button, {
|
44
|
+
className: styles.redioBtnDisable
|
45
|
+
}, /*#__PURE__*/React.createElement("img", {
|
46
|
+
src: "/img/topo/editor/lineType/" + item.icon + "_disable.svg",
|
47
|
+
alt: "",
|
48
|
+
className: styles.iconImg
|
49
|
+
}));
|
50
|
+
} else {
|
51
|
+
var _classNames;
|
34
52
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
53
|
+
return /*#__PURE__*/React.createElement(_Button, {
|
54
|
+
className: classNames(styles.redioBtn, (_classNames = {}, _classNames[styles.selected] = value === item.value, _classNames)),
|
55
|
+
onClick: function onClick() {
|
56
|
+
onChange(item.value);
|
57
|
+
}
|
58
|
+
}, /*#__PURE__*/React.createElement("img", {
|
59
|
+
src: "/img/topo/editor/lineType/" + item.icon + ".svg",
|
60
|
+
alt: "",
|
61
|
+
className: styles.iconImg
|
62
|
+
}));
|
63
|
+
}
|
45
64
|
}
|
46
65
|
|
47
66
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -1,5 +1,15 @@
|
|
1
1
|
.lineType{
|
2
2
|
display:flex;
|
3
|
+
.redioBtnDisable {
|
4
|
+
width: 24px;
|
5
|
+
height: 24px;
|
6
|
+
border-radius: 4px;
|
7
|
+
border: none !important;
|
8
|
+
color: #4D6277;
|
9
|
+
padding: 0;
|
10
|
+
margin-right: 10px;
|
11
|
+
text-align: center;
|
12
|
+
}
|
3
13
|
.redioBtn {
|
4
14
|
width: 24px;
|
5
15
|
height: 24px;
|
@@ -7,9 +17,9 @@
|
|
7
17
|
border: none !important;
|
8
18
|
color: #4D6277;
|
9
19
|
padding: 0;
|
10
|
-
margin-right:
|
20
|
+
margin-right: 10px;
|
11
21
|
text-align: center;
|
12
|
-
|
22
|
+
|
13
23
|
.iconImg {
|
14
24
|
vertical-align: middle;
|
15
25
|
}
|
@@ -49,6 +49,12 @@ function EdgeTypeButton(props) {
|
|
49
49
|
return;
|
50
50
|
}
|
51
51
|
|
52
|
+
if (name == 'baseAgreement') {
|
53
|
+
/** TODO: 自动调整api调用*/
|
54
|
+
htTopo.setEdgeMultarc(edges, value);
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
|
52
58
|
setEdgesAndChildren(topo, edges, function (edge) {
|
53
59
|
if (name === 'startPoint') {
|
54
60
|
// 删除设置
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import { iconFactory } from "@riil-frontend/component-topology-graph";
|
3
3
|
import sortBy from "lodash/sortBy";
|
4
|
-
import {
|
5
|
-
import { getNodeData } from "../../../../../../../../utils/htElementUtils";
|
4
|
+
import { getGroupChildren, getNodeData } from "../../../../../../../../utils/htElementUtils";
|
6
5
|
|
7
6
|
function sortResourcesByName(resources) {
|
8
7
|
return sortBy(resources, "name");
|
@@ -19,7 +18,9 @@ export default function useGroupRelateResource(props) {
|
|
19
18
|
} : _props$useGroupSortRe; // const [resources, setResources] = useState([]);
|
20
19
|
// 过滤出资源
|
21
20
|
|
22
|
-
var resourceNodes =
|
21
|
+
var resourceNodes = getGroupChildren(group).filter(function (item) {
|
22
|
+
return !!item.getTag();
|
23
|
+
}); // 资源按名称排序
|
23
24
|
|
24
25
|
var useSortNodes = useGroupSortResources || ((_topo$options$editor = topo.options.editor) === null || _topo$options$editor === void 0 ? void 0 : _topo$options$editor.sortResources) || sortResourcesByName;
|
25
26
|
var data = useSortNodes(resourceNodes.map(function (node) {
|
@@ -38,7 +38,6 @@ export default function BindIpInput(props) {
|
|
38
38
|
if (errors) {
|
39
39
|
console.error("saveIp-error", errors, vals);
|
40
40
|
} else {
|
41
|
-
// console.log("saveIp", txtValue);
|
42
41
|
setError("");
|
43
42
|
onChange(txtValue);
|
44
43
|
topoEditApi.relateNodeIp(txtValue, nodeElement);
|
@@ -58,13 +57,6 @@ export default function BindIpInput(props) {
|
|
58
57
|
|
59
58
|
var checkIp = function checkIp(rule, value, callback) {
|
60
59
|
var dm = topo.getDataModel();
|
61
|
-
var rex = /^((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))$/;
|
62
|
-
var reg = value.match(rex);
|
63
|
-
|
64
|
-
if (reg === null) {
|
65
|
-
return callback();
|
66
|
-
}
|
67
|
-
|
68
60
|
var isUnique = isUniqueIp(dm, value, nodeElement); // console.log("checkIp", isUnique);
|
69
61
|
|
70
62
|
if (!isUnique) {
|
@@ -60,6 +60,7 @@ export default function useCanvasTheme(props) {
|
|
60
60
|
if (graphLoaded) {
|
61
61
|
try {
|
62
62
|
topo.getHtTopo().getGraphView().dm().setBackground(canvasColor);
|
63
|
+
topo.getHtTopo().getGraphView().dm().setBackground(canvasbackgroundImage);
|
63
64
|
} catch (error) {
|
64
65
|
console.error('切换主题失败', error);
|
65
66
|
}
|
@@ -8,15 +8,14 @@ import _ from "lodash";
|
|
8
8
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
9
9
|
import { TopoEvent } from "@riil-frontend/component-topology-graph";
|
10
10
|
import { TPL_BLANK, TPL_TREE } from "../../utils/template";
|
11
|
-
import
|
12
|
-
import { getElements, getGroupElementByTag, isEdge, isExistedElement, isGroup, isLayer, isNode, getNodes } from "../../utils/htElementUtils";
|
11
|
+
import { getGroupElementByTag, isEdge, isExistedElement, isGroup, isLayer, isNode, getNodes, getGroupChildren } from "../../utils/htElementUtils";
|
13
12
|
import useResourceConfig from "./useResourceConfig";
|
14
13
|
import useGroupAddResource from "./useGroupAddResource";
|
15
14
|
import { findGroupChildren } from "../../utils/topoData";
|
16
|
-
import {
|
15
|
+
import { isResourceElement } from "../../utils/htElementDataUtil";
|
17
16
|
import { isClusterHtElement, isClusterMemberHtElement } from "../../utils/clusterUtil";
|
18
17
|
import { mergeExportLinkData } from "../models/utils/linkUtils";
|
19
|
-
import { isUniqueIp } from "../../networkTopo/utils/exitLinkUtil";
|
18
|
+
import { isUniqueIp, buildIpNode } from "../../networkTopo/utils/exitLinkUtil";
|
20
19
|
|
21
20
|
var useTopoEdit = function useTopoEdit(params) {
|
22
21
|
var topo = params.topo,
|
@@ -223,7 +222,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
223
222
|
return;
|
224
223
|
}
|
225
224
|
|
226
|
-
if (!
|
225
|
+
if (!getGroupChildren(group).filter(isResourceElement).length || isClusterHtElement(group)) {
|
227
226
|
doDelete();
|
228
227
|
return;
|
229
228
|
} // 有子节点时需要确认
|
@@ -974,42 +973,23 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
974
973
|
|
975
974
|
function _relateNodeIp() {
|
976
975
|
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(txtValue, nodeElement) {
|
977
|
-
var dm, htTopo, elementNodes, isUnique,
|
976
|
+
var dm, htTopo, elementNodes, isUnique, ip, configObj, configData, _elements, newLinkElements, createElementsData;
|
978
977
|
|
979
978
|
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
980
979
|
while (1) {
|
981
980
|
switch (_context16.prev = _context16.next) {
|
982
981
|
case 0:
|
983
|
-
// console.log("bindIPtoNode",
|
982
|
+
// console.log("bindIPtoNode", txtValue, nodeElement);
|
984
983
|
// 根据配置查询拓扑数据
|
985
984
|
dm = topo.getDataModel();
|
986
985
|
htTopo = topo.getHtTopo();
|
987
986
|
elementNodes = getNodes(dm); // 执行唯一性验证
|
988
987
|
|
989
988
|
isUnique = isUniqueIp(dm, txtValue, nodeElement);
|
990
|
-
|
991
|
-
elementNodes.map(function (element) {
|
992
|
-
if (element.getTag()) {
|
993
|
-
ids.push(element.getTag());
|
994
|
-
}
|
995
|
-
});
|
996
|
-
ip = {
|
997
|
-
id: "ip:" + txtValue,
|
998
|
-
name: txtValue,
|
999
|
-
customName: null,
|
1000
|
-
bindType: "ip",
|
1001
|
-
// 'groupId': null,
|
1002
|
-
// 'groupTag': null,
|
1003
|
-
ipAddress: txtValue,
|
1004
|
-
// 'attributes': [],
|
1005
|
-
// 'metrics': [],
|
1006
|
-
type: "node",
|
1007
|
-
isbinding: true // 'dtype': 'device'
|
1008
|
-
|
1009
|
-
}; // 获取关联链路
|
989
|
+
ip = buildIpNode(txtValue); // 获取关联链路
|
1010
990
|
|
1011
991
|
if (!isUnique) {
|
1012
|
-
_context16.next =
|
992
|
+
_context16.next = 21;
|
1013
993
|
break;
|
1014
994
|
}
|
1015
995
|
|
@@ -1018,19 +998,17 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1018
998
|
nodeElement.setName(txtValue);
|
1019
999
|
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1020
1000
|
|
1021
|
-
configObj = topo.resourceConfig.getConfig();
|
1022
|
-
|
1023
|
-
// console.log("configObj---over", configObj);
|
1024
|
-
|
1025
|
-
_context16.next = 15;
|
1001
|
+
configObj = topo.resourceConfig.getConfig();
|
1002
|
+
_context16.next = 13;
|
1026
1003
|
return resourceConfig.updateConfig(configObj);
|
1027
1004
|
|
1028
|
-
case
|
1029
|
-
_context16.next =
|
1005
|
+
case 13:
|
1006
|
+
_context16.next = 15;
|
1030
1007
|
return editDispatchers.fetchDataByConfig();
|
1031
1008
|
|
1032
|
-
case
|
1009
|
+
case 15:
|
1033
1010
|
configData = _context16.sent;
|
1011
|
+
// console.log("configData", configData);
|
1034
1012
|
_elements = configData.elements;
|
1035
1013
|
newLinkElements = findUNExistedLinkElements(_elements);
|
1036
1014
|
createElementsData = {
|
@@ -1046,7 +1024,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1046
1024
|
console.log("createElementsData", createElementsData);
|
1047
1025
|
htTopo.createElements(createElementsData);
|
1048
1026
|
|
1049
|
-
case
|
1027
|
+
case 21:
|
1050
1028
|
case "end":
|
1051
1029
|
return _context16.stop();
|
1052
1030
|
}
|
@@ -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.27" === 'string' ? "9.0.0-a.27" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -253,6 +253,7 @@ export default function (topoApp) {
|
|
253
253
|
case 0:
|
254
254
|
editState = rootState.topoConfig;
|
255
255
|
resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups, _editState$exportLink = editState.exportLinkIdList, exportLinkIdList = _editState$exportLink === void 0 ? [] : _editState$exportLink, _editState$ipNodes = editState.ipNodes, ipNodes = _editState$ipNodes === void 0 ? [] : _editState$ipNodes;
|
256
|
+
console.log("editState", editState);
|
256
257
|
query = {
|
257
258
|
id: rootState.topoMod.topoId,
|
258
259
|
resources: resources,
|
@@ -260,10 +261,10 @@ export default function (topoApp) {
|
|
260
261
|
exportLinkIdList: exportLinkIdList,
|
261
262
|
ipNodes: ipNodes
|
262
263
|
};
|
263
|
-
_context2.next =
|
264
|
+
_context2.next = 6;
|
264
265
|
return _this2.getTopoByConditions(query);
|
265
266
|
|
266
|
-
case
|
267
|
+
case 6:
|
267
268
|
data = _context2.sent;
|
268
269
|
rlog.debug("按配置查询拓扑数据", {
|
269
270
|
config: {
|
@@ -274,7 +275,7 @@ export default function (topoApp) {
|
|
274
275
|
});
|
275
276
|
return _context2.abrupt("return", data);
|
276
277
|
|
277
|
-
case
|
278
|
+
case 9:
|
278
279
|
case "end":
|
279
280
|
return _context2.stop();
|
280
281
|
}
|
@@ -316,7 +317,7 @@ export default function (topoApp) {
|
|
316
317
|
while (1) {
|
317
318
|
switch (_context4.prev = _context4.next) {
|
318
319
|
case 0:
|
319
|
-
|
320
|
+
rlog.debug("getTopoByConditions--------", params);
|
320
321
|
topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList, ipNodes = params.ipNodes;
|
321
322
|
viewConditions = resToConditions(resources);
|
322
323
|
groupInfo = isAvailableArray(groups) && groups.map(function (group) {
|
@@ -326,21 +327,21 @@ export default function (topoApp) {
|
|
326
327
|
});
|
327
328
|
});
|
328
329
|
rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
|
329
|
-
_context4.next =
|
330
|
+
_context4.next = 7;
|
330
331
|
return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList, ipNodes);
|
331
332
|
|
332
|
-
case
|
333
|
+
case 7:
|
333
334
|
data = _context4.sent;
|
334
335
|
rlog.debug("getTopoByConditions--------data", data);
|
335
|
-
_context4.next =
|
336
|
+
_context4.next = 11;
|
336
337
|
return buildTopoData(data);
|
337
338
|
|
338
|
-
case
|
339
|
+
case 11:
|
339
340
|
data = _context4.sent;
|
340
|
-
_context4.next =
|
341
|
+
_context4.next = 14;
|
341
342
|
return Promise.all([addLinkData(data), topoApp.ciTyeCache.getCiTypeMap(getCiTypes(data)), dispatch.customIcon.loadCustomIcons()]);
|
342
343
|
|
343
|
-
case
|
344
|
+
case 14:
|
344
345
|
_yield$Promise$all = _context4.sent;
|
345
346
|
dataWithLinkDetail = _yield$Promise$all[0];
|
346
347
|
_combTopoData = combTopoData({
|
@@ -367,7 +368,7 @@ export default function (topoApp) {
|
|
367
368
|
topoDataTrans: topoDataTrans
|
368
369
|
});
|
369
370
|
|
370
|
-
case
|
371
|
+
case 22:
|
371
372
|
case "end":
|
372
373
|
return _context4.stop();
|
373
374
|
}
|
@@ -12,7 +12,7 @@ function isPingHtNode(node, ip) {
|
|
12
12
|
}
|
13
13
|
|
14
14
|
function isIpHtNode(node, ip) {
|
15
|
-
return node.a(
|
15
|
+
return node.a("bindType") === 'ip' && node.a("bindIp") === ip;
|
16
16
|
}
|
17
17
|
|
18
18
|
function buildIpNode(ip) {
|
@@ -49,11 +49,26 @@ function isExitLink(link) {
|
|
49
49
|
|
50
50
|
export function isUniqueIp(dataModel, ip, nodeElement) {
|
51
51
|
var nodes = getNodes(dataModel);
|
52
|
-
var isUnique =
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
var isUnique = true;
|
53
|
+
console.log("nodes-nodeElement", nodes, nodeElement);
|
54
|
+
|
55
|
+
if (nodeElement) {
|
56
|
+
console.log("nodes-nodeElement---filter", nodes.filter(function (node) {
|
57
|
+
return node.getId() !== (nodeElement === null || nodeElement === void 0 ? void 0 : nodeElement.getId());
|
58
|
+
}));
|
59
|
+
var arr = nodes.filter(function (node) {
|
60
|
+
return node.getId() !== (nodeElement === null || nodeElement === void 0 ? void 0 : nodeElement.getId());
|
61
|
+
}).filter(function (node) {
|
62
|
+
return isPingHtNode(node, ip) || isIpHtNode(node, ip);
|
63
|
+
});
|
64
|
+
isUnique = arr.length === 0;
|
65
|
+
console.log("nodes-nodeElement---filter", arr, isUnique);
|
66
|
+
} else {
|
67
|
+
isUnique = nodes.filter(function (node) {
|
68
|
+
return node.a("ipAddress") === ip;
|
69
|
+
}).length === 0;
|
70
|
+
}
|
71
|
+
|
57
72
|
return isUnique;
|
58
73
|
}
|
59
74
|
/**
|
@@ -7,6 +7,8 @@ exports["default"] = GraphViewPanel;
|
|
7
7
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
9
9
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
11
|
+
|
10
12
|
var _useCanvasTheme2 = _interopRequireDefault(require("../../hooks/useCanvasTheme"));
|
11
13
|
|
12
14
|
var _TopoViewModule = _interopRequireDefault(require("./TopoView.module.scss"));
|
@@ -16,6 +18,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
16
18
|
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; }
|
17
19
|
|
18
20
|
function GraphViewPanel(props) {
|
21
|
+
var _classNames;
|
22
|
+
|
19
23
|
var topo = props.topo,
|
20
24
|
hideBackgroundColor = props.hideBackgroundColor;
|
21
25
|
var displayConfig = topo.store.useModelState('displayConfig');
|
@@ -44,9 +48,11 @@ function GraphViewPanel(props) {
|
|
44
48
|
};
|
45
49
|
|
46
50
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
47
|
-
className: _TopoViewModule["default"].viewPanel,
|
48
|
-
style: {
|
49
|
-
background: canvasColor
|
51
|
+
className: (0, _classnames["default"])(_TopoViewModule["default"].viewPanel, (_classNames = {}, _classNames[_TopoViewModule["default"].backgroundImg] = !!canvasbackgroundImage, _classNames)),
|
52
|
+
style: canvasColor ? {
|
53
|
+
background: canvasColor
|
54
|
+
} : {
|
55
|
+
backgroundImage: "url(" + canvasbackgroundImage + ")"
|
50
56
|
},
|
51
57
|
onFocus: onFocus
|
52
58
|
}, props.children);
|
@@ -10,14 +10,28 @@
|
|
10
10
|
flex: 1;
|
11
11
|
overflow: hidden;
|
12
12
|
position: relative;
|
13
|
+
|
14
|
+
&.backgroundImg {
|
15
|
+
/* 背景图垂直、水平均居中 */
|
16
|
+
background-position: center center;
|
17
|
+
/* 背景图不平铺 */
|
18
|
+
background-repeat: no-repeat;
|
19
|
+
/* 当内容高度大于图片高度时,背景图像的位置相对于viewport固定 */
|
20
|
+
background-attachment: fixed;
|
21
|
+
/* 让背景图基于容器大小伸缩 */
|
22
|
+
background-size: cover;
|
23
|
+
/* 设置背景颜色,背景图加载过程中会显示背景色 */
|
24
|
+
// background-color: #464646;
|
25
|
+
}
|
13
26
|
}
|
14
27
|
|
15
28
|
// 解决拓扑图容器绝对定位z-index>0时浮层和右键菜单不显示问题
|
16
29
|
:global {
|
17
|
-
body
|
30
|
+
body>.ht-ui-view {
|
18
31
|
z-index: 10000;
|
19
32
|
}
|
20
|
-
|
33
|
+
|
34
|
+
body>div[ht="ht-view ht.ui.ContextMenu"] {
|
21
35
|
z-index: 1000;
|
22
36
|
}
|
23
|
-
}
|
37
|
+
}
|