@riil-frontend/component-topology 9.0.0-a.12 → 9.0.0-a.16
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 +1 -6
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +8 -27
- package/es/core/hooks/useTopoEdit.js +16 -133
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/utils/linkUtils.js +0 -18
- package/es/core/store/models/topoConfig.js +7 -36
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +2 -2
- package/es/networkTopo/services/link.js +1 -1
- package/es/networkTopo/services/topo/basic.js +3 -4
- package/es/networkTopo/services/topo/networkLink.js +3 -45
- package/es/utils/htElementUtils.js +21 -43
- package/lib/core/editor/components/settings/core/updateElementProperty.js +1 -6
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +8 -28
- package/lib/core/hooks/useTopoEdit.js +15 -133
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/utils/linkUtils.js +1 -21
- package/lib/core/store/models/topoConfig.js +7 -37
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +2 -2
- package/lib/networkTopo/services/topo/basic.js +3 -5
- package/lib/networkTopo/services/topo/networkLink.js +3 -45
- package/lib/utils/htElementUtils.js +21 -45
- package/package.json +2 -2
- package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +0 -61
- package/es/networkTopo/utils/exitLinkUtil.js +0 -110
- package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +0 -74
- package/lib/networkTopo/utils/exitLinkUtil.js +0 -115
@@ -1,11 +1,6 @@
|
|
1
1
|
export default function updateElementProperty(topo, name, value) {
|
2
2
|
// const element = topo.getDataModel().getDataById(selection[0].id);
|
3
|
-
var element = topo.getSelectionModel().getFirstData();
|
4
|
-
console.info("updateElementProperty", topo.getSelectionModel().getSelection(), {
|
5
|
-
element: element,
|
6
|
-
name: name,
|
7
|
-
value: value
|
8
|
-
});
|
3
|
+
var element = topo.getSelectionModel().getFirstData(); // console.info("updateElementProperty",topo.getSelectionModel().getSelection(), { selection, element, name, value });
|
9
4
|
|
10
5
|
if (name.startsWith('attrObject.')) {
|
11
6
|
element.setAttr(name.replace('attrObject.', ''), value);
|
@@ -9,21 +9,19 @@ import React, { useEffect } from "react";
|
|
9
9
|
import textStyles from "../../../../../../common/text.module.scss";
|
10
10
|
import NodeRelateResourceButton from "./NodeRelateResourceButton";
|
11
11
|
import PlatformDisplay from "./PlatformDisplay";
|
12
|
-
import BindIpInput from "./BindIpInput";
|
13
12
|
var Option = _Select.Option;
|
14
13
|
var CollapsePanel = _Collapse.Panel;
|
15
14
|
|
16
15
|
function parseValues(values) {
|
17
16
|
return _extends({}, values, {
|
18
17
|
"attrObject.customName": values["attrObject.customName"] || values["attrObject.name"],
|
19
|
-
"attrObject.bindTopo": values["attrObject.bindTopo"] || ""
|
20
|
-
|
21
|
-
"attrObject.ipv4": values["attrObject.ipv4"] || ""
|
18
|
+
"attrObject.bindTopo": values["attrObject.bindTopo"] || "" // 解决切换节点时关联拓扑选项未重置
|
19
|
+
|
22
20
|
});
|
23
21
|
}
|
24
22
|
|
25
23
|
function getBindType(values) {
|
26
|
-
if (values.tag
|
24
|
+
if (values.tag) {
|
27
25
|
return "resource";
|
28
26
|
}
|
29
27
|
|
@@ -42,7 +40,6 @@ export default function Data(props) {
|
|
42
40
|
_onChange = props.onChange,
|
43
41
|
editorProps = props.editorProps;
|
44
42
|
var bindType = getBindType(values);
|
45
|
-
console.log("node, values", node, values);
|
46
43
|
|
47
44
|
var field = _Field.useField({
|
48
45
|
autoUnmount: false,
|
@@ -110,7 +107,7 @@ export default function Data(props) {
|
|
110
107
|
}, /*#__PURE__*/React.createElement(_Form, {
|
111
108
|
field: field,
|
112
109
|
labelAlign: "top"
|
113
|
-
},
|
110
|
+
}, !values.tag && /*#__PURE__*/React.createElement(_Form.Item, {
|
114
111
|
label: "\u5173\u8054\u7C7B\u578B"
|
115
112
|
}, /*#__PURE__*/React.createElement(_Select, {
|
116
113
|
name: "bindType",
|
@@ -124,9 +121,7 @@ export default function Data(props) {
|
|
124
121
|
value: "none"
|
125
122
|
}, "\u672A\u5173\u8054"), /*#__PURE__*/React.createElement(Option, {
|
126
123
|
value: "resource"
|
127
|
-
}, "\u5173\u8054\u8D44\u6E90"), /*#__PURE__*/React.createElement(Option, {
|
128
|
-
value: "ip"
|
129
|
-
}, "\u5173\u8054IP"), RelateTopoTree && /*#__PURE__*/React.createElement(Option, {
|
124
|
+
}, "\u5173\u8054\u8D44\u6E90"), RelateTopoTree && /*#__PURE__*/React.createElement(Option, {
|
130
125
|
value: "topo"
|
131
126
|
}, "\u5173\u8054\u62D3\u6251"))), bindType === "resource" && /*#__PURE__*/React.createElement(_Form.Item, {
|
132
127
|
label: "\u5173\u8054\u8D44\u6E90"
|
@@ -140,7 +135,7 @@ export default function Data(props) {
|
|
140
135
|
flex: 1,
|
141
136
|
paddingRight: 16,
|
142
137
|
color: "#4D6277",
|
143
|
-
lineHeight:
|
138
|
+
lineHeight: '20px'
|
144
139
|
},
|
145
140
|
title: values.tag ? values.name : null
|
146
141
|
}, values.tag ? values.name : "—"), /*#__PURE__*/React.createElement(NodeRelateResourceButton, {
|
@@ -149,27 +144,13 @@ export default function Data(props) {
|
|
149
144
|
topo: topo,
|
150
145
|
topoEditApi: topoEditApi,
|
151
146
|
nodeBindResourceDrawerComponent: editorProps.nodeBindResourceDrawerComponent
|
152
|
-
}))), bindType === "
|
153
|
-
label: "\u5173\u8054IP" // style={{ display: "flex" }}
|
154
|
-
,
|
155
|
-
pattern: /^((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)))$/,
|
156
|
-
patternTrigger: "onBlur",
|
157
|
-
patternMessage: "IP\u5730\u5740\u683C\u5F0F\u4E0D\u6B63\u786E"
|
158
|
-
}, /*#__PURE__*/React.createElement(BindIpInput, {
|
159
|
-
nodeElement: node,
|
160
|
-
node: values,
|
161
|
-
topo: topo,
|
162
|
-
topoEditApi: topoEditApi,
|
163
|
-
placeholder: "\u8BF7\u8F93\u5165",
|
164
|
-
name: "attrObject.ipv4",
|
165
|
-
maxLength: 128
|
166
|
-
})), bindType === "topo" && RelateTopoTree && /*#__PURE__*/React.createElement(_Form.Item, {
|
147
|
+
}))), bindType === "topo" && RelateTopoTree && /*#__PURE__*/React.createElement(_Form.Item, {
|
167
148
|
label: "\u5173\u8054\u62D3\u6251"
|
168
149
|
}, /*#__PURE__*/React.createElement(RelateTopoTree, {
|
169
150
|
name: "attrObject.bindTopo",
|
170
151
|
topo: topo,
|
171
152
|
onChange: handleBindTopoChange
|
172
|
-
})), (editorProps === null || editorProps === void 0 ? void 0 : editorProps.topoType) ===
|
153
|
+
})), (editorProps === null || editorProps === void 0 ? void 0 : editorProps.topoType) === 'cmpTopo' && node.getTag() && /*#__PURE__*/React.createElement(_Form.Item, {
|
173
154
|
label: "\u6240\u5C5E\u5E73\u53F0"
|
174
155
|
}, /*#__PURE__*/React.createElement(PlatformDisplay, props)))));
|
175
156
|
}
|
@@ -8,13 +8,12 @@ import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
8
8
|
import { TopoEvent } from "@riil-frontend/component-topology-graph";
|
9
9
|
import { TPL_BLANK, TPL_TREE } from "../../utils/template";
|
10
10
|
import topoPermissonUtil from "../../utils/topoPermissionUtil";
|
11
|
-
import { getElements, getGroupElementByTag, isEdge, isExistedElement, isGroup, isLayer, isNode
|
11
|
+
import { getElements, getGroupElementByTag, isEdge, isExistedElement, isGroup, isLayer, isNode } from "../../utils/htElementUtils";
|
12
12
|
import useResourceConfig from "./useResourceConfig";
|
13
13
|
import useGroupAddResource from "./useGroupAddResource";
|
14
14
|
import { findGroupChildren } from "../../utils/topoData";
|
15
15
|
import { getGroupChildrenResourceElements } from "../../utils/htElementDataUtil";
|
16
16
|
import { isClusterHtElement, isClusterMemberHtElement } from "../../utils/clusterUtil";
|
17
|
-
import { mergeExportLinkData } from "../models/utils/linkUtils";
|
18
17
|
|
19
18
|
var useTopoEdit = function useTopoEdit(params) {
|
20
19
|
var topo = params.topo,
|
@@ -316,7 +315,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
316
315
|
|
317
316
|
edges.map(function (edge) {
|
318
317
|
if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
|
319
|
-
// exLink.push(edge);
|
318
|
+
// exLink.push(edge);
|
320
319
|
topo.getGraphView().dm().remove(edge);
|
321
320
|
exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
|
322
321
|
}
|
@@ -379,8 +378,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
379
378
|
};
|
380
379
|
/**
|
381
380
|
* 获得未存在的连线元素
|
382
|
-
* @param {*} elements
|
383
|
-
* @returns
|
381
|
+
* @param {*} elements
|
382
|
+
* @returns
|
384
383
|
*/
|
385
384
|
|
386
385
|
|
@@ -393,8 +392,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
393
392
|
}
|
394
393
|
/**
|
395
394
|
* 获得未存在的元素
|
396
|
-
* @param {Array} elements
|
397
|
-
* @returns
|
395
|
+
* @param {Array} elements
|
396
|
+
* @returns
|
398
397
|
*/
|
399
398
|
|
400
399
|
|
@@ -570,7 +569,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
570
569
|
elements = _yield$editDispatcher4.elements;
|
571
570
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
572
571
|
newElements = findUNExistedElements(elements);
|
573
|
-
rlog.debug(
|
572
|
+
rlog.debug('添加分层资源', {
|
574
573
|
layer: group,
|
575
574
|
newElements: newElements
|
576
575
|
});
|
@@ -643,8 +642,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
643
642
|
}
|
644
643
|
/**
|
645
644
|
* 未选中元素添加资源
|
646
|
-
*
|
647
|
-
* @param {*} data
|
645
|
+
*
|
646
|
+
* @param {*} data
|
648
647
|
*/
|
649
648
|
|
650
649
|
|
@@ -801,7 +800,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
801
800
|
newLinkElements = findUNExistedLinkElements(elements);
|
802
801
|
createElementsData = null;
|
803
802
|
|
804
|
-
if (newData.type ===
|
803
|
+
if (newData.type === 'group') {
|
805
804
|
groupChildren = findGroupChildren(elements, newData);
|
806
805
|
newGroupChildren = [];
|
807
806
|
existedGroupChildren = [];
|
@@ -818,10 +817,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
818
817
|
groups: [newData],
|
819
818
|
nodes: newGroupChildren,
|
820
819
|
links: newLinkElements.filter(function (item) {
|
821
|
-
return item.type ===
|
820
|
+
return item.type === 'link';
|
822
821
|
}),
|
823
822
|
linkGroups: newLinkElements.filter(function (item) {
|
824
|
-
return item.type ===
|
823
|
+
return item.type === 'linkGroup';
|
825
824
|
})
|
826
825
|
};
|
827
826
|
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
@@ -836,16 +835,16 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
836
835
|
groups: [],
|
837
836
|
nodes: [newData],
|
838
837
|
links: newLinkElements.filter(function (item) {
|
839
|
-
return item.type ===
|
838
|
+
return item.type === 'link';
|
840
839
|
}),
|
841
840
|
linkGroups: newLinkElements.filter(function (item) {
|
842
|
-
return item.type ===
|
841
|
+
return item.type === 'linkGroup';
|
843
842
|
})
|
844
843
|
};
|
845
844
|
htTopo.createElements(createElementsData);
|
846
845
|
}
|
847
846
|
|
848
|
-
rlog.debug(
|
847
|
+
rlog.debug('批量创建元素', createElementsData); // 恢复图标、大小、位置
|
849
848
|
|
850
849
|
newElement = dm.getDataByTag(newData.id);
|
851
850
|
|
@@ -961,117 +960,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
961
960
|
return _ref8.apply(this, arguments);
|
962
961
|
};
|
963
962
|
}();
|
964
|
-
/**
|
965
|
-
* 关联IP的图片节点
|
966
|
-
*/
|
967
|
-
|
968
|
-
|
969
|
-
function relateNodeIp(_x15, _x16) {
|
970
|
-
return _relateNodeIp.apply(this, arguments);
|
971
|
-
}
|
972
|
-
|
973
|
-
function _relateNodeIp() {
|
974
|
-
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(txtValue, nodeElement) {
|
975
|
-
var dm, htTopo, elements, _yield$editDispatcher5, elementDatas, isUnique, ipTxt, ids, ip, re, config, linksData, createElementsData;
|
976
|
-
|
977
|
-
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
978
|
-
while (1) {
|
979
|
-
switch (_context16.prev = _context16.next) {
|
980
|
-
case 0:
|
981
|
-
// console.log("bindIPtoNode", data);
|
982
|
-
// 根据配置查询拓扑数据
|
983
|
-
dm = topo.getDataModel();
|
984
|
-
htTopo = topo.getHtTopo();
|
985
|
-
elements = getNodes(dm);
|
986
|
-
_context16.next = 5;
|
987
|
-
return editDispatchers.fetchDataByConfig();
|
988
|
-
|
989
|
-
case 5:
|
990
|
-
_yield$editDispatcher5 = _context16.sent;
|
991
|
-
elementDatas = _yield$editDispatcher5.elementDatas;
|
992
|
-
console.log("bindIPtoNode", txtValue, nodeElement, elements);
|
993
|
-
console.log("elementDatas", elementDatas);
|
994
|
-
isUnique = true;
|
995
|
-
ipTxt = txtValue;
|
996
|
-
ids = []; // 执行唯一性验证
|
997
|
-
|
998
|
-
elements.map(function (element) {
|
999
|
-
// if (node.getId() !== element.getId()) {
|
1000
|
-
// }
|
1001
|
-
if (element.getTag()) {
|
1002
|
-
ids.push(element.getTag());
|
1003
|
-
}
|
1004
|
-
});
|
1005
|
-
ip = {
|
1006
|
-
id: "ip_1.1.1.1",
|
1007
|
-
name: "1.1.1.1",
|
1008
|
-
customName: null,
|
1009
|
-
// 'groupId': null,
|
1010
|
-
// 'groupTag': null,
|
1011
|
-
ipAddress: "1.1.1.1",
|
1012
|
-
// 'attributes': [],
|
1013
|
-
// 'metrics': [],
|
1014
|
-
type: "node" // 'dtype': 'device'
|
1015
|
-
|
1016
|
-
}; // 获取关联链路
|
1017
|
-
|
1018
|
-
if (!isUnique) {
|
1019
|
-
_context16.next = 27;
|
1020
|
-
break;
|
1021
|
-
}
|
1022
|
-
|
1023
|
-
nodeElement.a(ip);
|
1024
|
-
nodeElement.setName(txtValue);
|
1025
|
-
nodeElement.a("name", txtValue);
|
1026
|
-
nodeElement.a("customName", null);
|
1027
|
-
nodeElement.setTag("ip_" + txtValue);
|
1028
|
-
_context16.next = 22;
|
1029
|
-
return editDispatchers.queryAllLinkByIp({
|
1030
|
-
ids: ids,
|
1031
|
-
ip: txtValue
|
1032
|
-
});
|
1033
|
-
|
1034
|
-
case 22:
|
1035
|
-
re = _context16.sent;
|
1036
|
-
console.log("queryAllLinkByIp", re);
|
1037
|
-
config = resourceConfig.getConfig();
|
1038
|
-
console.log("resourceConfig.getConfig", config);
|
1039
|
-
|
1040
|
-
if (re && re.length > 0) {
|
1041
|
-
linksData = [];
|
1042
|
-
re.map(function (link) {
|
1043
|
-
var sourceId = link.attributes["network_link.source_device_id"];
|
1044
|
-
var source = dm.getDataByTag(sourceId);
|
1045
|
-
var target = nodeElement; // console.log("source, nodeElement, link", source, target, link);
|
1046
|
-
|
1047
|
-
if (source && target) {
|
1048
|
-
var linkData = mergeExportLinkData({
|
1049
|
-
source: source,
|
1050
|
-
target: target,
|
1051
|
-
link: link
|
1052
|
-
});
|
1053
|
-
console.log("linkData", linkData);
|
1054
|
-
linksData.push(linkData); // htTopo.createEdge(source, target, link);
|
1055
|
-
}
|
1056
|
-
});
|
1057
|
-
createElementsData = {
|
1058
|
-
groups: [],
|
1059
|
-
nodes: [],
|
1060
|
-
links: [].concat(linksData),
|
1061
|
-
linkGroups: []
|
1062
|
-
};
|
1063
|
-
htTopo.createElements(createElementsData); // htTopo.addElements({ lines: [...re] });
|
1064
|
-
}
|
1065
|
-
|
1066
|
-
case 27:
|
1067
|
-
case "end":
|
1068
|
-
return _context16.stop();
|
1069
|
-
}
|
1070
|
-
}
|
1071
|
-
}, _callee16);
|
1072
|
-
}));
|
1073
|
-
return _relateNodeIp.apply(this, arguments);
|
1074
|
-
}
|
1075
963
|
|
1076
964
|
var onEvent = function onEvent(e) {
|
1077
965
|
var map = {};
|
@@ -1089,7 +977,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1089
977
|
*/
|
1090
978
|
|
1091
979
|
var setViewMouseMode = function setViewMouseMode(mode) {
|
1092
|
-
rlog.debug(
|
980
|
+
rlog.debug('设置视图鼠标模式', mode);
|
1093
981
|
topo.getHtTopo().setViewMouseMode(mode);
|
1094
982
|
topoEditDispatchers.update({
|
1095
983
|
viewMouseMode: mode
|
@@ -1167,11 +1055,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1167
1055
|
*/
|
1168
1056
|
onDeleteElement: onDeleteElement,
|
1169
1057
|
|
1170
|
-
/**
|
1171
|
-
* 绑定图片ip
|
1172
|
-
*/
|
1173
|
-
relateNodeIp: relateNodeIp,
|
1174
|
-
|
1175
1058
|
/**
|
1176
1059
|
* 拓扑图保存回调
|
1177
1060
|
*/
|
@@ -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.16" === 'string' ? "9.0.0-a.16" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -188,22 +188,4 @@ export var showLinkByConfig = function showLinkByConfig(props) {
|
|
188
188
|
}
|
189
189
|
});
|
190
190
|
}
|
191
|
-
};
|
192
|
-
export var mergeExportLinkData = function mergeExportLinkData(props) {
|
193
|
-
var source = props.source,
|
194
|
-
target = props.target,
|
195
|
-
link = props.link;
|
196
|
-
var attrObj = link.attributes;
|
197
|
-
|
198
|
-
var linkData = _extends({}, link, {
|
199
|
-
name: attrObj.name,
|
200
|
-
source: attrObj["network_link.source_device_id"],
|
201
|
-
target: attrObj.destination_type === 'ip' ? target.getTag() : attrObj["network_link.destination_device_id"],
|
202
|
-
operation: attrObj.operation,
|
203
|
-
interfaceSource: attrObj["source_id"],
|
204
|
-
interfaceTarget: attrObj["destination_id"],
|
205
|
-
ciType: link.typeCode
|
206
|
-
});
|
207
|
-
|
208
|
-
return linkData;
|
209
191
|
};
|
@@ -13,7 +13,6 @@ import { removeFromArray } from "../../../utils/format";
|
|
13
13
|
import { DEFAULT_GROUP } from "../../../utils/template";
|
14
14
|
import { combTopoData, getCiTypes } from "../../../utils/topoData";
|
15
15
|
import { saveTopo as _saveTopo, resToConditions, getLayoutId } from "../../../core/models/topoData";
|
16
|
-
import networkLinkServer from "../../../networkTopo/services/topo/networkLink";
|
17
16
|
import { addLinkData, buildData as buildTopoData } from "../../../networkTopo/getTopoData";
|
18
17
|
|
19
18
|
var newGroupWithUUID = function newGroupWithUUID(group) {
|
@@ -245,20 +244,19 @@ export default function (topoApp) {
|
|
245
244
|
var _this2 = this;
|
246
245
|
|
247
246
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
248
|
-
var editState, resources, _editState$groups, groups, _editState$exportLink, exportLinkIdList,
|
247
|
+
var editState, resources, _editState$groups, groups, _editState$exportLink, exportLinkIdList, query, data;
|
249
248
|
|
250
249
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
251
250
|
while (1) {
|
252
251
|
switch (_context2.prev = _context2.next) {
|
253
252
|
case 0:
|
254
253
|
editState = rootState.topoConfig;
|
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
|
254
|
+
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;
|
256
255
|
query = {
|
257
256
|
id: rootState.topoMod.topoId,
|
258
257
|
resources: resources,
|
259
258
|
groups: groups,
|
260
|
-
exportLinkIdList: exportLinkIdList
|
261
|
-
ipNodes: ipNodes
|
259
|
+
exportLinkIdList: exportLinkIdList
|
262
260
|
};
|
263
261
|
_context2.next = 5;
|
264
262
|
return _this2.getTopoByConditions(query);
|
@@ -310,14 +308,14 @@ export default function (topoApp) {
|
|
310
308
|
var _this4 = this;
|
311
309
|
|
312
310
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
313
|
-
var topoId, resources, groups, exportLinkIdList,
|
311
|
+
var topoId, resources, groups, exportLinkIdList, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
|
314
312
|
|
315
313
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
316
314
|
while (1) {
|
317
315
|
switch (_context4.prev = _context4.next) {
|
318
316
|
case 0:
|
319
317
|
// rlog.debug("getTopoByConditions--------", params);
|
320
|
-
topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList
|
318
|
+
topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList;
|
321
319
|
viewConditions = resToConditions(resources);
|
322
320
|
groupInfo = isAvailableArray(groups) && groups.map(function (group) {
|
323
321
|
return _extends({}, group, {
|
@@ -327,7 +325,7 @@ export default function (topoApp) {
|
|
327
325
|
}); // rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
|
328
326
|
|
329
327
|
_context4.next = 5;
|
330
|
-
return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList
|
328
|
+
return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList);
|
331
329
|
|
332
330
|
case 5:
|
333
331
|
data = _context4.sent;
|
@@ -395,7 +393,7 @@ export default function (topoApp) {
|
|
395
393
|
}].concat(displayConfig.saveHistories || [])
|
396
394
|
}))
|
397
395
|
};
|
398
|
-
rlog.debug(
|
396
|
+
rlog.debug('saveGlobalConfig', config);
|
399
397
|
_context5.next = 5;
|
400
398
|
return topoApp.serverApi.saveTopoSettings(topoApp.id, config);
|
401
399
|
|
@@ -463,33 +461,6 @@ export default function (topoApp) {
|
|
463
461
|
switchToViewMode: function switchToViewMode() {
|
464
462
|
this.reset();
|
465
463
|
dispatch.topoMod.switchToViewMode();
|
466
|
-
},
|
467
|
-
queryAllLinkByIp: function queryAllLinkByIp(data) {
|
468
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
469
|
-
var _result$data;
|
470
|
-
|
471
|
-
var ids, ip, result;
|
472
|
-
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
473
|
-
while (1) {
|
474
|
-
switch (_context8.prev = _context8.next) {
|
475
|
-
case 0:
|
476
|
-
ids = data.ids, ip = data.ip;
|
477
|
-
console.log("queryAllLinkByIp", ids, ip);
|
478
|
-
_context8.next = 4;
|
479
|
-
return networkLinkServer.queryLinksByIp(ids, ip);
|
480
|
-
|
481
|
-
case 4:
|
482
|
-
result = _context8.sent;
|
483
|
-
console.log("queryAllLinkByIp-result", result);
|
484
|
-
return _context8.abrupt("return", (_result$data = result === null || result === void 0 ? void 0 : result.data) !== null && _result$data !== void 0 ? _result$data : []);
|
485
|
-
|
486
|
-
case 7:
|
487
|
-
case "end":
|
488
|
-
return _context8.stop();
|
489
|
-
}
|
490
|
-
}
|
491
|
-
}, _callee8);
|
492
|
-
}))();
|
493
464
|
}
|
494
465
|
};
|
495
466
|
}
|
@@ -320,7 +320,7 @@ function _queryRetansRatioNetDelayRatio() {
|
|
320
320
|
'code': 'netDelayRatio',
|
321
321
|
'name': '下行RTT时延',
|
322
322
|
'ts': result.time,
|
323
|
-
'value': (result.upNetDelayRatio * 1).toFixed() + ' ms' + '|' + (result.downNetDelayRatio * 1).toFixed() + ' ms'
|
323
|
+
'value': (result.upNetDelayRatio * 1).toFixed(2) + ' ms' + '|' + (result.downNetDelayRatio * 1).toFixed(2) + ' ms'
|
324
324
|
});
|
325
325
|
}
|
326
326
|
|
@@ -329,7 +329,7 @@ function _queryRetansRatioNetDelayRatio() {
|
|
329
329
|
'code': 'retansRatio',
|
330
330
|
'name': '重传率',
|
331
331
|
'ts': result.time,
|
332
|
-
'value':
|
332
|
+
'value': result.upRetransRatio + ' %' + '|' + result.downRetansRatio + ' %'
|
333
333
|
});
|
334
334
|
}
|
335
335
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
3
|
-
import { request } from
|
3
|
+
import { request } from '@riil-frontend/component-topology-utils';
|
4
4
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
5
5
|
export default {
|
6
6
|
/**
|
@@ -9,7 +9,6 @@ import blackList from "./blacklist";
|
|
9
9
|
import { TOPO_API_ROOT } from "./constants";
|
10
10
|
import { commonQuery } from "../cmdb";
|
11
11
|
import { getBatchCi as _getBatchCi, getBatchCiMetric as _getBatchCiMetric } from "../model";
|
12
|
-
import { processExitLink } from "../../utils/exitLinkUtil";
|
13
12
|
var API_ROOT = TOPO_API_ROOT;
|
14
13
|
/**
|
15
14
|
* 拓扑图(看做一个容器)的“父容器”ID
|
@@ -414,13 +413,13 @@ export default _extends({
|
|
414
413
|
|
415
414
|
case 3:
|
416
415
|
result = _context12.sent;
|
417
|
-
return _context12.abrupt("return",
|
416
|
+
return _context12.abrupt("return", _extends({}, result, {
|
418
417
|
links: ((_result$links = result.links) !== null && _result$links !== void 0 ? _result$links : []).map(function (item) {
|
419
418
|
return _extends({}, item, {
|
420
419
|
ciType: 'network_link'
|
421
420
|
});
|
422
421
|
})
|
423
|
-
}))
|
422
|
+
}));
|
424
423
|
|
425
424
|
case 7:
|
426
425
|
_context12.prev = 7;
|
@@ -444,7 +443,7 @@ export default _extends({
|
|
444
443
|
* @param {Array} groups
|
445
444
|
* @returns
|
446
445
|
*/
|
447
|
-
getTopoDataByResource: function getTopoDataByResource(id, resources, groups, exportLinkIdList
|
446
|
+
getTopoDataByResource: function getTopoDataByResource(id, resources, groups, exportLinkIdList) {
|
448
447
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
449
448
|
var _result$links2;
|
450
449
|
|
@@ -6,9 +6,9 @@ var API_ROOT = TOPO_API_ROOT;
|
|
6
6
|
export default {
|
7
7
|
/**
|
8
8
|
* 批量查询ci类型是否可创建链路
|
9
|
-
*
|
10
|
-
* @param {*} typeCodes
|
11
|
-
* @returns
|
9
|
+
*
|
10
|
+
* @param {*} typeCodes
|
11
|
+
* @returns
|
12
12
|
*/
|
13
13
|
getCiTypesConnectable: function getCiTypesConnectable(typeCodes) {
|
14
14
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
@@ -29,47 +29,5 @@ export default {
|
|
29
29
|
}
|
30
30
|
}, _callee);
|
31
31
|
}))();
|
32
|
-
},
|
33
|
-
|
34
|
-
/**
|
35
|
-
* 通过ip查询关联链路
|
36
|
-
*
|
37
|
-
* @param {array} ciIds
|
38
|
-
*/
|
39
|
-
queryLinksByIp: function queryLinksByIp(ids, ip) {
|
40
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
41
|
-
var stag, condition, parm, result;
|
42
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
43
|
-
while (1) {
|
44
|
-
switch (_context2.prev = _context2.next) {
|
45
|
-
case 0:
|
46
|
-
stag = "'" + ids.join("','") + "'";
|
47
|
-
condition = "type('network_link') && network_link.destination_ipv4 = '" + ip + "' && network_link.source_device_id in [" + stag + "]";
|
48
|
-
parm = {
|
49
|
-
condition: condition,
|
50
|
-
sort: "name asc",
|
51
|
-
currentPage: 1,
|
52
|
-
pageSize: 999
|
53
|
-
};
|
54
|
-
_context2.prev = 3;
|
55
|
-
_context2.next = 6;
|
56
|
-
return request.post("/mdc/v1/api/cmdb/commonQueryCiData", parm);
|
57
|
-
|
58
|
-
case 6:
|
59
|
-
result = _context2.sent;
|
60
|
-
return _context2.abrupt("return", result);
|
61
|
-
|
62
|
-
case 10:
|
63
|
-
_context2.prev = 10;
|
64
|
-
_context2.t0 = _context2["catch"](3);
|
65
|
-
rlog.error("通过ip查询关联链路", _context2.t0);
|
66
|
-
|
67
|
-
case 13:
|
68
|
-
case "end":
|
69
|
-
return _context2.stop();
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}, _callee2, null, [[3, 10]]);
|
73
|
-
}))();
|
74
32
|
}
|
75
33
|
};
|