@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,269 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
exports.__esModule = true;
|
6
|
+
exports.buildIpNode = buildIpNode;
|
7
|
+
exports.isUniqueIp = isUniqueIp;
|
8
|
+
exports.processByConditionResult = processByConditionResult;
|
9
|
+
exports.processExitLink = processExitLink;
|
10
|
+
|
11
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
12
|
+
|
13
|
+
var _htElementUtils = require("../../utils/htElementUtils");
|
14
|
+
|
15
|
+
function findPingNodeFromHt(nodes, ip) {
|
16
|
+
return nodes.find(function (node) {
|
17
|
+
return node.a('ciType') === "ping" && node.a('ipAddress') === ip;
|
18
|
+
});
|
19
|
+
}
|
20
|
+
|
21
|
+
function isPingHtNode(node, ip) {
|
22
|
+
return node.a('ciType') === "ping" && node.a('ipAddress') === ip;
|
23
|
+
}
|
24
|
+
|
25
|
+
function isIpHtNode(node, ip) {
|
26
|
+
return node.a("bindType") === 'ip' && node.a("bindIp") === ip;
|
27
|
+
}
|
28
|
+
|
29
|
+
function buildIpNode(ip) {
|
30
|
+
return {
|
31
|
+
id: "ip:" + ip,
|
32
|
+
name: ip,
|
33
|
+
bindType: "ip",
|
34
|
+
// 绑定资源类型。关联资源 值为空,关联IP ip
|
35
|
+
bindIp: ip,
|
36
|
+
// TODO 所属区域,从序列化拿
|
37
|
+
// 'groupId': null,
|
38
|
+
// 'groupTag': null,
|
39
|
+
ipAddress: ip,
|
40
|
+
// 'attributes': [],
|
41
|
+
// 'metrics': [],
|
42
|
+
type: "node",
|
43
|
+
isbinding: true,
|
44
|
+
// 'dtype': 'device'
|
45
|
+
operation: "delete"
|
46
|
+
};
|
47
|
+
}
|
48
|
+
|
49
|
+
function getHtSerialize(serialize) {
|
50
|
+
if (serialize) {
|
51
|
+
return JSON.parse(serialize);
|
52
|
+
}
|
53
|
+
|
54
|
+
return null;
|
55
|
+
}
|
56
|
+
|
57
|
+
function isExitLink(link) {
|
58
|
+
return link.attributes.destination_type === "ip";
|
59
|
+
} // 判断拓扑图上ip是否唯一
|
60
|
+
|
61
|
+
|
62
|
+
function isUniqueIp(dataModel, ip, nodeElement) {
|
63
|
+
var nodes = (0, _htElementUtils.getNodes)(dataModel);
|
64
|
+
var isUnique = true; // console.log("nodes-nodeElement", nodes, nodeElement);
|
65
|
+
|
66
|
+
if (nodeElement) {
|
67
|
+
var arr = nodes.filter(function (node) {
|
68
|
+
return node.getId() !== (nodeElement === null || nodeElement === void 0 ? void 0 : nodeElement.getId());
|
69
|
+
}).filter(function (node) {
|
70
|
+
return isPingHtNode(node, ip) || isIpHtNode(node, ip);
|
71
|
+
});
|
72
|
+
isUnique = arr.length === 0;
|
73
|
+
} else {
|
74
|
+
isUnique = nodes.filter(function (node) {
|
75
|
+
return node.a("ipAddress") === ip;
|
76
|
+
}).length === 0;
|
77
|
+
}
|
78
|
+
|
79
|
+
return isUnique;
|
80
|
+
}
|
81
|
+
/**
|
82
|
+
* 打开拓扑出口链路处理
|
83
|
+
* @param {*} topoData
|
84
|
+
* @returns
|
85
|
+
*/
|
86
|
+
|
87
|
+
|
88
|
+
function processExitLink(topoData) {
|
89
|
+
var nodes = topoData.nodes,
|
90
|
+
links = topoData.links; // 出口链路目的端设置为IP节点或者ping资源节点id
|
91
|
+
|
92
|
+
var newLinks = updateLinkTarget(links, nodes);
|
93
|
+
|
94
|
+
if (!topoData.serialize) {
|
95
|
+
return (0, _extends2["default"])({}, topoData, {
|
96
|
+
links: newLinks
|
97
|
+
});
|
98
|
+
}
|
99
|
+
|
100
|
+
var serialize = (0, _extends2["default"])({}, getHtSerialize(topoData.serialize)); // 历史数据升级
|
101
|
+
|
102
|
+
links.filter(isExitLink) // 升级V1.4前配置的出口链路目的端节点为IP节点
|
103
|
+
.forEach(function (link) {
|
104
|
+
return upgradeExitLinkTarget(link, serialize);
|
105
|
+
}); // 历史数据适配:同IP节点关联多个不同IP的链路、分级拓扑。target匹配不到元素时,根据序列化匹配
|
106
|
+
|
107
|
+
newLinks = upgradeLinkTargetNotExisted(newLinks); // IP节点构造为node。如果有相同ip的ping资源和图片节点,图片节点消失(不构造)
|
108
|
+
|
109
|
+
var ipNodes = getIpNodes(serialize, nodes);
|
110
|
+
return (0, _extends2["default"])({}, topoData, {
|
111
|
+
nodes: [].concat(nodes, ipNodes),
|
112
|
+
links: newLinks,
|
113
|
+
serialize: serialize
|
114
|
+
}); // 历史数据适配:同IP节点关联多个不同IP的链路、分级拓扑。target匹配不到元素时,根据序列化匹配
|
115
|
+
|
116
|
+
function upgradeLinkTargetNotExisted(links) {
|
117
|
+
newLinks = links.map(function (link) {
|
118
|
+
if (!isExitLink(link) || link.target && nodes.find(function (node) {
|
119
|
+
return node.id === link.target;
|
120
|
+
})) {
|
121
|
+
return link;
|
122
|
+
}
|
123
|
+
|
124
|
+
var destinationIp = link.attributes['network_link.destination_ipv4'];
|
125
|
+
var pingNode = findPingNode(nodes, destinationIp); // 出口链路目的端设置为IP节点或者ping资源节点id
|
126
|
+
|
127
|
+
var target = link.target; // 历史数据适配:同IP节点关联多个不同IP的链路、分级拓扑。target匹配不到元素时,根据序列化匹配
|
128
|
+
|
129
|
+
var targetSerialize = findElementSerializeById(serialize, target);
|
130
|
+
|
131
|
+
if (!targetSerialize) {
|
132
|
+
var linkSerialize = findElementSerializeById(serialize, link.id);
|
133
|
+
|
134
|
+
if (linkSerialize) {
|
135
|
+
// 根据链路序列化数据找目的端节点
|
136
|
+
// eslint-disable-next-line no-underscore-dangle
|
137
|
+
var targetNodeSerialize = serialize.d.find(function (item) {
|
138
|
+
var _linkSerialize$p$targ;
|
139
|
+
|
140
|
+
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);
|
141
|
+
});
|
142
|
+
|
143
|
+
if (targetNodeSerialize) {
|
144
|
+
target = targetNodeSerialize.p.tag;
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
return (0, _extends2["default"])({}, link, {
|
150
|
+
target: target
|
151
|
+
});
|
152
|
+
});
|
153
|
+
return newLinks;
|
154
|
+
}
|
155
|
+
|
156
|
+
function getIpNodes(serialize, nodes) {
|
157
|
+
// 从序列化获取关联的IP
|
158
|
+
var ips = serialize.d.filter(function (item) {
|
159
|
+
return item.a.bindType === 'ip';
|
160
|
+
}).map(function (item) {
|
161
|
+
return item.a.bindIp;
|
162
|
+
}).filter(function (item) {
|
163
|
+
return !!item;
|
164
|
+
}) // 过滤ping资源对应的ip
|
165
|
+
.filter(function (ip) {
|
166
|
+
return !findPingNode(nodes, ip);
|
167
|
+
});
|
168
|
+
return ips.map(buildIpNode);
|
169
|
+
}
|
170
|
+
|
171
|
+
function findIpNodeSerialize(serialize, ip) {
|
172
|
+
return serialize.d.find(function (item) {
|
173
|
+
return item.p.tag === "ip:" + ip;
|
174
|
+
});
|
175
|
+
}
|
176
|
+
|
177
|
+
function findElementSerializeById(serialize, id) {
|
178
|
+
return serialize.d.find(function (item) {
|
179
|
+
return item.a.id === id;
|
180
|
+
});
|
181
|
+
}
|
182
|
+
/**
|
183
|
+
* 链路在序列化存在且目的端不是ping资源、IP节点时,升级链路目的端序列化数据为IP节点
|
184
|
+
* @param {*} link
|
185
|
+
*/
|
186
|
+
|
187
|
+
|
188
|
+
function upgradeExitLinkTarget(link, serialize) {
|
189
|
+
var destinationIp = link.attributes['network_link.destination_ipv4'];
|
190
|
+
var linkSerialize = findElementSerializeById(serialize, link.id);
|
191
|
+
|
192
|
+
if (linkSerialize) {
|
193
|
+
// 根据链路序列化数据找目的端节点
|
194
|
+
// eslint-disable-next-line no-underscore-dangle
|
195
|
+
var targetNodeSerialize = serialize.d.find(function (item) {
|
196
|
+
var _linkSerialize$p$targ2;
|
197
|
+
|
198
|
+
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);
|
199
|
+
});
|
200
|
+
|
201
|
+
if (targetNodeSerialize && !targetNodeSerialize.p.tag) {
|
202
|
+
targetNodeSerialize.a = (0, _extends2["default"])({}, targetNodeSerialize.a, buildIpNode(destinationIp), {
|
203
|
+
isbinding: true
|
204
|
+
});
|
205
|
+
targetNodeSerialize.p.tag = "ip:" + destinationIp;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
} // 从拓扑数据查找
|
210
|
+
|
211
|
+
|
212
|
+
function findPingNode(nodes, ip) {
|
213
|
+
return nodes.find(function (node) {
|
214
|
+
return node.ciType === "ping" && (node.ipAddress || node.attributes.ipv4_address) === ip;
|
215
|
+
});
|
216
|
+
} // 出口链路目的端设置为IP节点或者ping资源节点id
|
217
|
+
|
218
|
+
|
219
|
+
function updateLinkTarget(links, nodes) {
|
220
|
+
var newLinks = links.map(function (link) {
|
221
|
+
if (!isExitLink(link) || link.target && nodes.find(function (node) {
|
222
|
+
return node.id === link.target;
|
223
|
+
})) {
|
224
|
+
return link;
|
225
|
+
}
|
226
|
+
|
227
|
+
var destinationIp = link.attributes['network_link.destination_ipv4'];
|
228
|
+
var pingNode = findPingNode(nodes, destinationIp); // 出口链路目的端设置为IP节点或者ping资源节点id
|
229
|
+
|
230
|
+
var target = pingNode ? pingNode.id : "ip:" + destinationIp;
|
231
|
+
return (0, _extends2["default"])({}, link, {
|
232
|
+
target: target
|
233
|
+
});
|
234
|
+
});
|
235
|
+
return newLinks;
|
236
|
+
}
|
237
|
+
/**
|
238
|
+
* 编辑模式按资源查询拓扑数据处理出口链路target
|
239
|
+
* 1. 出口链路目的端设置为IP节点或者ping资源节点id
|
240
|
+
* 2. IP构造为node节点
|
241
|
+
* FIXME 移到frontend 网络拓扑编辑
|
242
|
+
* @param {*} topoData
|
243
|
+
* @returns
|
244
|
+
*/
|
245
|
+
|
246
|
+
|
247
|
+
function processByConditionResult(topoData, groupConfigs) {
|
248
|
+
var nodes = topoData.nodes,
|
249
|
+
links = topoData.links;
|
250
|
+
var ipNodes = getIpNodes(groupConfigs, nodes); // 出口链路目的端设置为IP节点或者ping资源节点id
|
251
|
+
|
252
|
+
var newLinks = updateLinkTarget(links, nodes);
|
253
|
+
return (0, _extends2["default"])({}, topoData, {
|
254
|
+
nodes: [].concat(nodes, ipNodes),
|
255
|
+
links: newLinks
|
256
|
+
});
|
257
|
+
|
258
|
+
function getIpNodes(groupConfigs, nodes) {
|
259
|
+
var ips = groupConfigs.map(function (g) {
|
260
|
+
return g.condition.linkIps;
|
261
|
+
}).reduce(function (result, groupIps) {
|
262
|
+
return [].concat(result, groupIps);
|
263
|
+
}, []) // 过滤ping资源对应的ip节点
|
264
|
+
.filter(function (ip) {
|
265
|
+
return !findPingNode(nodes, ip);
|
266
|
+
});
|
267
|
+
return ips.map(buildIpNode);
|
268
|
+
}
|
269
|
+
}
|
package/lib/style.js
CHANGED
@@ -14,6 +14,7 @@ require('@riil-frontend/component-pager/lib/style');
|
|
14
14
|
require('@alifd/next/lib/button/style');
|
15
15
|
require('@alifd/next/lib/icon/style');
|
16
16
|
require('@alifd/next/lib/loading/style');
|
17
|
+
require('@alifd/next/lib/switch/style');
|
17
18
|
require('@alifd/next/lib/divider/style');
|
18
19
|
require('@riil-frontend/component-no-data-page/lib/style');
|
19
20
|
|
@@ -13,8 +13,6 @@ var _linkUtils = require("../core/models/utils/linkUtils");
|
|
13
13
|
|
14
14
|
var _clusterUtil = require("./clusterUtil");
|
15
15
|
|
16
|
-
var _htElementDataUtil = require("./htElementDataUtil");
|
17
|
-
|
18
16
|
var _htElementUtils = require("./htElementUtils");
|
19
17
|
|
20
18
|
/**
|
@@ -118,7 +116,9 @@ function getLayerDatas(dataModel) {
|
|
118
116
|
name: layerElement.s('label'),
|
119
117
|
order: layerElement.a('order'),
|
120
118
|
resources: {
|
121
|
-
"static": (0,
|
119
|
+
"static": (0, _htElementUtils.getLayerChildren)(layerElement).filter(function (item) {
|
120
|
+
return !!item.getTag();
|
121
|
+
}).map(function (node) {
|
122
122
|
return node.getTag();
|
123
123
|
})
|
124
124
|
}
|
@@ -147,7 +147,7 @@ function getGroupConfigByElement(groupElement) {
|
|
147
147
|
name: groupElement.a('name'),
|
148
148
|
order: groupElement.a('order'),
|
149
149
|
resources: {
|
150
|
-
"static": (0,
|
150
|
+
"static": (0, _htElementUtils.getGroupChildren)(groupElement).filter(function (node) {
|
151
151
|
return !!node.getTag();
|
152
152
|
}).map(function (node) {
|
153
153
|
return node.getTag();
|
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.getAllEdgeResourceIds = void 0;
|
5
|
-
exports.getGroupChildrenResourceElements = getGroupChildrenResourceElements;
|
6
|
-
exports.getLayerChildrenResourceElements = getLayerChildrenResourceElements;
|
7
5
|
exports.isEdge = isEdge;
|
8
6
|
exports.isGroup = isGroup;
|
9
7
|
exports.isLayer = isLayer;
|
@@ -46,14 +44,6 @@ function isResourceNodeElement(element) {
|
|
46
44
|
return (htElementUtils.isGroup(element) || htElementUtils.isNode(element)) && isResourceElement(element);
|
47
45
|
}
|
48
46
|
|
49
|
-
function getGroupChildrenResourceElements(element) {
|
50
|
-
return (0, htElementUtils.getGroupChildren)(element).filter(isResourceElement);
|
51
|
-
}
|
52
|
-
|
53
|
-
function getLayerChildrenResourceElements(layerElement) {
|
54
|
-
return (0, htElementUtils.getLayerChildren)(layerElement).filter(isResourceElement);
|
55
|
-
}
|
56
|
-
|
57
47
|
var getAllEdgeResourceIds = function getAllEdgeResourceIds(dm) {
|
58
48
|
return (0, htElementUtils.getEdges)(dm).filter(function (node) {
|
59
49
|
return !!node.getTag();
|
@@ -55,7 +55,7 @@ function getElementData(element) {
|
|
55
55
|
styleMap: element.getStyleMap()
|
56
56
|
};
|
57
57
|
|
58
|
-
if (className ===
|
58
|
+
if (className === "ht.Edge") {
|
59
59
|
return (0, _extends3["default"])({}, commonData);
|
60
60
|
}
|
61
61
|
|
@@ -67,7 +67,7 @@ function getElementData(element) {
|
|
67
67
|
function isNode(element) {
|
68
68
|
// HT为了支持区域内无节点可展开增加了站位节点,因此 节点的layer等于container_blank的过滤掉就可以了
|
69
69
|
// eslint-disable-next-line no-underscore-dangle
|
70
|
-
return element instanceof ht.Node && !isLayer(element) && element._layer !==
|
70
|
+
return element instanceof ht.Node && !isLayer(element) && element._layer !== "container_blank";
|
71
71
|
}
|
72
72
|
|
73
73
|
function isEdge(element) {
|
@@ -80,7 +80,7 @@ function isValidEdge(element) {
|
|
80
80
|
}
|
81
81
|
|
82
82
|
if (!element.getSource() || !element.getTarget()) {
|
83
|
-
_rlog["default"].error(
|
83
|
+
_rlog["default"].error("isValidEdge 连线异常:源或目的为空", element);
|
84
84
|
|
85
85
|
return false;
|
86
86
|
}
|
@@ -97,7 +97,7 @@ function isLayer(element) {
|
|
97
97
|
}
|
98
98
|
|
99
99
|
function isText(element) {
|
100
|
-
return element instanceof ht.Text && element.a(
|
100
|
+
return element instanceof ht.Text && element.a("isText");
|
101
101
|
}
|
102
102
|
|
103
103
|
function getElements(dataModel) {
|
@@ -123,7 +123,7 @@ function getGroupDatas(dataModel) {
|
|
123
123
|
|
124
124
|
function getGroupElementByTag(dataModel, tag) {
|
125
125
|
return dataModel.getDataByTag(tag) || dataModel.getDatas().toArray().filter(function (item) {
|
126
|
-
return item.a(
|
126
|
+
return item.a("tag") === tag;
|
127
127
|
})[0];
|
128
128
|
}
|
129
129
|
|
@@ -135,14 +135,14 @@ function getGroupData(element) {
|
|
135
135
|
var parent = element.getParent();
|
136
136
|
var groupInfo = parent ? {
|
137
137
|
groupId: parent.getTag(),
|
138
|
-
groupTag: parent.a(
|
138
|
+
groupTag: parent.a("tag") // 父容器
|
139
139
|
|
140
140
|
} : {};
|
141
141
|
return (0, _extends3["default"])({
|
142
142
|
name: element.getStyleMap().label
|
143
143
|
}, element.getAttrObject(), {
|
144
144
|
id: element.getTag(),
|
145
|
-
tag: element.a(
|
145
|
+
tag: element.a("tag"),
|
146
146
|
image: element.getImage()
|
147
147
|
}, groupInfo);
|
148
148
|
}
|
@@ -159,7 +159,7 @@ function getNodeData(element) {
|
|
159
159
|
var parent = element.getParent();
|
160
160
|
var groupInfo = parent ? {
|
161
161
|
groupId: parent.getTag(),
|
162
|
-
groupTag: parent.a(
|
162
|
+
groupTag: parent.a("tag") // 父容器
|
163
163
|
|
164
164
|
} : {};
|
165
165
|
return (0, _extends3["default"])({}, element.getAttrObject(), {
|
@@ -173,12 +173,12 @@ function getEdges(dataModel) {
|
|
173
173
|
}
|
174
174
|
|
175
175
|
function isEdgeGroupExpanded(edge) {
|
176
|
-
return isEdge(edge) && edge.getEdgeGroup() && !!edge.s(
|
176
|
+
return isEdge(edge) && edge.getEdgeGroup() && !!edge.s("edge.expanded");
|
177
177
|
}
|
178
178
|
/**
|
179
179
|
* 是否连线组代理
|
180
|
-
* @param {*} edge
|
181
|
-
* @returns
|
180
|
+
* @param {*} edge
|
181
|
+
* @returns
|
182
182
|
*/
|
183
183
|
|
184
184
|
|
@@ -187,9 +187,9 @@ function isEdgeGroupAgent(edge) {
|
|
187
187
|
}
|
188
188
|
/**
|
189
189
|
* 获得两个节点间的连线列表
|
190
|
-
* @param {*} node1
|
191
|
-
* @param {*} node2
|
192
|
-
* @returns
|
190
|
+
* @param {*} node1
|
191
|
+
* @param {*} node2
|
192
|
+
* @returns
|
193
193
|
*/
|
194
194
|
|
195
195
|
|
@@ -212,7 +212,7 @@ function getEdgesBetweenNodes(node1, node2) {
|
|
212
212
|
}
|
213
213
|
/**
|
214
214
|
* 获得节点间的连线组,连线<=1时返回null
|
215
|
-
* @returns
|
215
|
+
* @returns
|
216
216
|
*/
|
217
217
|
|
218
218
|
|
@@ -232,7 +232,7 @@ function getEdgeGroupByNodes(node1, node2) {
|
|
232
232
|
}
|
233
233
|
/**
|
234
234
|
* 获得节点间的连线组,连线<=1时返回null
|
235
|
-
* @returns
|
235
|
+
* @returns
|
236
236
|
*/
|
237
237
|
|
238
238
|
|
@@ -241,7 +241,7 @@ function getEdgeGroupByNodeTags(dataModel, nodeTag1, nodeTag2) {
|
|
241
241
|
var node2 = dataModel.getDataByTag(nodeTag2);
|
242
242
|
|
243
243
|
if (!node1 || !node2) {
|
244
|
-
console.warn(
|
244
|
+
console.warn("getEdgeGroupByNodes 未找到节点", {
|
245
245
|
node1: node1,
|
246
246
|
node2: node2,
|
247
247
|
nodeTag1: nodeTag1,
|
@@ -328,7 +328,7 @@ function getGroupChildren(group) {
|
|
328
328
|
|
329
329
|
|
330
330
|
return group.getChildren().getArray().filter(function (node) {
|
331
|
-
return node._layer !==
|
331
|
+
return node._layer !== "container_blank";
|
332
332
|
});
|
333
333
|
}
|
334
334
|
/**
|
@@ -361,7 +361,7 @@ function getGroupChildrenData(group) {
|
|
361
361
|
function setElementRuntimeStyle(element, name, value) {
|
362
362
|
var _extends2;
|
363
363
|
|
364
|
-
var prevRuntimeStyle = element.a(
|
364
|
+
var prevRuntimeStyle = element.a("runtimeStyles") || {};
|
365
365
|
var runtimeStyle = (0, _extends3["default"])({}, prevRuntimeStyle, (_extends2 = {}, _extends2[name] = value, _extends2)); // if (prevRuntimeStyle[name] === undefined && value === undefined) {
|
366
366
|
// return
|
367
367
|
// }
|
@@ -370,7 +370,7 @@ function setElementRuntimeStyle(element, name, value) {
|
|
370
370
|
runtimeStyle[name] = undefined; // delete runtimeStyle[name]
|
371
371
|
}
|
372
372
|
|
373
|
-
element.a(
|
373
|
+
element.a("runtimeStyles", runtimeStyle);
|
374
374
|
}
|
375
375
|
/**
|
376
376
|
* 判断拓扑图是否存在元素
|
@@ -384,7 +384,7 @@ function isExistedElement(htTopo, dataModel, data) {
|
|
384
384
|
|
385
385
|
|
386
386
|
var element = getElements(dataModel).find(function (item) {
|
387
|
-
return data.tag && item.a(
|
387
|
+
return data.tag && item.a("tag") === data.tag;
|
388
388
|
});
|
389
389
|
|
390
390
|
if (element) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "9.0.
|
3
|
+
"version": "9.0.1",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -116,6 +116,6 @@
|
|
116
116
|
"access": "public"
|
117
117
|
},
|
118
118
|
"license": "MIT",
|
119
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.
|
119
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.1/build/index.html",
|
120
120
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
121
121
|
}
|