@riil-frontend/component-topology 9.0.0-a.11 → 9.0.0-a.12
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/index.js +9 -9
- package/es/core/editor/components/settings/core/updateElementProperty.js +6 -1
- package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +61 -0
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +27 -8
- package/es/core/hooks/useTopoEdit.js +133 -16
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/utils/linkUtils.js +18 -0
- package/es/core/store/models/topoConfig.js +36 -7
- package/es/core/test/Test.js +52 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +7 -78
- 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/networkTopo/services/link.js +1 -1
- package/es/networkTopo/services/topo/basic.js +4 -3
- package/es/networkTopo/services/topo/networkLink.js +45 -3
- package/es/networkTopo/utils/exitLinkUtil.js +110 -0
- package/es/utils/htElementUtils.js +43 -21
- package/lib/core/editor/components/settings/core/updateElementProperty.js +6 -1
- package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +74 -0
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +28 -8
- package/lib/core/hooks/useTopoEdit.js +133 -15
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/utils/linkUtils.js +21 -1
- package/lib/core/store/models/topoConfig.js +37 -7
- package/lib/core/test/Test.js +52 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +6 -78
- 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/networkTopo/services/topo/basic.js +5 -3
- package/lib/networkTopo/services/topo/networkLink.js +45 -3
- package/lib/networkTopo/utils/exitLinkUtil.js +115 -0
- package/lib/utils/htElementUtils.js +45 -21
- package/package.json +2 -2
@@ -32,6 +32,7 @@ exports.isGroup = isGroup;
|
|
32
32
|
exports.isLayer = isLayer;
|
33
33
|
exports.isNode = isNode;
|
34
34
|
exports.isText = isText;
|
35
|
+
exports.isUniqueIp = isUniqueIp;
|
35
36
|
exports.isValidEdge = isValidEdge;
|
36
37
|
exports.setElementRuntimeStyle = setElementRuntimeStyle;
|
37
38
|
|
@@ -55,7 +56,7 @@ function getElementData(element) {
|
|
55
56
|
styleMap: element.getStyleMap()
|
56
57
|
};
|
57
58
|
|
58
|
-
if (className ===
|
59
|
+
if (className === "ht.Edge") {
|
59
60
|
return (0, _extends3["default"])({}, commonData);
|
60
61
|
}
|
61
62
|
|
@@ -67,7 +68,7 @@ function getElementData(element) {
|
|
67
68
|
function isNode(element) {
|
68
69
|
// HT为了支持区域内无节点可展开增加了站位节点,因此 节点的layer等于container_blank的过滤掉就可以了
|
69
70
|
// eslint-disable-next-line no-underscore-dangle
|
70
|
-
return element instanceof ht.Node && !isLayer(element) && element._layer !==
|
71
|
+
return element instanceof ht.Node && !isLayer(element) && element._layer !== "container_blank";
|
71
72
|
}
|
72
73
|
|
73
74
|
function isEdge(element) {
|
@@ -80,7 +81,7 @@ function isValidEdge(element) {
|
|
80
81
|
}
|
81
82
|
|
82
83
|
if (!element.getSource() || !element.getTarget()) {
|
83
|
-
_rlog["default"].error(
|
84
|
+
_rlog["default"].error("isValidEdge 连线异常:源或目的为空", element);
|
84
85
|
|
85
86
|
return false;
|
86
87
|
}
|
@@ -97,7 +98,30 @@ function isLayer(element) {
|
|
97
98
|
}
|
98
99
|
|
99
100
|
function isText(element) {
|
100
|
-
return element instanceof ht.Text && element.a(
|
101
|
+
return element instanceof ht.Text && element.a("isText");
|
102
|
+
}
|
103
|
+
|
104
|
+
function isUniqueIp(dataModel, ip) {
|
105
|
+
console.log("isUniqueIp", ip);
|
106
|
+
var nodes = getNodes(dataModel);
|
107
|
+
var isUnique = true;
|
108
|
+
|
109
|
+
for (var i = 0; i < nodes.length; i++) {
|
110
|
+
var element = nodes[i];
|
111
|
+
var tagTxt = element.getTag();
|
112
|
+
console.log("isUniqueIp-element", tagTxt, ip);
|
113
|
+
|
114
|
+
if (tagTxt !== null && tagTxt !== void 0 && tagTxt.startsWith("ip_")) {
|
115
|
+
var ipTxt = tagTxt.replace("ip_", '');
|
116
|
+
|
117
|
+
if (ipTxt === ip) {
|
118
|
+
isUnique = false;
|
119
|
+
break;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
return isUnique;
|
101
125
|
}
|
102
126
|
|
103
127
|
function getElements(dataModel) {
|
@@ -123,7 +147,7 @@ function getGroupDatas(dataModel) {
|
|
123
147
|
|
124
148
|
function getGroupElementByTag(dataModel, tag) {
|
125
149
|
return dataModel.getDataByTag(tag) || dataModel.getDatas().toArray().filter(function (item) {
|
126
|
-
return item.a(
|
150
|
+
return item.a("tag") === tag;
|
127
151
|
})[0];
|
128
152
|
}
|
129
153
|
|
@@ -135,14 +159,14 @@ function getGroupData(element) {
|
|
135
159
|
var parent = element.getParent();
|
136
160
|
var groupInfo = parent ? {
|
137
161
|
groupId: parent.getTag(),
|
138
|
-
groupTag: parent.a(
|
162
|
+
groupTag: parent.a("tag") // 父容器
|
139
163
|
|
140
164
|
} : {};
|
141
165
|
return (0, _extends3["default"])({
|
142
166
|
name: element.getStyleMap().label
|
143
167
|
}, element.getAttrObject(), {
|
144
168
|
id: element.getTag(),
|
145
|
-
tag: element.a(
|
169
|
+
tag: element.a("tag"),
|
146
170
|
image: element.getImage()
|
147
171
|
}, groupInfo);
|
148
172
|
}
|
@@ -159,7 +183,7 @@ function getNodeData(element) {
|
|
159
183
|
var parent = element.getParent();
|
160
184
|
var groupInfo = parent ? {
|
161
185
|
groupId: parent.getTag(),
|
162
|
-
groupTag: parent.a(
|
186
|
+
groupTag: parent.a("tag") // 父容器
|
163
187
|
|
164
188
|
} : {};
|
165
189
|
return (0, _extends3["default"])({}, element.getAttrObject(), {
|
@@ -173,12 +197,12 @@ function getEdges(dataModel) {
|
|
173
197
|
}
|
174
198
|
|
175
199
|
function isEdgeGroupExpanded(edge) {
|
176
|
-
return isEdge(edge) && edge.getEdgeGroup() && !!edge.s(
|
200
|
+
return isEdge(edge) && edge.getEdgeGroup() && !!edge.s("edge.expanded");
|
177
201
|
}
|
178
202
|
/**
|
179
203
|
* 是否连线组代理
|
180
|
-
* @param {*} edge
|
181
|
-
* @returns
|
204
|
+
* @param {*} edge
|
205
|
+
* @returns
|
182
206
|
*/
|
183
207
|
|
184
208
|
|
@@ -187,9 +211,9 @@ function isEdgeGroupAgent(edge) {
|
|
187
211
|
}
|
188
212
|
/**
|
189
213
|
* 获得两个节点间的连线列表
|
190
|
-
* @param {*} node1
|
191
|
-
* @param {*} node2
|
192
|
-
* @returns
|
214
|
+
* @param {*} node1
|
215
|
+
* @param {*} node2
|
216
|
+
* @returns
|
193
217
|
*/
|
194
218
|
|
195
219
|
|
@@ -212,7 +236,7 @@ function getEdgesBetweenNodes(node1, node2) {
|
|
212
236
|
}
|
213
237
|
/**
|
214
238
|
* 获得节点间的连线组,连线<=1时返回null
|
215
|
-
* @returns
|
239
|
+
* @returns
|
216
240
|
*/
|
217
241
|
|
218
242
|
|
@@ -232,7 +256,7 @@ function getEdgeGroupByNodes(node1, node2) {
|
|
232
256
|
}
|
233
257
|
/**
|
234
258
|
* 获得节点间的连线组,连线<=1时返回null
|
235
|
-
* @returns
|
259
|
+
* @returns
|
236
260
|
*/
|
237
261
|
|
238
262
|
|
@@ -241,7 +265,7 @@ function getEdgeGroupByNodeTags(dataModel, nodeTag1, nodeTag2) {
|
|
241
265
|
var node2 = dataModel.getDataByTag(nodeTag2);
|
242
266
|
|
243
267
|
if (!node1 || !node2) {
|
244
|
-
console.warn(
|
268
|
+
console.warn("getEdgeGroupByNodes 未找到节点", {
|
245
269
|
node1: node1,
|
246
270
|
node2: node2,
|
247
271
|
nodeTag1: nodeTag1,
|
@@ -328,7 +352,7 @@ function getGroupChildren(group) {
|
|
328
352
|
|
329
353
|
|
330
354
|
return group.getChildren().getArray().filter(function (node) {
|
331
|
-
return node._layer !==
|
355
|
+
return node._layer !== "container_blank";
|
332
356
|
});
|
333
357
|
}
|
334
358
|
/**
|
@@ -361,7 +385,7 @@ function getGroupChildrenData(group) {
|
|
361
385
|
function setElementRuntimeStyle(element, name, value) {
|
362
386
|
var _extends2;
|
363
387
|
|
364
|
-
var prevRuntimeStyle = element.a(
|
388
|
+
var prevRuntimeStyle = element.a("runtimeStyles") || {};
|
365
389
|
var runtimeStyle = (0, _extends3["default"])({}, prevRuntimeStyle, (_extends2 = {}, _extends2[name] = value, _extends2)); // if (prevRuntimeStyle[name] === undefined && value === undefined) {
|
366
390
|
// return
|
367
391
|
// }
|
@@ -370,7 +394,7 @@ function setElementRuntimeStyle(element, name, value) {
|
|
370
394
|
runtimeStyle[name] = undefined; // delete runtimeStyle[name]
|
371
395
|
}
|
372
396
|
|
373
|
-
element.a(
|
397
|
+
element.a("runtimeStyles", runtimeStyle);
|
374
398
|
}
|
375
399
|
/**
|
376
400
|
* 判断拓扑图是否存在元素
|
@@ -384,7 +408,7 @@ function isExistedElement(htTopo, dataModel, data) {
|
|
384
408
|
|
385
409
|
|
386
410
|
var element = getElements(dataModel).find(function (item) {
|
387
|
-
return data.tag && item.a(
|
411
|
+
return data.tag && item.a("tag") === data.tag;
|
388
412
|
});
|
389
413
|
|
390
414
|
if (element) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "9.0.0-a.
|
3
|
+
"version": "9.0.0-a.12",
|
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.0-a.
|
119
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.0-a.12/build/index.html",
|
120
120
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
121
121
|
}
|