@riil-frontend/component-topology 3.1.13 → 3.4.0
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 +2 -2
- package/build/2.js +1 -1
- package/build/index.js +36 -36
- package/demo/CHANGELOG/CHANGELOG.md +5 -0
- package/es/components/MultiResourceDrawer/index.js +2 -2
- package/es/components/NetworkTopoResourceSelectDrawer/NetworkTopoResourceSelectDrawer.js +9 -0
- package/es/components/NetworkTopoResourceSelectDrawer/index.js +2 -0
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -3
- package/es/components/ResourceSelectDrawer/ResourceSelectList.js +9 -6
- package/es/components/SingleResourceDrawer/SelectDrawer.js +1 -1
- package/es/constants/ResourceTypeLimit.js +12 -1
- package/es/core/common/icons/icon.js +3 -28
- package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +1 -1
- package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +148 -10
- package/es/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +4 -5
- package/es/core/editor/components/settings/propertyViews/index.js +1 -5
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceDrawer.js +1 -1
- package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +2 -1
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/topoData.js +21 -18
- package/es/core/models/utils/linkUtils.js +14 -14
- package/es/hooks/useResourceConfig.js +3 -2
- package/es/hooks/useSelection.js +16 -14
- package/es/models/topoConfig.js +20 -16
- package/es/models/topoMod.js +1 -0
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +14 -8
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +16 -3
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +3 -3
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +145 -97
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +61 -21
- package/es/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +26 -7
- package/es/topoCenter/event/index.js +1 -0
- package/es/topoCenter/hooks/editor/useDeleteEdges.js +46 -24
- package/es/topoCenter/services/link.js +51 -0
- package/es/topoCenter/utils/linPermissionUtil.js +24 -13
- package/es/utils/ResourceConfigUtil.js +38 -16
- package/es/utils/topoData.js +6 -7
- package/lib/components/MultiResourceDrawer/index.js +2 -2
- package/lib/components/NetworkTopoResourceSelectDrawer/NetworkTopoResourceSelectDrawer.js +20 -0
- package/lib/components/NetworkTopoResourceSelectDrawer/index.js +11 -0
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -3
- package/lib/components/ResourceSelectDrawer/ResourceSelectList.js +10 -5
- package/lib/components/SingleResourceDrawer/SelectDrawer.js +2 -2
- package/lib/constants/ResourceTypeLimit.js +19 -2
- package/lib/core/common/icons/icon.js +3 -35
- package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +2 -2
- package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +160 -9
- package/lib/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +3 -5
- package/lib/core/editor/components/settings/propertyViews/index.js +1 -5
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceDrawer.js +2 -2
- package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +3 -2
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/topoData.js +24 -17
- package/lib/core/models/utils/linkUtils.js +12 -12
- package/lib/hooks/useResourceConfig.js +3 -2
- package/lib/hooks/useSelection.js +15 -11
- package/lib/models/topoConfig.js +24 -16
- package/lib/models/topoMod.js +1 -0
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +19 -9
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +17 -2
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +2 -2
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +145 -113
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +60 -22
- package/lib/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +27 -7
- package/lib/topoCenter/event/index.js +2 -1
- package/lib/topoCenter/hooks/editor/useDeleteEdges.js +46 -24
- package/lib/topoCenter/services/link.js +52 -0
- package/lib/topoCenter/utils/linPermissionUtil.js +24 -13
- package/lib/utils/ResourceConfigUtil.js +36 -14
- package/lib/utils/topoData.js +6 -7
- package/package.json +3 -3
- package/es/core/common/icons/defaultIcons.js +0 -44
- package/es/core/common/icons/networkTopoCiTypeIcons.js +0 -9
- package/lib/core/common/icons/defaultIcons.js +0 -53
- package/lib/core/common/icons/networkTopoCiTypeIcons.js +0 -22
|
@@ -11,6 +11,8 @@ var _drawer = _interopRequireDefault(require("@alifd/next/lib/drawer"));
|
|
|
11
11
|
|
|
12
12
|
var _message = _interopRequireDefault(require("@alifd/next/lib/message"));
|
|
13
13
|
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
14
16
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
17
|
|
|
16
18
|
var _collapse = _interopRequireDefault(require("@alifd/next/lib/collapse"));
|
|
@@ -59,7 +61,7 @@ function AddLinkDrawer(props) {
|
|
|
59
61
|
|
|
60
62
|
var addLinkIsOpen = editState.addLinkIsOpen,
|
|
61
63
|
currentLink = editState.currentLink;
|
|
62
|
-
var ciConnectable = linkState.ciConnectable; // rlog.debug("addLinkDrawer--init-addLinkIsOpen", addLinkIsOpen, currentLink);
|
|
64
|
+
var ciConnectable = linkState.ciConnectable; // // rlog.debug("addLinkDrawer--init-addLinkIsOpen", addLinkIsOpen, currentLink);
|
|
63
65
|
// const [visible, { setTrue, setFalse }] = useBoolean();
|
|
64
66
|
|
|
65
67
|
var _useState = (0, _react.useState)(),
|
|
@@ -93,10 +95,8 @@ function AddLinkDrawer(props) {
|
|
|
93
95
|
|
|
94
96
|
case 2:
|
|
95
97
|
result = _context.sent;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
// rlog.debug("端口列表", result);
|
|
99
|
+
//const list = result[id];
|
|
100
100
|
portsDoc = {};
|
|
101
101
|
ports = result.map(function (item) {
|
|
102
102
|
var obj = {
|
|
@@ -113,7 +113,7 @@ function AddLinkDrawer(props) {
|
|
|
113
113
|
portsDoc: portsDoc
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
-
case
|
|
116
|
+
case 6:
|
|
117
117
|
case "end":
|
|
118
118
|
return _context.stop();
|
|
119
119
|
}
|
|
@@ -134,21 +134,20 @@ function AddLinkDrawer(props) {
|
|
|
134
134
|
switch (_context2.prev = _context2.next) {
|
|
135
135
|
case 0:
|
|
136
136
|
linkNodesRef.current = e; // const { type, data } = e;
|
|
137
|
-
|
|
138
|
-
_rlog["default"].debug("接到打开创建链路抽屉信息", e);
|
|
137
|
+
// rlog.debug("接到打开创建链路抽屉信息", e);
|
|
139
138
|
|
|
140
139
|
setIsAddMode(true); // setTrue();
|
|
141
140
|
|
|
142
|
-
_context2.prev =
|
|
143
|
-
_context2.next =
|
|
141
|
+
_context2.prev = 2;
|
|
142
|
+
_context2.next = 5;
|
|
144
143
|
return getPortsById(e.source._attrObject.id);
|
|
145
144
|
|
|
146
|
-
case
|
|
145
|
+
case 5:
|
|
147
146
|
sourcePorts = _context2.sent;
|
|
148
|
-
_context2.next =
|
|
147
|
+
_context2.next = 8;
|
|
149
148
|
return getPortsById(e.target._attrObject.id);
|
|
150
149
|
|
|
151
|
-
case
|
|
150
|
+
case 8:
|
|
152
151
|
targetPorts = _context2.sent;
|
|
153
152
|
source = translationNode(e.source, sourcePorts);
|
|
154
153
|
target = translationNode(e.target, targetPorts);
|
|
@@ -170,24 +169,25 @@ function AddLinkDrawer(props) {
|
|
|
170
169
|
source_id: "",
|
|
171
170
|
"network_link.source_device_id": source.id,
|
|
172
171
|
"network_link.destination_device_id": target.id,
|
|
173
|
-
"network_link.actual_bandwidth": null
|
|
172
|
+
"network_link.actual_bandwidth": null,
|
|
173
|
+
connect_type: target.ciType !== "customNode" ? "phy" : "exit"
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
|
-
_context2.next =
|
|
176
|
+
_context2.next = 18;
|
|
177
177
|
break;
|
|
178
178
|
|
|
179
|
-
case
|
|
180
|
-
_context2.prev =
|
|
181
|
-
_context2.t0 = _context2["catch"](
|
|
179
|
+
case 15:
|
|
180
|
+
_context2.prev = 15;
|
|
181
|
+
_context2.t0 = _context2["catch"](2);
|
|
182
182
|
|
|
183
183
|
_rlog["default"].error("出现异常", _context2.t0);
|
|
184
184
|
|
|
185
|
-
case
|
|
185
|
+
case 18:
|
|
186
186
|
case "end":
|
|
187
187
|
return _context2.stop();
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
}, _callee2, null, [[
|
|
190
|
+
}, _callee2, null, [[2, 15]]);
|
|
191
191
|
}));
|
|
192
192
|
|
|
193
193
|
return function handleEvent(_x2) {
|
|
@@ -195,17 +195,23 @@ function AddLinkDrawer(props) {
|
|
|
195
195
|
};
|
|
196
196
|
}();
|
|
197
197
|
|
|
198
|
+
var selectedSourceNodeHandleEvent = function selectedSourceNodeHandleEvent(e) {
|
|
199
|
+
// rlog.debug("设置了起始节点", e);
|
|
200
|
+
//const allData = topo.getData();
|
|
201
|
+
var enableNodes = (0, _htElementUtils.getNodes)(topo.getDataModel());
|
|
202
|
+
topo.view.topoClient.emitEvent("topo_link_set_connectable_nodes", enableNodes);
|
|
203
|
+
};
|
|
204
|
+
|
|
198
205
|
var initEditLineData = /*#__PURE__*/function () {
|
|
199
206
|
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
200
207
|
var _currentLink$attribut, _sourcePorts$ports, _currentLink$attribut2, _targetPorts$ports;
|
|
201
208
|
|
|
202
|
-
var sourcePorts, targetPorts;
|
|
209
|
+
var sourcePorts, targetPorts, connect_type;
|
|
203
210
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
204
211
|
while (1) {
|
|
205
212
|
switch (_context3.prev = _context3.next) {
|
|
206
213
|
case 0:
|
|
207
|
-
|
|
208
|
-
|
|
214
|
+
console.log("编辑链路--当前链路", currentLink);
|
|
209
215
|
_context3.next = 3;
|
|
210
216
|
return getPortsById(currentLink.source);
|
|
211
217
|
|
|
@@ -216,6 +222,7 @@ function AddLinkDrawer(props) {
|
|
|
216
222
|
|
|
217
223
|
case 6:
|
|
218
224
|
targetPorts = _context3.sent;
|
|
225
|
+
connect_type = currentLink.attributes["network_link.connect_type"] === "exit" ? "exit" : "phy";
|
|
219
226
|
setLink({
|
|
220
227
|
source: {
|
|
221
228
|
id: currentLink.source,
|
|
@@ -232,15 +239,17 @@ function AddLinkDrawer(props) {
|
|
|
232
239
|
name: currentLink.attributes["network_link.destination_device_id_object"].displayName,
|
|
233
240
|
ipAddress: currentLink.attributes["network_link.destination_ipv4"],
|
|
234
241
|
ciName: (_currentLink$attribut2 = currentLink.attributes.destination_type_object) === null || _currentLink$attribut2 === void 0 ? void 0 : _currentLink$attribut2.displayName,
|
|
235
|
-
ciType: currentLink.attributes.destination_type,
|
|
242
|
+
ciType: currentLink.attributes.destination_type !== "" ? currentLink.attributes.destination_type : "customNode",
|
|
236
243
|
interfaceTarget: currentLink.interfaceTarget,
|
|
237
244
|
ports: (_targetPorts$ports = targetPorts.ports) !== null && _targetPorts$ports !== void 0 ? _targetPorts$ports : [],
|
|
238
245
|
portsDoc: targetPorts.portsDoc
|
|
239
246
|
},
|
|
240
|
-
attributes: currentLink.attributes
|
|
247
|
+
attributes: (0, _extends2["default"])({}, currentLink.attributes, {
|
|
248
|
+
connect_type: connect_type
|
|
249
|
+
})
|
|
241
250
|
});
|
|
242
251
|
|
|
243
|
-
case
|
|
252
|
+
case 9:
|
|
244
253
|
case "end":
|
|
245
254
|
return _context3.stop();
|
|
246
255
|
}
|
|
@@ -254,8 +263,7 @@ function AddLinkDrawer(props) {
|
|
|
254
263
|
}();
|
|
255
264
|
|
|
256
265
|
(0, _react.useEffect)(function () {
|
|
257
|
-
|
|
258
|
-
|
|
266
|
+
// rlog.debug("useEffect-----currentLink", currentLink);
|
|
259
267
|
if (currentLink) {
|
|
260
268
|
setIsAddMode(false);
|
|
261
269
|
initEditLineData();
|
|
@@ -264,38 +272,39 @@ function AddLinkDrawer(props) {
|
|
|
264
272
|
|
|
265
273
|
var getCiTypesConnectable = /*#__PURE__*/function () {
|
|
266
274
|
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
267
|
-
var notifier, ciTypesConnectable, nodes, ciIds;
|
|
275
|
+
var notifier, ciTypesConnectable, nodes, ciIds, ciNodes;
|
|
268
276
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
269
277
|
while (1) {
|
|
270
278
|
switch (_context4.prev = _context4.next) {
|
|
271
279
|
case 0:
|
|
272
|
-
notifier = topo.view.topoClient.notifier;
|
|
273
|
-
|
|
274
|
-
_rlog["default"].debug("加载哪些ci类型可创建链路-getCiTypesConnectable"); // 加载哪些ci类型可创建链路
|
|
280
|
+
notifier = topo.view.topoClient.notifier; // rlog.debug("加载哪些ci类型可创建链路-getCiTypesConnectable");
|
|
281
|
+
// 加载哪些ci类型可创建链路
|
|
275
282
|
|
|
276
|
-
|
|
277
|
-
_context4.next = 4;
|
|
283
|
+
_context4.next = 3;
|
|
278
284
|
return _topo["default"].networkLink.getCiTypesConnectable(_ResourceTypeLimit.RESOURCE_LIMIT_TYPES);
|
|
279
285
|
|
|
280
|
-
case
|
|
286
|
+
case 3:
|
|
281
287
|
ciTypesConnectable = _context4.sent;
|
|
282
|
-
nodes =
|
|
283
|
-
|
|
284
|
-
|
|
288
|
+
nodes = (0, _htElementUtils.getNodes)(topo.getDataModel()); // rlog.debug("getCiTypesConnectable", nodes);
|
|
289
|
+
// const tags = topo.getTag();
|
|
290
|
+
// rlog.debug("加载哪些ci类型可创建链路", ciTypesConnectable, topo, nodes);
|
|
285
291
|
|
|
286
292
|
ciIds = [];
|
|
293
|
+
ciNodes = [];
|
|
287
294
|
nodes.map(function (node) {
|
|
288
|
-
|
|
295
|
+
// rlog.debug("过滤属性", node.a("operation"));
|
|
296
|
+
if (ciTypesConnectable[node.a("ciType")] && ["delete", "write"].indexOf(node.a("operation")) >= 0) {
|
|
289
297
|
ciIds.push(node.id);
|
|
298
|
+
ciNodes.push(node);
|
|
290
299
|
}
|
|
291
300
|
});
|
|
292
301
|
linkDispatchers.update({
|
|
293
302
|
ciConnectable: ciIds
|
|
294
303
|
});
|
|
295
304
|
setCiIdsConnectable(ciIds);
|
|
296
|
-
return _context4.abrupt("return",
|
|
305
|
+
return _context4.abrupt("return", ciNodes);
|
|
297
306
|
|
|
298
|
-
case
|
|
307
|
+
case 11:
|
|
299
308
|
case "end":
|
|
300
309
|
return _context4.stop();
|
|
301
310
|
}
|
|
@@ -310,40 +319,37 @@ function AddLinkDrawer(props) {
|
|
|
310
319
|
|
|
311
320
|
|
|
312
321
|
(0, _react.useEffect)(function () {
|
|
313
|
-
var notifier = topo.view.topoClient.notifier;
|
|
314
|
-
|
|
315
|
-
_rlog["default"].debug("注册事件"); // 进入划线模式,置灰不可用的节点
|
|
316
|
-
|
|
322
|
+
var notifier = topo.view.topoClient.notifier; // rlog.debug("注册事件");
|
|
323
|
+
// 进入划线模式,置灰不可用的节点
|
|
317
324
|
|
|
318
325
|
var enterHandleEvent = function enterHandleEvent() {
|
|
319
|
-
getCiTypesConnectable().then(function (
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
topo.view.topoClient.emitEvent("topo_link_set_connectable_nodes", ciIds);
|
|
326
|
+
getCiTypesConnectable().then(function (ciNodes) {
|
|
327
|
+
// rlog.debug("设置可连线节点", ciIdsConnectable, ciNodes);
|
|
328
|
+
topo.view.topoClient.emitEvent("topo_link_set_connectable_nodes", ciNodes);
|
|
323
329
|
});
|
|
324
330
|
};
|
|
325
331
|
|
|
326
332
|
notifier.on(_event["default"].TOPO_LINK_ENTER_CREATE_MODE, enterHandleEvent);
|
|
327
333
|
notifier.on(_event["default"].TOPO_LINK_CREATED, handleEvent);
|
|
334
|
+
notifier.on(_event["default"].TOPO_LINK_SELECT_SOURCE_NODE, selectedSourceNodeHandleEvent);
|
|
328
335
|
return function () {
|
|
329
336
|
// 取消注册事件
|
|
330
|
-
|
|
331
|
-
|
|
337
|
+
// rlog.debug("取消注册事件");
|
|
332
338
|
notifier.off(_event["default"].TOPO_LINK_ENTER_CREATE_MODE, enterHandleEvent);
|
|
333
339
|
notifier.off(_event["default"].TOPO_LINK_CREATED, handleEvent);
|
|
334
340
|
};
|
|
335
341
|
}, []);
|
|
336
342
|
|
|
337
343
|
var translationNode = function translationNode(node, Ports) {
|
|
338
|
-
var _Ports$ports;
|
|
344
|
+
var _topo$ciTyeCache$getC, _topo$ciTyeCache$getC2, _attrObject$ciType, _Ports$ports;
|
|
339
345
|
|
|
340
346
|
var attrObject = node._attrObject;
|
|
341
347
|
return {
|
|
342
348
|
id: attrObject.id,
|
|
343
349
|
name: attrObject.name,
|
|
344
350
|
ipAddress: attrObject.ipAddress,
|
|
345
|
-
ciName: topo.ciTyeCache.getCiType(attrObject.ciType).displayName,
|
|
346
|
-
ciType: attrObject.ciType,
|
|
351
|
+
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,
|
|
352
|
+
ciType: (_attrObject$ciType = attrObject.ciType) !== null && _attrObject$ciType !== void 0 ? _attrObject$ciType : "customNode",
|
|
347
353
|
ports: (_Ports$ports = Ports.ports) !== null && _Ports$ports !== void 0 ? _Ports$ports : [],
|
|
348
354
|
portsDoc: Ports.portsDoc
|
|
349
355
|
};
|
|
@@ -351,8 +357,7 @@ function AddLinkDrawer(props) {
|
|
|
351
357
|
|
|
352
358
|
var closeDrawer = function closeDrawer() {
|
|
353
359
|
//editDispatchers.update({ addLinkIsOpen: false });
|
|
354
|
-
|
|
355
|
-
|
|
360
|
+
// rlog.debug("关闭");
|
|
356
361
|
editDispatchers.update({
|
|
357
362
|
addLinkIsOpen: false,
|
|
358
363
|
currentLink: null
|
|
@@ -361,19 +366,18 @@ function AddLinkDrawer(props) {
|
|
|
361
366
|
|
|
362
367
|
var addLinkToGraph = function addLinkToGraph(_ref5) {
|
|
363
368
|
var linkData = _ref5.linkData,
|
|
364
|
-
|
|
369
|
+
linkType = _ref5.linkType,
|
|
370
|
+
targetName = _ref5.targetName;
|
|
365
371
|
var htTopo = topo.getHtTopo();
|
|
366
372
|
var _linkNodesRef$current = linkNodesRef.current,
|
|
367
373
|
source = _linkNodesRef$current.source,
|
|
368
374
|
target = _linkNodesRef$current.target;
|
|
369
375
|
|
|
370
|
-
_rlog["default"].debug("addLinkToGraph", source, target, htTopo);
|
|
371
|
-
|
|
372
376
|
try {
|
|
373
377
|
// 获取两个节点间的连线数据列表
|
|
374
378
|
var edgesInNodes = (0, _htElementUtils.getEdgesBetweenNodes)(source, target);
|
|
375
379
|
|
|
376
|
-
if (
|
|
380
|
+
if (linkType === "agg") {
|
|
377
381
|
// 聚合链路
|
|
378
382
|
if (edgesInNodes.length === 0) {
|
|
379
383
|
htTopo.createEdge(source, target, linkData);
|
|
@@ -384,21 +388,15 @@ function AddLinkDrawer(props) {
|
|
|
384
388
|
|
|
385
389
|
htTopo.toggleEdgeGroup(source, target, false);
|
|
386
390
|
} else {
|
|
387
|
-
//
|
|
391
|
+
// 出口链路
|
|
388
392
|
// 有连线组无子连线时,设置连线数据,切换到连线并选中
|
|
389
|
-
// 注释代码,因为 createEdge 内置该逻辑
|
|
390
|
-
// const firstEdge = edgesInNodes[0]
|
|
391
|
-
// if (edgesInNodes.length === 1 && !htTopo.getEdgeData(firstEdge)) {
|
|
392
|
-
// htTopo.setEdgeData(firstEdge, linkData);
|
|
393
|
-
// } else {
|
|
394
|
-
// htTopo.createEdge(source, target, linkData);
|
|
395
|
-
// }
|
|
396
393
|
var edge = htTopo.createEdge(source, target, linkData);
|
|
397
394
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
395
|
+
if (linkType === "exit" && target.getTag() === undefined) {
|
|
396
|
+
// rlog.debug("addLinkToGraph-exit-target", target, target.getTag());
|
|
397
|
+
target.a("name", targetName);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
402
400
|
|
|
403
401
|
topo.getGraphView().dm().sm().ss(topo.getDataModel().getDataByTag(linkData.id));
|
|
404
402
|
} catch (error) {
|
|
@@ -408,15 +406,14 @@ function AddLinkDrawer(props) {
|
|
|
408
406
|
|
|
409
407
|
var onSave = /*#__PURE__*/function () {
|
|
410
408
|
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
|
|
411
|
-
var parm, result, config, _yield$editDispatcher, elements, linkData,
|
|
409
|
+
var parm, result, linkType, config, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target;
|
|
412
410
|
|
|
413
411
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
414
412
|
while (1) {
|
|
415
413
|
switch (_context5.prev = _context5.next) {
|
|
416
414
|
case 0:
|
|
417
415
|
//editDispatchers.update({ addLinkIsOpen: false });
|
|
418
|
-
|
|
419
|
-
|
|
416
|
+
// rlog.debug("保存链路信息", isAddMode, data);
|
|
420
417
|
setLoading(true);
|
|
421
418
|
parm = {
|
|
422
419
|
attributes: data
|
|
@@ -424,84 +421,119 @@ function AddLinkDrawer(props) {
|
|
|
424
421
|
result = null;
|
|
425
422
|
|
|
426
423
|
if (!isAddMode) {
|
|
427
|
-
_context5.next =
|
|
424
|
+
_context5.next = 9;
|
|
428
425
|
break;
|
|
429
426
|
}
|
|
430
427
|
|
|
431
|
-
_context5.next =
|
|
428
|
+
_context5.next = 6;
|
|
432
429
|
return _server["default"].addLink(parm);
|
|
433
430
|
|
|
434
|
-
case
|
|
431
|
+
case 6:
|
|
435
432
|
result = _context5.sent;
|
|
436
|
-
_context5.next =
|
|
433
|
+
_context5.next = 13;
|
|
437
434
|
break;
|
|
438
435
|
|
|
439
|
-
case
|
|
436
|
+
case 9:
|
|
440
437
|
parm.id = currentLink.id;
|
|
441
|
-
_context5.next =
|
|
438
|
+
_context5.next = 12;
|
|
442
439
|
return _server["default"].editLink(parm);
|
|
443
440
|
|
|
444
|
-
case
|
|
441
|
+
case 12:
|
|
445
442
|
result = _context5.sent;
|
|
446
443
|
|
|
447
|
-
case
|
|
444
|
+
case 13:
|
|
448
445
|
setLoading(false); // if (result) {
|
|
449
446
|
// Message.success("保存成功");
|
|
450
447
|
// }
|
|
451
448
|
|
|
449
|
+
linkType = data["network_link.connect_type"];
|
|
452
450
|
_context5.prev = 15;
|
|
453
451
|
|
|
454
452
|
if (!result) {
|
|
455
|
-
_context5.next =
|
|
453
|
+
_context5.next = 35;
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
config = topo.resourceConfig.getConfigFromHt(); // rlog.debug("getConfigFromHt", config, topo.resourceConfig);
|
|
458
|
+
// console.log("save success", data, result);
|
|
459
|
+
// 新建后显示到图上
|
|
460
|
+
|
|
461
|
+
if (!isAddMode) {
|
|
462
|
+
_context5.next = 31;
|
|
456
463
|
break;
|
|
457
464
|
}
|
|
458
465
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
466
|
+
exportLinkIdList = config.exportLinkIdList;
|
|
467
|
+
|
|
468
|
+
if (data["network_link.connect_type"] === "exit") {
|
|
469
|
+
exportLinkIdList.push(result);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
topo.resourceConfig.updateConfig((0, _extends2["default"])({}, config, {
|
|
473
|
+
exportLinkIdList: exportLinkIdList
|
|
474
|
+
})); // const linkType = data["network_link.connect_type"];
|
|
475
|
+
|
|
476
|
+
_context5.next = 24;
|
|
462
477
|
return editDispatchers.fetchDataByConfig();
|
|
463
478
|
|
|
464
|
-
case
|
|
479
|
+
case 24:
|
|
465
480
|
_yield$editDispatcher = _context5.sent;
|
|
466
481
|
elements = _yield$editDispatcher.elements;
|
|
482
|
+
linkData = elements.find(function (element) {
|
|
483
|
+
return element.id === result;
|
|
484
|
+
});
|
|
485
|
+
addLinkToGraph({
|
|
486
|
+
linkData: (0, _copyUtil.clone)(linkData),
|
|
487
|
+
linkType: linkType,
|
|
488
|
+
targetName: data["network_link.destination_ipv4"]
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
_message["default"].success("创建成功");
|
|
492
|
+
|
|
493
|
+
_context5.next = 33;
|
|
494
|
+
break;
|
|
495
|
+
|
|
496
|
+
case 31:
|
|
497
|
+
// console.log(
|
|
498
|
+
// "保存编辑信息",
|
|
499
|
+
// data,
|
|
500
|
+
// linkType,
|
|
501
|
+
// topo.getGraphView().dm().sm().ld()
|
|
502
|
+
// );
|
|
503
|
+
if (linkType === "exit") {
|
|
504
|
+
edge = topo.getGraphView().dm().sm().ld();
|
|
505
|
+
aobj = edge.getAttrObject();
|
|
506
|
+
edge.setAttrObject((0, _extends2["default"])({}, aobj, data));
|
|
507
|
+
target = edge.getTarget();
|
|
508
|
+
|
|
509
|
+
if (target.getTag() === undefined) {
|
|
510
|
+
target.a("name", data["network_link.destination_ipv4"]);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
_message["default"].success("保存成功");
|
|
515
|
+
|
|
516
|
+
case 33:
|
|
467
517
|
editDispatchers.update({
|
|
468
518
|
addLinkIsOpen: false,
|
|
469
519
|
currentLink: null
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
if (isAddMode) {
|
|
473
|
-
_message["default"].success("创建成功");
|
|
474
|
-
|
|
475
|
-
linkData = elements.find(function (element) {
|
|
476
|
-
return element.id === result;
|
|
477
|
-
});
|
|
478
|
-
isAgg = data["network_link.connect_type"] === "agg";
|
|
479
|
-
addLinkToGraph({
|
|
480
|
-
linkData: (0, _copyUtil.clone)(linkData),
|
|
481
|
-
isAgg: isAgg
|
|
482
|
-
});
|
|
483
|
-
} else {
|
|
484
|
-
_message["default"].success("保存成功");
|
|
485
|
-
}
|
|
486
|
-
|
|
520
|
+
});
|
|
487
521
|
topo.linkDynamicStyleExecutor.execute();
|
|
488
522
|
|
|
489
|
-
case
|
|
490
|
-
_context5.next =
|
|
523
|
+
case 35:
|
|
524
|
+
_context5.next = 39;
|
|
491
525
|
break;
|
|
492
526
|
|
|
493
|
-
case
|
|
494
|
-
_context5.prev =
|
|
527
|
+
case 37:
|
|
528
|
+
_context5.prev = 37;
|
|
495
529
|
_context5.t0 = _context5["catch"](15);
|
|
496
530
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
case 31:
|
|
531
|
+
case 39:
|
|
500
532
|
case "end":
|
|
501
533
|
return _context5.stop();
|
|
502
534
|
}
|
|
503
535
|
}
|
|
504
|
-
}, _callee5, null, [[15,
|
|
536
|
+
}, _callee5, null, [[15, 37]]);
|
|
505
537
|
}));
|
|
506
538
|
|
|
507
539
|
return function onSave(_x3) {
|