@riil-frontend/component-topology 3.5.0-a.9 → 3.5.2
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 +12 -12
- package/es/components/index.module.scss +3 -114
- package/es/core/components/AlarmListPanel/index.js +7 -12
- package/es/core/components/DisplaySettingDrawer/DisplaySetting.js +8 -5
- package/es/core/components/DisplaySettingDrawer/NodeTag.js +10 -5
- package/es/core/components/DisplaySettingDrawer/NodeTip.js +10 -5
- package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +3 -21
- package/es/core/components/TopoView/topoView.js +1 -0
- package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -140
- package/es/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +1 -1
- package/es/core/editor/components/settings/propertyViews/node/Setting/Setting.js +1 -1
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +18 -17
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +62 -18
- package/es/core/models/Alarm.js +206 -120
- package/es/core/models/DataModel.js +15 -1
- package/es/core/models/TopoApp.js +4 -6
- package/es/core/models/cache/CiTyeCache.js +4 -0
- package/es/core/models/utils/linkUtils.js +87 -42
- package/es/core/services/index.js +28 -0
- package/es/core/utils/saveSerialize.js +34 -0
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +0 -37
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +31 -28
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +44 -43
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +39 -26
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useCiData.js +0 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +143 -0
- package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +37 -0
- package/es/core/viewer/components/titlebar/BasicTools.js +11 -1
- package/es/core/viewer/components/titlebar/widgets/AlarmListShowButton.js +21 -13
- package/es/hooks/useGraphAlarmDisplay.js +3 -4
- package/es/hooks/useManageStatus.js +1 -1
- package/es/hooks/useTopoEdit.js +200 -144
- package/es/hooks/useTopoEventListener.js +13 -6
- package/es/index.js +3 -2
- package/es/models/topoConfig.js +0 -1
- package/es/models/topoMod.js +15 -10
- package/es/topoCenter/components/Topo404.js +3 -1
- package/es/topoCenter/components/TopoNoPermission.js +3 -1
- package/es/topoCenter/components/TopoView.js +77 -32
- package/es/topoCenter/components/Topology.js +2 -0
- package/es/topoCenter/components/editor/propertyViews/edge/EdgePropertyView.js +10 -0
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +5 -20
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +12 -6
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +84 -43
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +60 -34
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +9 -0
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/server.js +62 -19
- package/es/topoCenter/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +157 -0
- package/es/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +1 -2
- package/es/topoCenter/hooks/editor/useDeleteEdges.js +2 -3
- package/es/topoCenter/utils/resourcePermissionUtil.js +18 -12
- package/es/utils/topoData.js +15 -13
- package/lib/components/index.module.scss +3 -114
- package/lib/core/components/AlarmListPanel/index.js +7 -12
- package/lib/core/components/DisplaySettingDrawer/DisplaySetting.js +9 -5
- package/lib/core/components/DisplaySettingDrawer/NodeTag.js +11 -5
- package/lib/core/components/DisplaySettingDrawer/NodeTip.js +12 -5
- package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +3 -21
- package/lib/core/components/TopoView/topoView.js +1 -0
- package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -151
- package/lib/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +2 -2
- package/lib/core/editor/components/settings/propertyViews/node/Setting/Setting.js +1 -1
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +17 -16
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +66 -20
- package/lib/core/models/Alarm.js +206 -121
- package/lib/core/models/DataModel.js +15 -1
- package/lib/core/models/TopoApp.js +4 -6
- package/lib/core/models/cache/CiTyeCache.js +4 -0
- package/lib/core/models/utils/linkUtils.js +92 -43
- package/lib/core/services/index.js +29 -0
- package/lib/core/utils/saveSerialize.js +43 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +0 -37
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +29 -26
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +45 -43
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +38 -24
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useCiData.js +1 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +155 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +47 -0
- package/lib/core/viewer/components/titlebar/BasicTools.js +11 -1
- package/lib/core/viewer/components/titlebar/widgets/AlarmListShowButton.js +22 -15
- package/lib/hooks/useGraphAlarmDisplay.js +3 -5
- package/lib/hooks/useManageStatus.js +1 -1
- package/lib/hooks/useTopoEdit.js +197 -141
- package/lib/hooks/useTopoEventListener.js +13 -6
- package/lib/index.js +5 -0
- package/lib/models/topoConfig.js +0 -1
- package/lib/models/topoMod.js +15 -10
- package/lib/topoCenter/components/Topo404.js +4 -1
- package/lib/topoCenter/components/TopoNoPermission.js +4 -1
- package/lib/topoCenter/components/TopoView.js +78 -33
- package/lib/topoCenter/components/Topology.js +3 -0
- package/lib/topoCenter/components/editor/propertyViews/edge/EdgePropertyView.js +22 -0
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +5 -21
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +13 -8
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +87 -42
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +61 -37
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +9 -0
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/server.js +62 -18
- package/lib/topoCenter/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +183 -0
- package/lib/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +1 -2
- package/lib/topoCenter/hooks/editor/useDeleteEdges.js +2 -3
- package/lib/topoCenter/utils/resourcePermissionUtil.js +20 -12
- package/lib/utils/topoData.js +15 -13
- package/package.json +5 -5
|
@@ -6,15 +6,15 @@ import _Collapse from "@alifd/next/es/collapse";
|
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
7
|
import React, { useState, useEffect, useRef } from "react";
|
|
8
8
|
import topoService from "@riil-frontend/component-topology-common/es/services/topo";
|
|
9
|
-
import { RESOURCE_LIMIT_TYPES } from "../../../../../../constants/ResourceTypeLimit";
|
|
10
|
-
|
|
11
|
-
import { useBoolean } from "ahooks";
|
|
9
|
+
import { RESOURCE_LIMIT_TYPES } from "../../../../../../constants/ResourceTypeLimit";
|
|
10
|
+
import _ from "lodash";
|
|
12
11
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
13
12
|
import TopoCenterEvent from "../../../../../event";
|
|
14
13
|
import EditLinkInfo from "./components/editLinkInfo";
|
|
15
14
|
import styles from "./index.module.scss";
|
|
16
15
|
import service from "./server";
|
|
17
16
|
import { clone } from "../../../../../../utils/copyUtil";
|
|
17
|
+
import { getInterfaceObject } from "../../../../../../core/models/utils/linkUtils";
|
|
18
18
|
import { getEdgesBetweenNodes, getNodes } from "../../../../../../utils/htElementUtils";
|
|
19
19
|
var CollapsePanel = _Collapse.Panel;
|
|
20
20
|
|
|
@@ -52,18 +52,22 @@ function AddLinkDrawer(props) {
|
|
|
52
52
|
|
|
53
53
|
var _useState4 = useState(),
|
|
54
54
|
sourceIFDoc = _useState4[0],
|
|
55
|
-
setSourceIFDoc = _useState4[1];
|
|
55
|
+
setSourceIFDoc = _useState4[1];
|
|
56
|
+
|
|
57
|
+
var _useState5 = useState(),
|
|
58
|
+
targetIFDoc = _useState5[0],
|
|
59
|
+
setTargetIFDoc = _useState5[1]; // 保存后更新拓扑图状态
|
|
56
60
|
|
|
57
61
|
|
|
58
|
-
var
|
|
59
|
-
ciIdsConnectable =
|
|
60
|
-
setCiIdsConnectable =
|
|
62
|
+
var _useState6 = useState([]),
|
|
63
|
+
ciIdsConnectable = _useState6[0],
|
|
64
|
+
setCiIdsConnectable = _useState6[1];
|
|
61
65
|
|
|
62
66
|
var linkNodesRef = useRef();
|
|
63
67
|
|
|
64
68
|
var getPortsById = /*#__PURE__*/function () {
|
|
65
69
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
|
|
66
|
-
var result, portsDoc, ports;
|
|
70
|
+
var result, links, ifTypes, ifDoc, usedPorts, portsDoc, ports;
|
|
67
71
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
68
72
|
while (1) {
|
|
69
73
|
switch (_context.prev = _context.next) {
|
|
@@ -73,14 +77,39 @@ function AddLinkDrawer(props) {
|
|
|
73
77
|
|
|
74
78
|
case 2:
|
|
75
79
|
result = _context.sent;
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
_context.next = 5;
|
|
81
|
+
return service.queryLinksByNodeId(id);
|
|
82
|
+
|
|
83
|
+
case 5:
|
|
84
|
+
links = _context.sent;
|
|
85
|
+
ifTypes = result.map(function (item) {
|
|
86
|
+
return item.type;
|
|
87
|
+
});
|
|
88
|
+
console.log("端口类型列表", ifTypes);
|
|
89
|
+
_context.next = 10;
|
|
90
|
+
return getInterfaceObject(ifTypes);
|
|
91
|
+
|
|
92
|
+
case 10:
|
|
93
|
+
ifDoc = _context.sent;
|
|
94
|
+
console.log("端口类型字典", ifDoc);
|
|
95
|
+
usedPorts = [];
|
|
96
|
+
links.data.map(function (link) {
|
|
97
|
+
usedPorts.push(link.attributes.destination_id);
|
|
98
|
+
usedPorts.push(link.attributes.source_id);
|
|
99
|
+
});
|
|
100
|
+
usedPorts = _.uniq(usedPorts);
|
|
101
|
+
rlog.debug("端口列表", result, links); //const list = result[id];
|
|
102
|
+
|
|
78
103
|
portsDoc = {};
|
|
79
104
|
ports = result.map(function (item) {
|
|
105
|
+
var _ifDoc$item$type$disp, _ifDoc$item$type;
|
|
106
|
+
|
|
80
107
|
var obj = {
|
|
81
108
|
value: item.id,
|
|
82
109
|
label: item.name,
|
|
83
110
|
type: item.type,
|
|
111
|
+
typeName: (_ifDoc$item$type$disp = (_ifDoc$item$type = ifDoc[item.type]) === null || _ifDoc$item$type === void 0 ? void 0 : _ifDoc$item$type.displayName) !== null && _ifDoc$item$type$disp !== void 0 ? _ifDoc$item$type$disp : "",
|
|
112
|
+
disabled: usedPorts.indexOf(item.id) >= 0,
|
|
84
113
|
ratedBandwidth: parseInt(item.ratedBandwidth, 10)
|
|
85
114
|
};
|
|
86
115
|
portsDoc[item.id] = obj;
|
|
@@ -91,7 +120,7 @@ function AddLinkDrawer(props) {
|
|
|
91
120
|
portsDoc: portsDoc
|
|
92
121
|
});
|
|
93
122
|
|
|
94
|
-
case
|
|
123
|
+
case 19:
|
|
95
124
|
case "end":
|
|
96
125
|
return _context.stop();
|
|
97
126
|
}
|
|
@@ -112,28 +141,30 @@ function AddLinkDrawer(props) {
|
|
|
112
141
|
switch (_context2.prev = _context2.next) {
|
|
113
142
|
case 0:
|
|
114
143
|
linkNodesRef.current = e; // const { type, data } = e;
|
|
115
|
-
// rlog.debug("接到打开创建链路抽屉信息", e);
|
|
116
144
|
|
|
145
|
+
rlog.debug("接到打开创建链路抽屉信息", e);
|
|
117
146
|
setIsAddMode(true); // setTrue();
|
|
118
147
|
|
|
119
|
-
_context2.prev =
|
|
120
|
-
_context2.next =
|
|
148
|
+
_context2.prev = 3;
|
|
149
|
+
_context2.next = 6;
|
|
121
150
|
return getPortsById(e.source._attrObject.id);
|
|
122
151
|
|
|
123
|
-
case
|
|
152
|
+
case 6:
|
|
124
153
|
sourcePorts = _context2.sent;
|
|
125
|
-
_context2.next =
|
|
154
|
+
_context2.next = 9;
|
|
126
155
|
return getPortsById(e.target._attrObject.id);
|
|
127
156
|
|
|
128
|
-
case
|
|
157
|
+
case 9:
|
|
129
158
|
targetPorts = _context2.sent;
|
|
159
|
+
setSourceIFDoc(sourcePorts.portsDoc);
|
|
160
|
+
setTargetIFDoc(targetPorts.portsDoc);
|
|
130
161
|
source = translationNode(e.source, sourcePorts);
|
|
131
162
|
target = translationNode(e.target, targetPorts);
|
|
132
163
|
editDispatchers.update({
|
|
133
164
|
addLinkIsOpen: true,
|
|
134
165
|
currentLink: null
|
|
135
166
|
});
|
|
136
|
-
connect_type = target.ciType !== "customNode" && target.ipAddress ? "phy" : "exit";
|
|
167
|
+
connect_type = target.ciType !== "customNode" && target.ipAddress && targetPorts.ports.length > 0 ? "phy" : "exit";
|
|
137
168
|
setLink({
|
|
138
169
|
source: source,
|
|
139
170
|
target: target,
|
|
@@ -152,20 +183,20 @@ function AddLinkDrawer(props) {
|
|
|
152
183
|
connect_type: connect_type
|
|
153
184
|
}
|
|
154
185
|
});
|
|
155
|
-
_context2.next =
|
|
186
|
+
_context2.next = 22;
|
|
156
187
|
break;
|
|
157
188
|
|
|
158
|
-
case
|
|
159
|
-
_context2.prev =
|
|
160
|
-
_context2.t0 = _context2["catch"](
|
|
189
|
+
case 19:
|
|
190
|
+
_context2.prev = 19;
|
|
191
|
+
_context2.t0 = _context2["catch"](3);
|
|
161
192
|
rlog.error("出现异常", _context2.t0);
|
|
162
193
|
|
|
163
|
-
case
|
|
194
|
+
case 22:
|
|
164
195
|
case "end":
|
|
165
196
|
return _context2.stop();
|
|
166
197
|
}
|
|
167
198
|
}
|
|
168
|
-
}, _callee2, null, [[
|
|
199
|
+
}, _callee2, null, [[3, 19]]);
|
|
169
200
|
}));
|
|
170
201
|
|
|
171
202
|
return function handleEvent(_x2) {
|
|
@@ -201,11 +232,13 @@ function AddLinkDrawer(props) {
|
|
|
201
232
|
case 6:
|
|
202
233
|
targetPorts = _context3.sent;
|
|
203
234
|
setSourceIFDoc(sourcePorts.portsDoc);
|
|
235
|
+
setTargetIFDoc(targetPorts.portsDoc);
|
|
204
236
|
connect_type = currentLink.attributes["network_link.connect_type"] === "exit" ? "exit" : "phy";
|
|
205
237
|
setLink({
|
|
206
238
|
source: {
|
|
207
239
|
id: currentLink.source,
|
|
208
240
|
name: currentLink.attributes["network_link.source_device_id_object"].displayName,
|
|
241
|
+
ciId: currentLink.attributes["network_link.source_device_id"],
|
|
209
242
|
ipAddress: currentLink.attributes["network_link.source_ipv4"],
|
|
210
243
|
ciName: (_currentLink$attribut = currentLink.attributes.source_type_object) === null || _currentLink$attribut === void 0 ? void 0 : _currentLink$attribut.displayName,
|
|
211
244
|
ciType: currentLink.attributes.source_type,
|
|
@@ -216,19 +249,21 @@ function AddLinkDrawer(props) {
|
|
|
216
249
|
target: {
|
|
217
250
|
id: currentLink.target,
|
|
218
251
|
name: currentLink.attributes["network_link.destination_device_id_object"].displayName,
|
|
252
|
+
ciId: currentLink.attributes["network_link.destination_device_id"],
|
|
219
253
|
ipAddress: currentLink.attributes["network_link.destination_ipv4"],
|
|
220
254
|
ciName: (_currentLink$attribut2 = currentLink.attributes.destination_type_object) === null || _currentLink$attribut2 === void 0 ? void 0 : _currentLink$attribut2.displayName,
|
|
221
|
-
ciType: currentLink.
|
|
255
|
+
ciType: currentLink.target !== "" ? currentLink.attributes.destination_type : "customNode",
|
|
222
256
|
interfaceTarget: currentLink.interfaceTarget,
|
|
223
257
|
ports: (_targetPorts$ports = targetPorts.ports) !== null && _targetPorts$ports !== void 0 ? _targetPorts$ports : [],
|
|
224
258
|
portsDoc: targetPorts.portsDoc
|
|
225
259
|
},
|
|
226
260
|
attributes: _extends({}, currentLink.attributes, {
|
|
261
|
+
linkId: currentLink.id,
|
|
227
262
|
connect_type: connect_type
|
|
228
263
|
})
|
|
229
264
|
});
|
|
230
265
|
|
|
231
|
-
case
|
|
266
|
+
case 11:
|
|
232
267
|
case "end":
|
|
233
268
|
return _context3.stop();
|
|
234
269
|
}
|
|
@@ -320,6 +355,7 @@ function AddLinkDrawer(props) {
|
|
|
320
355
|
return {
|
|
321
356
|
id: attrObject.id,
|
|
322
357
|
name: attrObject.name,
|
|
358
|
+
ciId: attrObject.id,
|
|
323
359
|
ipAddress: attrObject.ipAddress,
|
|
324
360
|
ciName: (_topo$ciTyeCache$getC = (_topo$ciTyeCache$getC2 = topo.ciTyeCache.getCiType(attrObject.ciType)) === null || _topo$ciTyeCache$getC2 === void 0 ? void 0 : _topo$ciTyeCache$getC2.displayName) !== null && _topo$ciTyeCache$getC !== void 0 ? _topo$ciTyeCache$getC : attrObject.customName,
|
|
325
361
|
ciType: (_attrObject$ciType = attrObject.ciType) !== null && _attrObject$ciType !== void 0 ? _attrObject$ciType : "customNode",
|
|
@@ -366,7 +402,7 @@ function AddLinkDrawer(props) {
|
|
|
366
402
|
var edge = htTopo.createEdge(source, target, linkData);
|
|
367
403
|
|
|
368
404
|
if (linkType === "exit" && target.getTag() === undefined) {
|
|
369
|
-
// rlog.debug("addLinkToGraph-
|
|
405
|
+
// rlog.debug("addLinkToGraph-export-target", target, target.getTag());
|
|
370
406
|
target.a("name", targetName);
|
|
371
407
|
}
|
|
372
408
|
}
|
|
@@ -377,8 +413,9 @@ function AddLinkDrawer(props) {
|
|
|
377
413
|
}
|
|
378
414
|
};
|
|
379
415
|
|
|
380
|
-
var
|
|
381
|
-
|
|
416
|
+
var mergeExportLinkData = function mergeExportLinkData(data, attributes) {
|
|
417
|
+
console.log("mergeExportLinkData", data, attributes);
|
|
418
|
+
return _extends({}, attributes, {
|
|
382
419
|
id: data.id,
|
|
383
420
|
name: data.name,
|
|
384
421
|
source: data["network_link.source_device_id"],
|
|
@@ -387,7 +424,7 @@ function AddLinkDrawer(props) {
|
|
|
387
424
|
interfaceSource: data["source_id"],
|
|
388
425
|
interfaceTarget: data["destination_id"],
|
|
389
426
|
ciType: data.ciType,
|
|
390
|
-
attributes: _extends({}, attributes, {
|
|
427
|
+
attributes: _extends({}, attributes.attributes, {
|
|
391
428
|
display_name: data.display_name,
|
|
392
429
|
name: data.name,
|
|
393
430
|
"network_link.actual_bandwidth": data["network_link.actual_bandwidth"],
|
|
@@ -399,9 +436,12 @@ function AddLinkDrawer(props) {
|
|
|
399
436
|
use: data.use,
|
|
400
437
|
source_id_object: {
|
|
401
438
|
displayName: sourceIFDoc[data.source_id].label
|
|
439
|
+
},
|
|
440
|
+
destination_id_object: {
|
|
441
|
+
displayName: targetIFDoc[data.destination_id].label
|
|
402
442
|
}
|
|
403
443
|
})
|
|
404
|
-
};
|
|
444
|
+
});
|
|
405
445
|
};
|
|
406
446
|
|
|
407
447
|
var onSave = /*#__PURE__*/function () {
|
|
@@ -447,14 +487,14 @@ function AddLinkDrawer(props) {
|
|
|
447
487
|
_context5.prev = 15;
|
|
448
488
|
|
|
449
489
|
if (!result) {
|
|
450
|
-
_context5.next =
|
|
490
|
+
_context5.next = 36;
|
|
451
491
|
break;
|
|
452
492
|
}
|
|
453
493
|
|
|
454
494
|
config = topo.resourceConfig.getConfigFromHt(); // 新建后显示到图上
|
|
455
495
|
|
|
456
496
|
if (!isAddMode) {
|
|
457
|
-
_context5.next =
|
|
497
|
+
_context5.next = 32;
|
|
458
498
|
break;
|
|
459
499
|
}
|
|
460
500
|
|
|
@@ -477,6 +517,7 @@ function AddLinkDrawer(props) {
|
|
|
477
517
|
linkData = elements.find(function (element) {
|
|
478
518
|
return element.id === result;
|
|
479
519
|
});
|
|
520
|
+
console.log("创建成功-parm,linkData", parm, linkData);
|
|
480
521
|
addLinkToGraph({
|
|
481
522
|
linkData: clone(linkData),
|
|
482
523
|
linkType: linkType,
|
|
@@ -485,10 +526,10 @@ function AddLinkDrawer(props) {
|
|
|
485
526
|
|
|
486
527
|
_Message.success("创建成功");
|
|
487
528
|
|
|
488
|
-
_context5.next =
|
|
529
|
+
_context5.next = 34;
|
|
489
530
|
break;
|
|
490
531
|
|
|
491
|
-
case
|
|
532
|
+
case 32:
|
|
492
533
|
// console.log("保存编辑信息", data, linkType);
|
|
493
534
|
if (linkType === "exit") {
|
|
494
535
|
edge = topo.getGraphView().dm().sm().ld();
|
|
@@ -504,7 +545,7 @@ function AddLinkDrawer(props) {
|
|
|
504
545
|
linkAttrKey = links.findIndex(function (item) {
|
|
505
546
|
return item.id === aobj.id;
|
|
506
547
|
});
|
|
507
|
-
newLinkData =
|
|
548
|
+
newLinkData = mergeExportLinkData(edge.getAttrObject(), links[linkAttrKey]);
|
|
508
549
|
newLinks = clone(links);
|
|
509
550
|
newLinks.splice(linkAttrKey, 1, newLinkData);
|
|
510
551
|
newData = _extends({}, topoState.data, {
|
|
@@ -517,27 +558,27 @@ function AddLinkDrawer(props) {
|
|
|
517
558
|
|
|
518
559
|
_Message.success("保存成功");
|
|
519
560
|
|
|
520
|
-
case
|
|
561
|
+
case 34:
|
|
521
562
|
editDispatchers.update({
|
|
522
563
|
addLinkIsOpen: false,
|
|
523
564
|
currentLink: null
|
|
524
565
|
});
|
|
525
566
|
topo.linkDynamicStyleExecutor.execute();
|
|
526
567
|
|
|
527
|
-
case
|
|
528
|
-
_context5.next =
|
|
568
|
+
case 36:
|
|
569
|
+
_context5.next = 40;
|
|
529
570
|
break;
|
|
530
571
|
|
|
531
|
-
case
|
|
532
|
-
_context5.prev =
|
|
572
|
+
case 38:
|
|
573
|
+
_context5.prev = 38;
|
|
533
574
|
_context5.t0 = _context5["catch"](15);
|
|
534
575
|
|
|
535
|
-
case
|
|
576
|
+
case 40:
|
|
536
577
|
case "end":
|
|
537
578
|
return _context5.stop();
|
|
538
579
|
}
|
|
539
580
|
}
|
|
540
|
-
}, _callee5, null, [[15,
|
|
581
|
+
}, _callee5, null, [[15, 38]]);
|
|
541
582
|
}));
|
|
542
583
|
|
|
543
584
|
return function onSave(_x3) {
|
package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js
CHANGED
|
@@ -11,6 +11,7 @@ import _Form from "@alifd/next/es/form";
|
|
|
11
11
|
import _Radio from "@alifd/next/es/radio";
|
|
12
12
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
13
|
import React, { useState, useEffect } from "react";
|
|
14
|
+
import validator from "validator";
|
|
14
15
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
15
16
|
var RadioGroup = _Radio.Group;
|
|
16
17
|
var FormItem = _Form.Item;
|
|
@@ -24,27 +25,17 @@ function parseValues(values) {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export default function EditLinkInfo(props) {
|
|
28
|
+
var _sourceValue$ipAddres2, _sourceValue$portsDoc5, _sourceValue$portsDoc6, _targetValue$portsDoc5, _targetValue$portsDoc6;
|
|
29
|
+
|
|
27
30
|
var topo = props.topo,
|
|
28
31
|
lineData = props.lineData,
|
|
29
32
|
onClose = props.onClose,
|
|
30
|
-
addLinkIsOpen = props.addLinkIsOpen,
|
|
31
33
|
onSave = props.onSave,
|
|
32
34
|
isAdd = props.isAdd,
|
|
33
35
|
loading = props.loading;
|
|
34
|
-
|
|
35
|
-
var _topo$store$useModel = topo.store.useModel("topoMod"),
|
|
36
|
-
topoState = _topo$store$useModel[0],
|
|
37
|
-
topoDispatchers = _topo$store$useModel[1];
|
|
38
|
-
|
|
39
|
-
var _topo$store$useModel2 = topo.store.useModel("topoBizMod"),
|
|
40
|
-
bizState = _topo$store$useModel2[0],
|
|
41
|
-
bizDispatchers = _topo$store$useModel2[1]; // const { resAndMetrics } = topoState;
|
|
42
|
-
// const { resAndMetrics } = bizState;
|
|
43
|
-
|
|
44
|
-
|
|
45
36
|
var source = lineData.source,
|
|
46
37
|
target = lineData.target,
|
|
47
|
-
attributes = lineData.attributes;
|
|
38
|
+
attributes = lineData.attributes;
|
|
48
39
|
|
|
49
40
|
var _useState = useState(attributes),
|
|
50
41
|
valus = _useState[0],
|
|
@@ -58,9 +49,9 @@ export default function EditLinkInfo(props) {
|
|
|
58
49
|
targetValue = _useState3[0],
|
|
59
50
|
setTarget = _useState3[1];
|
|
60
51
|
|
|
61
|
-
var _useState4 = useState(
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
var _useState4 = useState(),
|
|
53
|
+
ratedBandwidth = _useState4[0],
|
|
54
|
+
setRatedBandwidth = _useState4[1];
|
|
64
55
|
|
|
65
56
|
var fieldOnChange = function fieldOnChange(name, value) {
|
|
66
57
|
var newValues = field.getValues();
|
|
@@ -76,7 +67,6 @@ export default function EditLinkInfo(props) {
|
|
|
76
67
|
|
|
77
68
|
useEffect(function () {
|
|
78
69
|
setValus(attributes);
|
|
79
|
-
rlog.debug("useEffect", source, target, attributes);
|
|
80
70
|
setSource(source);
|
|
81
71
|
setTarget(target);
|
|
82
72
|
field.setValues(attributes);
|
|
@@ -101,7 +91,7 @@ export default function EditLinkInfo(props) {
|
|
|
101
91
|
|
|
102
92
|
if (type === "exit") {
|
|
103
93
|
connect = "exit";
|
|
104
|
-
support = "m.
|
|
94
|
+
support = "m.export_link";
|
|
105
95
|
}
|
|
106
96
|
|
|
107
97
|
return {
|
|
@@ -112,8 +102,11 @@ export default function EditLinkInfo(props) {
|
|
|
112
102
|
|
|
113
103
|
var connectHandleChange = function connectHandleChange(v) {
|
|
114
104
|
field.setValue("connect_type", v);
|
|
105
|
+
field.reset("destination_id");
|
|
115
106
|
};
|
|
116
107
|
|
|
108
|
+
var getRatedBandwidth = function getRatedBandwidth() {};
|
|
109
|
+
|
|
117
110
|
var portsHandleChange = function portsHandleChange(type, value) {
|
|
118
111
|
var _sourceValue$portsDoc, _sourceValue$portsDoc2, _targetValue$portsDoc, _targetValue$portsDoc2;
|
|
119
112
|
|
|
@@ -131,27 +124,49 @@ export default function EditLinkInfo(props) {
|
|
|
131
124
|
} // rlog.debug("network_link.actual_bandwidth", actualBandwidth);
|
|
132
125
|
|
|
133
126
|
|
|
127
|
+
setRatedBandwidth(actualBandwidth);
|
|
134
128
|
field.setValue("network_link.actual_bandwidth", actualBandwidth);
|
|
135
129
|
};
|
|
136
130
|
|
|
131
|
+
var checkName = function checkName(rule, value, callback) {
|
|
132
|
+
// const { validate, getValue } = field;
|
|
133
|
+
var displayName = value;
|
|
134
|
+
var links = topo.getEdges();
|
|
135
|
+
var usedNames = [];
|
|
136
|
+
links.map(function (link) {
|
|
137
|
+
console.log('checkName', link.id, lineData);
|
|
138
|
+
|
|
139
|
+
if (link.dtype === "link" && link.name && link.id !== lineData.attributes.linkId) {
|
|
140
|
+
usedNames.push(link.name);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
if (usedNames.indexOf(displayName) >= 0) {
|
|
145
|
+
console.log("setError", checkName, usedNames, displayName); // field.setError("display_name", "链路名称重复");
|
|
146
|
+
|
|
147
|
+
return callback("链路名称重复");
|
|
148
|
+
} else {
|
|
149
|
+
return callback();
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
137
153
|
var saveHandleChange = function saveHandleChange() {
|
|
138
154
|
field.validate(function (errors, values) {
|
|
139
155
|
if (errors) {
|
|
140
|
-
rlog.
|
|
156
|
+
rlog.error("saveHandleChange-error", errors, values);
|
|
141
157
|
} else {
|
|
142
158
|
var _valus$destination_id, _sourceValue$portsDoc3, _sourceValue$portsDoc4, _targetValue$portsDoc3, _targetValue$portsDoc4, _targetValue$ipAddres, _sourceValue$ipAddres, _targetValue$id;
|
|
143
159
|
|
|
144
|
-
rlog.debug("saveHandleChange", valus, source, target);
|
|
145
160
|
var sourceId = valus["source_id"];
|
|
146
161
|
var destinationId = (_valus$destination_id = valus["destination_id"]) !== null && _valus$destination_id !== void 0 ? _valus$destination_id : "";
|
|
147
162
|
var sourceType = (_sourceValue$portsDoc3 = (_sourceValue$portsDoc4 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc4 === void 0 ? void 0 : _sourceValue$portsDoc4.type) !== null && _sourceValue$portsDoc3 !== void 0 ? _sourceValue$portsDoc3 : "";
|
|
148
163
|
var destinationType = (_targetValue$portsDoc3 = (_targetValue$portsDoc4 = targetValue.portsDoc[destinationId]) === null || _targetValue$portsDoc4 === void 0 ? void 0 : _targetValue$portsDoc4.type) !== null && _targetValue$portsDoc3 !== void 0 ? _targetValue$portsDoc3 : "";
|
|
149
164
|
var typeJudge = linkTypeJudge(sourceType, destinationType, valus["connect_type"]);
|
|
150
|
-
var destination_ipv4 =
|
|
165
|
+
var destination_ipv4 = (_targetValue$ipAddres = targetValue.ipAddress) !== null && _targetValue$ipAddres !== void 0 ? _targetValue$ipAddres : valus["network_link.destination_ipv4"];
|
|
151
166
|
var obj = {
|
|
152
167
|
display_name: valus["display_name"],
|
|
153
168
|
// 链路名称
|
|
154
|
-
name: valus["display_name"],
|
|
169
|
+
name: isAdd ? valus["display_name"] : attributes["name"],
|
|
155
170
|
// 链路名称
|
|
156
171
|
"network_link.source_ipv4": (_sourceValue$ipAddres = sourceValue.ipAddress) !== null && _sourceValue$ipAddres !== void 0 ? _sourceValue$ipAddres : valus["network_link.source_ipv4"],
|
|
157
172
|
// 源IP
|
|
@@ -190,6 +205,17 @@ export default function EditLinkInfo(props) {
|
|
|
190
205
|
obj["destination_type"] = "";
|
|
191
206
|
}
|
|
192
207
|
|
|
208
|
+
if (isAdd) {
|
|
209
|
+
obj["network_link.network_category"] = "CAN";
|
|
210
|
+
obj["network_link.work_mode"] = "AandS"; // 工作模式
|
|
211
|
+
|
|
212
|
+
obj.rated_bandwidth = ratedBandwidth; // 额定带宽
|
|
213
|
+
|
|
214
|
+
obj["network_link.role"] = "master";
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
console.log("保存数据-obj", obj);
|
|
218
|
+
|
|
193
219
|
if (isAdd) {
|
|
194
220
|
onSave(obj);
|
|
195
221
|
} else {
|
|
@@ -261,17 +287,16 @@ export default function EditLinkInfo(props) {
|
|
|
261
287
|
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
262
288
|
labelAlign: labelAlign,
|
|
263
289
|
label: "\u6E90\u8282\u70B9IP"
|
|
264
|
-
}),
|
|
290
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
265
291
|
className: styles.label
|
|
266
|
-
}, sourceValue.ipAddress) : /*#__PURE__*/React.createElement(
|
|
267
|
-
placeholder: "\u8BF7\u8F93\u5165",
|
|
268
|
-
name: "network_link.source_ipv4",
|
|
269
|
-
maxLength: 128
|
|
270
|
-
}))), /*#__PURE__*/React.createElement(Col, {
|
|
292
|
+
}, (_sourceValue$ipAddres2 = sourceValue.ipAddress) !== null && _sourceValue$ipAddres2 !== void 0 ? _sourceValue$ipAddres2 : '-'))), /*#__PURE__*/React.createElement(Col, {
|
|
271
293
|
span: "12"
|
|
272
294
|
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
273
295
|
labelAlign: labelAlign,
|
|
274
|
-
label: "\u76EE\u7684\u8282\u70B9IP"
|
|
296
|
+
label: "\u76EE\u7684\u8282\u70B9IP",
|
|
297
|
+
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)))$/,
|
|
298
|
+
patternTrigger: "onBlur",
|
|
299
|
+
patternMessage: "IP\u5730\u5740\u683C\u5F0F\u4E0D\u6B63\u786E"
|
|
275
300
|
}), targetIpComp(target)))), /*#__PURE__*/React.createElement(Row, {
|
|
276
301
|
gutter: "16"
|
|
277
302
|
}, /*#__PURE__*/React.createElement(Col, {
|
|
@@ -281,7 +306,7 @@ export default function EditLinkInfo(props) {
|
|
|
281
306
|
label: "\u6E90\u7AEF\u53E3",
|
|
282
307
|
required: true,
|
|
283
308
|
requiredMessage: "\u6E90\u7AEF\u53E3\u4E0D\u80FD\u4E3A\u7A7A"
|
|
284
|
-
}), sourceValue.
|
|
309
|
+
}), sourceValue.ciId ? /*#__PURE__*/React.createElement(_Select, {
|
|
285
310
|
name: "source_id",
|
|
286
311
|
disabled: sourceValue.ports.length === 0,
|
|
287
312
|
className: styles.selectList,
|
|
@@ -313,14 +338,14 @@ export default function EditLinkInfo(props) {
|
|
|
313
338
|
label: "\u8D44\u6E90\u7C7B\u578B"
|
|
314
339
|
}), /*#__PURE__*/React.createElement("div", {
|
|
315
340
|
className: styles.label
|
|
316
|
-
}, sourceValue.ciName))), /*#__PURE__*/React.createElement(Col, {
|
|
341
|
+
}, (_sourceValue$portsDoc5 = (_sourceValue$portsDoc6 = sourceValue.portsDoc[valus.source_id]) === null || _sourceValue$portsDoc6 === void 0 ? void 0 : _sourceValue$portsDoc6.typeName) !== null && _sourceValue$portsDoc5 !== void 0 ? _sourceValue$portsDoc5 : sourceValue.ciName))), /*#__PURE__*/React.createElement(Col, {
|
|
317
342
|
span: "12"
|
|
318
343
|
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
319
344
|
labelAlign: labelAlign,
|
|
320
345
|
label: "\u8D44\u6E90\u7C7B\u578B"
|
|
321
346
|
}), /*#__PURE__*/React.createElement("div", {
|
|
322
347
|
className: styles.label
|
|
323
|
-
}, targetValue.ciName)))), /*#__PURE__*/React.createElement(Row, {
|
|
348
|
+
}, (_targetValue$portsDoc5 = (_targetValue$portsDoc6 = targetValue.portsDoc[valus.destination_id]) === null || _targetValue$portsDoc6 === void 0 ? void 0 : _targetValue$portsDoc6.typeName) !== null && _targetValue$portsDoc5 !== void 0 ? _targetValue$portsDoc5 : targetValue.ciName)))), /*#__PURE__*/React.createElement(Row, {
|
|
324
349
|
gutter: "16"
|
|
325
350
|
}, /*#__PURE__*/React.createElement(Col, {
|
|
326
351
|
span: "24"
|
|
@@ -332,7 +357,8 @@ export default function EditLinkInfo(props) {
|
|
|
332
357
|
requiredTrigger: "onBlur",
|
|
333
358
|
pattern: /^[^'"\\%]+[^'"\\%]*[^'"\\%]*$/,
|
|
334
359
|
patternTrigger: "onBlur",
|
|
335
|
-
patternMessage: "\u4E0D\u5141\u8BB8\u8F93\u5165\u2018\u3001\u201C\u3001\\\u3001%"
|
|
360
|
+
patternMessage: "\u4E0D\u5141\u8BB8\u8F93\u5165\u2018\u3001\u201C\u3001\\\u3001%",
|
|
361
|
+
validator: checkName
|
|
336
362
|
}), /*#__PURE__*/React.createElement(_Input, {
|
|
337
363
|
placeholder: "\u8BF7\u8F93\u5165",
|
|
338
364
|
name: "display_name",
|
|
@@ -352,7 +378,7 @@ export default function EditLinkInfo(props) {
|
|
|
352
378
|
}, /*#__PURE__*/React.createElement(_Radio, {
|
|
353
379
|
id: "phy",
|
|
354
380
|
value: "phy",
|
|
355
|
-
disabled: target.ciType === "customNode" || !targetValue.ipAddress
|
|
381
|
+
disabled: target.ciType === "customNode" || !targetValue.ipAddress || targetValue.ports.length === 0
|
|
356
382
|
}, "\u7269\u7406/\u805A\u5408"), /*#__PURE__*/React.createElement(_Radio, {
|
|
357
383
|
id: "exit",
|
|
358
384
|
value: "exit"
|