@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
@@ -0,0 +1,257 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import { getNodes } from "../../utils/htElementUtils";
|
3
|
+
|
4
|
+
function findPingNodeFromHt(nodes, ip) {
|
5
|
+
return nodes.find(function (node) {
|
6
|
+
return node.a('ciType') === "ping" && node.a('ipAddress') === ip;
|
7
|
+
});
|
8
|
+
}
|
9
|
+
|
10
|
+
function isPingHtNode(node, ip) {
|
11
|
+
return node.a('ciType') === "ping" && node.a('ipAddress') === ip;
|
12
|
+
}
|
13
|
+
|
14
|
+
function isIpHtNode(node, ip) {
|
15
|
+
return node.a("bindType") === 'ip' && node.a("bindIp") === ip;
|
16
|
+
}
|
17
|
+
|
18
|
+
export function buildIpNode(ip) {
|
19
|
+
return {
|
20
|
+
id: "ip:" + ip,
|
21
|
+
name: ip,
|
22
|
+
bindType: "ip",
|
23
|
+
// 绑定资源类型。关联资源 值为空,关联IP ip
|
24
|
+
bindIp: ip,
|
25
|
+
// TODO 所属区域,从序列化拿
|
26
|
+
// 'groupId': null,
|
27
|
+
// 'groupTag': null,
|
28
|
+
ipAddress: ip,
|
29
|
+
// 'attributes': [],
|
30
|
+
// 'metrics': [],
|
31
|
+
type: "node",
|
32
|
+
isbinding: true,
|
33
|
+
// 'dtype': 'device'
|
34
|
+
operation: "delete"
|
35
|
+
};
|
36
|
+
}
|
37
|
+
|
38
|
+
function getHtSerialize(serialize) {
|
39
|
+
if (serialize) {
|
40
|
+
return JSON.parse(serialize);
|
41
|
+
}
|
42
|
+
|
43
|
+
return null;
|
44
|
+
}
|
45
|
+
|
46
|
+
function isExitLink(link) {
|
47
|
+
return link.attributes.destination_type === "ip";
|
48
|
+
} // 判断拓扑图上ip是否唯一
|
49
|
+
|
50
|
+
|
51
|
+
export function isUniqueIp(dataModel, ip, nodeElement) {
|
52
|
+
var nodes = getNodes(dataModel);
|
53
|
+
var isUnique = true; // console.log("nodes-nodeElement", nodes, nodeElement);
|
54
|
+
|
55
|
+
if (nodeElement) {
|
56
|
+
var arr = nodes.filter(function (node) {
|
57
|
+
return node.getId() !== (nodeElement === null || nodeElement === void 0 ? void 0 : nodeElement.getId());
|
58
|
+
}).filter(function (node) {
|
59
|
+
return isPingHtNode(node, ip) || isIpHtNode(node, ip);
|
60
|
+
});
|
61
|
+
isUnique = arr.length === 0;
|
62
|
+
} else {
|
63
|
+
isUnique = nodes.filter(function (node) {
|
64
|
+
return node.a("ipAddress") === ip;
|
65
|
+
}).length === 0;
|
66
|
+
}
|
67
|
+
|
68
|
+
return isUnique;
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* 打开拓扑出口链路处理
|
72
|
+
* @param {*} topoData
|
73
|
+
* @returns
|
74
|
+
*/
|
75
|
+
|
76
|
+
export function processExitLink(topoData) {
|
77
|
+
var nodes = topoData.nodes,
|
78
|
+
links = topoData.links; // 出口链路目的端设置为IP节点或者ping资源节点id
|
79
|
+
|
80
|
+
var newLinks = updateLinkTarget(links, nodes);
|
81
|
+
|
82
|
+
if (!topoData.serialize) {
|
83
|
+
return _extends({}, topoData, {
|
84
|
+
links: newLinks
|
85
|
+
});
|
86
|
+
}
|
87
|
+
|
88
|
+
var serialize = _extends({}, getHtSerialize(topoData.serialize)); // 历史数据升级
|
89
|
+
|
90
|
+
|
91
|
+
links.filter(isExitLink) // 升级V1.4前配置的出口链路目的端节点为IP节点
|
92
|
+
.forEach(function (link) {
|
93
|
+
return upgradeExitLinkTarget(link, serialize);
|
94
|
+
}); // 历史数据适配:同IP节点关联多个不同IP的链路、分级拓扑。target匹配不到元素时,根据序列化匹配
|
95
|
+
|
96
|
+
newLinks = upgradeLinkTargetNotExisted(newLinks); // IP节点构造为node。如果有相同ip的ping资源和图片节点,图片节点消失(不构造)
|
97
|
+
|
98
|
+
var ipNodes = getIpNodes(serialize, nodes);
|
99
|
+
return _extends({}, topoData, {
|
100
|
+
nodes: [].concat(nodes, ipNodes),
|
101
|
+
links: newLinks,
|
102
|
+
serialize: serialize
|
103
|
+
}); // 历史数据适配:同IP节点关联多个不同IP的链路、分级拓扑。target匹配不到元素时,根据序列化匹配
|
104
|
+
|
105
|
+
function upgradeLinkTargetNotExisted(links) {
|
106
|
+
newLinks = links.map(function (link) {
|
107
|
+
if (!isExitLink(link) || link.target && nodes.find(function (node) {
|
108
|
+
return node.id === link.target;
|
109
|
+
})) {
|
110
|
+
return link;
|
111
|
+
}
|
112
|
+
|
113
|
+
var destinationIp = link.attributes['network_link.destination_ipv4'];
|
114
|
+
var pingNode = findPingNode(nodes, destinationIp); // 出口链路目的端设置为IP节点或者ping资源节点id
|
115
|
+
|
116
|
+
var target = link.target; // 历史数据适配:同IP节点关联多个不同IP的链路、分级拓扑。target匹配不到元素时,根据序列化匹配
|
117
|
+
|
118
|
+
var targetSerialize = findElementSerializeById(serialize, target);
|
119
|
+
|
120
|
+
if (!targetSerialize) {
|
121
|
+
var linkSerialize = findElementSerializeById(serialize, link.id);
|
122
|
+
|
123
|
+
if (linkSerialize) {
|
124
|
+
// 根据链路序列化数据找目的端节点
|
125
|
+
// eslint-disable-next-line no-underscore-dangle
|
126
|
+
var targetNodeSerialize = serialize.d.find(function (item) {
|
127
|
+
var _linkSerialize$p$targ;
|
128
|
+
|
129
|
+
return item.i === (linkSerialize === null || linkSerialize === void 0 ? void 0 : (_linkSerialize$p$targ = linkSerialize.p.target) === null || _linkSerialize$p$targ === void 0 ? void 0 : _linkSerialize$p$targ.__i);
|
130
|
+
});
|
131
|
+
|
132
|
+
if (targetNodeSerialize) {
|
133
|
+
target = targetNodeSerialize.p.tag;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
return _extends({}, link, {
|
139
|
+
target: target
|
140
|
+
});
|
141
|
+
});
|
142
|
+
return newLinks;
|
143
|
+
}
|
144
|
+
|
145
|
+
function getIpNodes(serialize, nodes) {
|
146
|
+
// 从序列化获取关联的IP
|
147
|
+
var ips = serialize.d.filter(function (item) {
|
148
|
+
return item.a.bindType === 'ip';
|
149
|
+
}).map(function (item) {
|
150
|
+
return item.a.bindIp;
|
151
|
+
}).filter(function (item) {
|
152
|
+
return !!item;
|
153
|
+
}) // 过滤ping资源对应的ip
|
154
|
+
.filter(function (ip) {
|
155
|
+
return !findPingNode(nodes, ip);
|
156
|
+
});
|
157
|
+
return ips.map(buildIpNode);
|
158
|
+
}
|
159
|
+
|
160
|
+
function findIpNodeSerialize(serialize, ip) {
|
161
|
+
return serialize.d.find(function (item) {
|
162
|
+
return item.p.tag === "ip:" + ip;
|
163
|
+
});
|
164
|
+
}
|
165
|
+
|
166
|
+
function findElementSerializeById(serialize, id) {
|
167
|
+
return serialize.d.find(function (item) {
|
168
|
+
return item.a.id === id;
|
169
|
+
});
|
170
|
+
}
|
171
|
+
/**
|
172
|
+
* 链路在序列化存在且目的端不是ping资源、IP节点时,升级链路目的端序列化数据为IP节点
|
173
|
+
* @param {*} link
|
174
|
+
*/
|
175
|
+
|
176
|
+
|
177
|
+
function upgradeExitLinkTarget(link, serialize) {
|
178
|
+
var destinationIp = link.attributes['network_link.destination_ipv4'];
|
179
|
+
var linkSerialize = findElementSerializeById(serialize, link.id);
|
180
|
+
|
181
|
+
if (linkSerialize) {
|
182
|
+
// 根据链路序列化数据找目的端节点
|
183
|
+
// eslint-disable-next-line no-underscore-dangle
|
184
|
+
var targetNodeSerialize = serialize.d.find(function (item) {
|
185
|
+
var _linkSerialize$p$targ2;
|
186
|
+
|
187
|
+
return item.i === (linkSerialize === null || linkSerialize === void 0 ? void 0 : (_linkSerialize$p$targ2 = linkSerialize.p.target) === null || _linkSerialize$p$targ2 === void 0 ? void 0 : _linkSerialize$p$targ2.__i);
|
188
|
+
});
|
189
|
+
|
190
|
+
if (targetNodeSerialize && !targetNodeSerialize.p.tag) {
|
191
|
+
targetNodeSerialize.a = _extends({}, targetNodeSerialize.a, buildIpNode(destinationIp), {
|
192
|
+
isbinding: true
|
193
|
+
});
|
194
|
+
targetNodeSerialize.p.tag = "ip:" + destinationIp;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
198
|
+
} // 从拓扑数据查找
|
199
|
+
|
200
|
+
function findPingNode(nodes, ip) {
|
201
|
+
return nodes.find(function (node) {
|
202
|
+
return node.ciType === "ping" && (node.ipAddress || node.attributes.ipv4_address) === ip;
|
203
|
+
});
|
204
|
+
} // 出口链路目的端设置为IP节点或者ping资源节点id
|
205
|
+
|
206
|
+
|
207
|
+
function updateLinkTarget(links, nodes) {
|
208
|
+
var newLinks = links.map(function (link) {
|
209
|
+
if (!isExitLink(link) || link.target && nodes.find(function (node) {
|
210
|
+
return node.id === link.target;
|
211
|
+
})) {
|
212
|
+
return link;
|
213
|
+
}
|
214
|
+
|
215
|
+
var destinationIp = link.attributes['network_link.destination_ipv4'];
|
216
|
+
var pingNode = findPingNode(nodes, destinationIp); // 出口链路目的端设置为IP节点或者ping资源节点id
|
217
|
+
|
218
|
+
var target = pingNode ? pingNode.id : "ip:" + destinationIp;
|
219
|
+
return _extends({}, link, {
|
220
|
+
target: target
|
221
|
+
});
|
222
|
+
});
|
223
|
+
return newLinks;
|
224
|
+
}
|
225
|
+
/**
|
226
|
+
* 编辑模式按资源查询拓扑数据处理出口链路target
|
227
|
+
* 1. 出口链路目的端设置为IP节点或者ping资源节点id
|
228
|
+
* 2. IP构造为node节点
|
229
|
+
* FIXME 移到frontend 网络拓扑编辑
|
230
|
+
* @param {*} topoData
|
231
|
+
* @returns
|
232
|
+
*/
|
233
|
+
|
234
|
+
|
235
|
+
export function processByConditionResult(topoData, groupConfigs) {
|
236
|
+
var nodes = topoData.nodes,
|
237
|
+
links = topoData.links;
|
238
|
+
var ipNodes = getIpNodes(groupConfigs, nodes); // 出口链路目的端设置为IP节点或者ping资源节点id
|
239
|
+
|
240
|
+
var newLinks = updateLinkTarget(links, nodes);
|
241
|
+
return _extends({}, topoData, {
|
242
|
+
nodes: [].concat(nodes, ipNodes),
|
243
|
+
links: newLinks
|
244
|
+
});
|
245
|
+
|
246
|
+
function getIpNodes(groupConfigs, nodes) {
|
247
|
+
var ips = groupConfigs.map(function (g) {
|
248
|
+
return g.condition.linkIps;
|
249
|
+
}).reduce(function (result, groupIps) {
|
250
|
+
return [].concat(result, groupIps);
|
251
|
+
}, []) // 过滤ping资源对应的ip节点
|
252
|
+
.filter(function (ip) {
|
253
|
+
return !findPingNode(nodes, ip);
|
254
|
+
});
|
255
|
+
return ips.map(buildIpNode);
|
256
|
+
}
|
257
|
+
}
|
package/es/style.js
CHANGED
@@ -14,6 +14,7 @@ import '@riil-frontend/component-pager/es/style';
|
|
14
14
|
import '@alifd/next/es/button/style';
|
15
15
|
import '@alifd/next/es/icon/style';
|
16
16
|
import '@alifd/next/es/loading/style';
|
17
|
+
import '@alifd/next/es/switch/style';
|
17
18
|
import '@alifd/next/es/divider/style';
|
18
19
|
import '@riil-frontend/component-no-data-page/es/style';
|
19
20
|
|
@@ -2,8 +2,7 @@ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
2
2
|
import sortBy from 'lodash/sortBy';
|
3
3
|
import { isExitLink } from "../core/models/utils/linkUtils";
|
4
4
|
import { isClusterHtElement } from "./clusterUtil";
|
5
|
-
import {
|
6
|
-
import { getEdges, getGroups, getLayers, getNodes } from "./htElementUtils";
|
5
|
+
import { getEdges, getGroupChildren, getGroups, getLayerChildren, getLayers, getNodes } from "./htElementUtils";
|
7
6
|
/**
|
8
7
|
* 从拓扑图解析出拓扑资源配置
|
9
8
|
*
|
@@ -104,7 +103,9 @@ function getLayerDatas(dataModel) {
|
|
104
103
|
name: layerElement.s('label'),
|
105
104
|
order: layerElement.a('order'),
|
106
105
|
resources: {
|
107
|
-
"static":
|
106
|
+
"static": getLayerChildren(layerElement).filter(function (item) {
|
107
|
+
return !!item.getTag();
|
108
|
+
}).map(function (node) {
|
108
109
|
return node.getTag();
|
109
110
|
})
|
110
111
|
}
|
@@ -133,7 +134,7 @@ function getGroupConfigByElement(groupElement) {
|
|
133
134
|
name: groupElement.a('name'),
|
134
135
|
order: groupElement.a('order'),
|
135
136
|
resources: {
|
136
|
-
"static":
|
137
|
+
"static": getGroupChildren(groupElement).filter(function (node) {
|
137
138
|
return !!node.getTag();
|
138
139
|
}).map(function (node) {
|
139
140
|
return node.getTag();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { getEdges
|
1
|
+
import { getEdges } from "./htElementUtils";
|
2
2
|
import * as htElementUtils from "./htElementUtils";
|
3
3
|
export function isLayer(element) {
|
4
4
|
return element.className === 'ht.Grid';
|
@@ -21,12 +21,6 @@ export function isResourceElement(element) {
|
|
21
21
|
export function isResourceNodeElement(element) {
|
22
22
|
return (htElementUtils.isGroup(element) || htElementUtils.isNode(element)) && isResourceElement(element);
|
23
23
|
}
|
24
|
-
export function getGroupChildrenResourceElements(element) {
|
25
|
-
return getGroupChildren(element).filter(isResourceElement);
|
26
|
-
}
|
27
|
-
export function getLayerChildrenResourceElements(layerElement) {
|
28
|
-
return getLayerChildren(layerElement).filter(isResourceElement);
|
29
|
-
}
|
30
24
|
export var getAllEdgeResourceIds = function getAllEdgeResourceIds(dm) {
|
31
25
|
return getEdges(dm).filter(function (node) {
|
32
26
|
return !!node.getTag();
|
@@ -15,7 +15,7 @@ function getElementData(element) {
|
|
15
15
|
styleMap: element.getStyleMap()
|
16
16
|
};
|
17
17
|
|
18
|
-
if (className ===
|
18
|
+
if (className === "ht.Edge") {
|
19
19
|
return _extends({}, commonData);
|
20
20
|
}
|
21
21
|
|
@@ -27,7 +27,7 @@ function getElementData(element) {
|
|
27
27
|
export function isNode(element) {
|
28
28
|
// HT为了支持区域内无节点可展开增加了站位节点,因此 节点的layer等于container_blank的过滤掉就可以了
|
29
29
|
// eslint-disable-next-line no-underscore-dangle
|
30
|
-
return element instanceof ht.Node && !isLayer(element) && element._layer !==
|
30
|
+
return element instanceof ht.Node && !isLayer(element) && element._layer !== "container_blank";
|
31
31
|
}
|
32
32
|
export function isEdge(element) {
|
33
33
|
return element instanceof ht.Edge;
|
@@ -38,7 +38,7 @@ export function isValidEdge(element) {
|
|
38
38
|
}
|
39
39
|
|
40
40
|
if (!element.getSource() || !element.getTarget()) {
|
41
|
-
rlog.error(
|
41
|
+
rlog.error("isValidEdge 连线异常:源或目的为空", element);
|
42
42
|
return false;
|
43
43
|
}
|
44
44
|
|
@@ -51,7 +51,7 @@ export function isLayer(element) {
|
|
51
51
|
return element instanceof ht.Grid;
|
52
52
|
}
|
53
53
|
export function isText(element) {
|
54
|
-
return element instanceof ht.Text && element.a(
|
54
|
+
return element instanceof ht.Text && element.a("isText");
|
55
55
|
}
|
56
56
|
export function getElements(dataModel) {
|
57
57
|
// console.error(111, dataModel.getDatas().getArray())
|
@@ -72,7 +72,7 @@ export function getGroupDatas(dataModel) {
|
|
72
72
|
}
|
73
73
|
export function getGroupElementByTag(dataModel, tag) {
|
74
74
|
return dataModel.getDataByTag(tag) || dataModel.getDatas().toArray().filter(function (item) {
|
75
|
-
return item.a(
|
75
|
+
return item.a("tag") === tag;
|
76
76
|
})[0];
|
77
77
|
}
|
78
78
|
export function getGroupData(element) {
|
@@ -83,14 +83,14 @@ export function getGroupData(element) {
|
|
83
83
|
var parent = element.getParent();
|
84
84
|
var groupInfo = parent ? {
|
85
85
|
groupId: parent.getTag(),
|
86
|
-
groupTag: parent.a(
|
86
|
+
groupTag: parent.a("tag") // 父容器
|
87
87
|
|
88
88
|
} : {};
|
89
89
|
return _extends({
|
90
90
|
name: element.getStyleMap().label
|
91
91
|
}, element.getAttrObject(), {
|
92
92
|
id: element.getTag(),
|
93
|
-
tag: element.a(
|
93
|
+
tag: element.a("tag"),
|
94
94
|
image: element.getImage()
|
95
95
|
}, groupInfo);
|
96
96
|
}
|
@@ -104,7 +104,7 @@ export function getNodeData(element) {
|
|
104
104
|
var parent = element.getParent();
|
105
105
|
var groupInfo = parent ? {
|
106
106
|
groupId: parent.getTag(),
|
107
|
-
groupTag: parent.a(
|
107
|
+
groupTag: parent.a("tag") // 父容器
|
108
108
|
|
109
109
|
} : {};
|
110
110
|
return _extends({}, element.getAttrObject(), {
|
@@ -116,12 +116,12 @@ export function getEdges(dataModel) {
|
|
116
116
|
return getElements(dataModel).filter(isValidEdge);
|
117
117
|
}
|
118
118
|
export function isEdgeGroupExpanded(edge) {
|
119
|
-
return isEdge(edge) && edge.getEdgeGroup() && !!edge.s(
|
119
|
+
return isEdge(edge) && edge.getEdgeGroup() && !!edge.s("edge.expanded");
|
120
120
|
}
|
121
121
|
/**
|
122
122
|
* 是否连线组代理
|
123
|
-
* @param {*} edge
|
124
|
-
* @returns
|
123
|
+
* @param {*} edge
|
124
|
+
* @returns
|
125
125
|
*/
|
126
126
|
|
127
127
|
export function isEdgeGroupAgent(edge) {
|
@@ -129,9 +129,9 @@ export function isEdgeGroupAgent(edge) {
|
|
129
129
|
}
|
130
130
|
/**
|
131
131
|
* 获得两个节点间的连线列表
|
132
|
-
* @param {*} node1
|
133
|
-
* @param {*} node2
|
134
|
-
* @returns
|
132
|
+
* @param {*} node1
|
133
|
+
* @param {*} node2
|
134
|
+
* @returns
|
135
135
|
*/
|
136
136
|
|
137
137
|
export function getEdgesBetweenNodes(node1, node2) {
|
@@ -153,7 +153,7 @@ export function getEdgesBetweenNodes(node1, node2) {
|
|
153
153
|
}
|
154
154
|
/**
|
155
155
|
* 获得节点间的连线组,连线<=1时返回null
|
156
|
-
* @returns
|
156
|
+
* @returns
|
157
157
|
*/
|
158
158
|
|
159
159
|
export function getEdgeGroupByNodes(node1, node2) {
|
@@ -172,7 +172,7 @@ export function getEdgeGroupByNodes(node1, node2) {
|
|
172
172
|
}
|
173
173
|
/**
|
174
174
|
* 获得节点间的连线组,连线<=1时返回null
|
175
|
-
* @returns
|
175
|
+
* @returns
|
176
176
|
*/
|
177
177
|
|
178
178
|
export function getEdgeGroupByNodeTags(dataModel, nodeTag1, nodeTag2) {
|
@@ -180,7 +180,7 @@ export function getEdgeGroupByNodeTags(dataModel, nodeTag1, nodeTag2) {
|
|
180
180
|
var node2 = dataModel.getDataByTag(nodeTag2);
|
181
181
|
|
182
182
|
if (!node1 || !node2) {
|
183
|
-
console.warn(
|
183
|
+
console.warn("getEdgeGroupByNodes 未找到节点", {
|
184
184
|
node1: node1,
|
185
185
|
node2: node2,
|
186
186
|
nodeTag1: nodeTag1,
|
@@ -261,7 +261,7 @@ export function getGroupChildren(group) {
|
|
261
261
|
|
262
262
|
|
263
263
|
return group.getChildren().getArray().filter(function (node) {
|
264
|
-
return node._layer !==
|
264
|
+
return node._layer !== "container_blank";
|
265
265
|
});
|
266
266
|
}
|
267
267
|
/**
|
@@ -291,7 +291,7 @@ export function getGroupChildrenData(group) {
|
|
291
291
|
export function setElementRuntimeStyle(element, name, value) {
|
292
292
|
var _extends2;
|
293
293
|
|
294
|
-
var prevRuntimeStyle = element.a(
|
294
|
+
var prevRuntimeStyle = element.a("runtimeStyles") || {};
|
295
295
|
|
296
296
|
var runtimeStyle = _extends({}, prevRuntimeStyle, (_extends2 = {}, _extends2[name] = value, _extends2)); // if (prevRuntimeStyle[name] === undefined && value === undefined) {
|
297
297
|
// return
|
@@ -302,7 +302,7 @@ export function setElementRuntimeStyle(element, name, value) {
|
|
302
302
|
runtimeStyle[name] = undefined; // delete runtimeStyle[name]
|
303
303
|
}
|
304
304
|
|
305
|
-
element.a(
|
305
|
+
element.a("runtimeStyles", runtimeStyle);
|
306
306
|
}
|
307
307
|
/**
|
308
308
|
* 判断拓扑图是否存在元素
|
@@ -315,7 +315,7 @@ export function isExistedElement(htTopo, dataModel, data) {
|
|
315
315
|
|
316
316
|
|
317
317
|
var element = getElements(dataModel).find(function (item) {
|
318
|
-
return data.tag && item.a(
|
318
|
+
return data.tag && item.a("tag") === data.tag;
|
319
319
|
});
|
320
320
|
|
321
321
|
if (element) {
|
@@ -3,8 +3,8 @@
|
|
3
3
|
|
4
4
|
.tabs {
|
5
5
|
height: 100%;
|
6
|
-
|
7
|
-
}
|
6
|
+
display: flex;
|
7
|
+
}
|
8
8
|
|
9
9
|
// 导航
|
10
10
|
.nav {
|
@@ -49,17 +49,23 @@
|
|
49
49
|
|
50
50
|
// 标签页内容区
|
51
51
|
.content {
|
52
|
-
width: 260px;
|
52
|
+
// width: 260px;
|
53
53
|
height: 100%;
|
54
54
|
border-left: none !important;
|
55
|
-
border-right: 1px solid var(--tab-wrapped-border-line-color);
|
56
55
|
transition: width .1s linear;
|
56
|
+
overflow: initial !important;
|
57
57
|
|
58
58
|
:global {
|
59
59
|
.#{$css-prefix}tabs-tabpane {
|
60
|
-
|
60
|
+
position: absolute;
|
61
|
+
left: 0;
|
62
|
+
top: 0;
|
63
|
+
z-index: 1;
|
64
|
+
// width: 250px;
|
61
65
|
height: 100%;
|
62
66
|
overflow: auto;
|
67
|
+
background: #FFF;
|
68
|
+
border-right: 1px solid var(--tab-wrapped-border-line-color);
|
63
69
|
}
|
64
70
|
}
|
65
71
|
|
@@ -7,8 +7,12 @@ 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
|
|
14
|
+
var _useTopoFullscreen = _interopRequireDefault(require("../../hooks/useTopoFullscreen"));
|
15
|
+
|
12
16
|
var _TopoViewModule = _interopRequireDefault(require("./TopoView.module.scss"));
|
13
17
|
|
14
18
|
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); }
|
@@ -16,6 +20,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
16
20
|
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
21
|
|
18
22
|
function GraphViewPanel(props) {
|
23
|
+
var _classNames;
|
24
|
+
|
19
25
|
var topo = props.topo,
|
20
26
|
hideBackgroundColor = props.hideBackgroundColor;
|
21
27
|
var displayConfig = topo.store.useModelState('displayConfig');
|
@@ -26,8 +32,14 @@ function GraphViewPanel(props) {
|
|
26
32
|
themeName: themeName,
|
27
33
|
hideBackgroundColor: hideBackgroundColor
|
28
34
|
}),
|
29
|
-
canvasColor = _useCanvasTheme.canvasColor
|
35
|
+
canvasColor = _useCanvasTheme.canvasColor,
|
36
|
+
canvasbackgroundImage = _useCanvasTheme.canvasbackgroundImage;
|
30
37
|
|
38
|
+
var panelRef = (0, _react.useRef)();
|
39
|
+
(0, _useTopoFullscreen["default"])({
|
40
|
+
topo: topo,
|
41
|
+
panelRef: panelRef
|
42
|
+
});
|
31
43
|
(0, _react.useEffect)(function () {
|
32
44
|
// eslint-disable-next-line no-underscore-dangle
|
33
45
|
window._debugtopo = topo; // eslint-disable-next-line no-underscore-dangle
|
@@ -43,9 +55,12 @@ function GraphViewPanel(props) {
|
|
43
55
|
};
|
44
56
|
|
45
57
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
46
|
-
|
47
|
-
|
58
|
+
ref: panelRef,
|
59
|
+
className: (0, _classnames["default"])(_TopoViewModule["default"].viewPanel, (_classNames = {}, _classNames[_TopoViewModule["default"].backgroundImg] = !!canvasbackgroundImage, _classNames)),
|
60
|
+
style: canvasColor ? {
|
48
61
|
background: canvasColor
|
62
|
+
} : {
|
63
|
+
backgroundImage: "url(" + canvasbackgroundImage + ")"
|
49
64
|
},
|
50
65
|
onFocus: onFocus
|
51
66
|
}, 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
|
+
}
|
@@ -9,6 +9,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
9
9
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
11
11
|
|
12
|
+
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
13
|
+
|
12
14
|
var _CustomIconPlugin = _interopRequireDefault(require("./CustomIconPlugin"));
|
13
15
|
|
14
16
|
var _SaveLoading = _interopRequireDefault(require("./plugins/SaveLoading"));
|
@@ -36,7 +38,11 @@ function TopoEditorPlugin(props) {
|
|
36
38
|
graphLoaded = _topo$store$useModelS.graphLoaded;
|
37
39
|
|
38
40
|
(0, _react.useEffect)(function () {
|
41
|
+
_rlog["default"].debug('TopoEditorPlugin 进来了');
|
42
|
+
|
39
43
|
return function () {
|
44
|
+
_rlog["default"].debug('TopoEditorPlugin 进来了');
|
45
|
+
|
40
46
|
topoEdit.reset();
|
41
47
|
};
|
42
48
|
}, []);
|
@@ -48,7 +54,7 @@ function TopoEditorPlugin(props) {
|
|
48
54
|
var plugins = [_CorePlugin["default"], _SaveLoading["default"], _AddElementThemePlugin["default"], _CustomIconPlugin["default"], _GroupAddResourceDrawerPlugin["default"], _MetricPollingPlugin["default"]].concat((editorProps === null || editorProps === void 0 ? void 0 : editorProps.plugins) || []);
|
49
55
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, plugins.map(function (Plugin, index) {
|
50
56
|
return /*#__PURE__*/_react["default"].createElement(Plugin, (0, _extends2["default"])({
|
51
|
-
key: index,
|
57
|
+
key: Plugin.pluginName || index,
|
52
58
|
store: store
|
53
59
|
}, props));
|
54
60
|
}));
|
@@ -1,19 +1,19 @@
|
|
1
1
|
.sidebar {
|
2
2
|
// border-right: 1px solid #E6E7EB;
|
3
3
|
position: relative;
|
4
|
-
width: 60px;
|
4
|
+
// width: 60px;
|
5
5
|
|
6
6
|
.tabsContainer {
|
7
|
-
position: absolute;
|
8
|
-
|
7
|
+
// position: absolute;
|
8
|
+
// left: 0;
|
9
|
+
// top: 0;
|
10
|
+
// z-index: 1;
|
11
|
+
// width: 60px;
|
9
12
|
height: 100%;
|
10
|
-
left: 0;
|
11
|
-
top: 0;
|
12
|
-
z-index: 1;
|
13
13
|
background: #FFF;
|
14
14
|
|
15
15
|
&.expanded {
|
16
|
-
width: 320px;
|
16
|
+
// width: 320px;
|
17
17
|
}
|
18
18
|
}
|
19
19
|
}
|
@@ -36,7 +36,7 @@ function CanvasPanel(props) {
|
|
36
36
|
}, /*#__PURE__*/_react["default"].createElement(_tag["default"].Selectable, {
|
37
37
|
className: _CanvasPanelModule["default"].tag,
|
38
38
|
style: {
|
39
|
-
background: item.color
|
39
|
+
background: item.color || "url(" + item.backgroundImageThumbnail + ")"
|
40
40
|
},
|
41
41
|
checked: item.name === canvasThemeName,
|
42
42
|
onChange: function onChange(checked) {
|