@riil-frontend/component-topology 3.3.0 → 3.5.0-a.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.js +17 -17
  4. package/es/components/MultiResourceDrawer/index.js +2 -2
  5. package/es/components/NetworkTopoResourceSelectDrawer/NetworkTopoResourceSelectDrawer.js +9 -0
  6. package/es/components/NetworkTopoResourceSelectDrawer/index.js +2 -0
  7. package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -3
  8. package/es/components/ResourceSelectDrawer/ResourceSelectList.js +9 -6
  9. package/es/components/SingleResourceDrawer/SelectDrawer.js +1 -1
  10. package/es/constants/ResourceTypeLimit.js +38 -1
  11. package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +1 -1
  12. package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +29 -16
  13. package/es/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +0 -1
  14. package/es/core/editor/components/settings/propertyViews/index.js +1 -5
  15. package/es/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceDrawer.js +1 -1
  16. package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +2 -1
  17. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +29 -1
  18. package/es/core/models/TopoApp.js +1 -1
  19. package/es/core/models/utils/linkUtils.js +15 -16
  20. package/es/hooks/useTopoEdit.js +0 -5
  21. package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +12 -10
  22. package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +3 -4
  23. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +94 -59
  24. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +19 -15
  25. package/es/topoCenter/hooks/editor/useDeleteEdges.js +2 -0
  26. package/es/topoCenter/services/link.js +22 -14
  27. package/es/topoCenter/store/topoTreeMod.js +6 -19
  28. package/es/topoCenter/utils/linPermissionUtil.js +3 -4
  29. package/lib/components/MultiResourceDrawer/index.js +2 -2
  30. package/lib/components/NetworkTopoResourceSelectDrawer/NetworkTopoResourceSelectDrawer.js +20 -0
  31. package/lib/components/NetworkTopoResourceSelectDrawer/index.js +11 -0
  32. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -3
  33. package/lib/components/ResourceSelectDrawer/ResourceSelectList.js +10 -5
  34. package/lib/components/SingleResourceDrawer/SelectDrawer.js +2 -2
  35. package/lib/constants/ResourceTypeLimit.js +53 -2
  36. package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +2 -2
  37. package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +30 -15
  38. package/lib/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +0 -1
  39. package/lib/core/editor/components/settings/propertyViews/index.js +1 -5
  40. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceDrawer.js +2 -2
  41. package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +3 -2
  42. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +32 -1
  43. package/lib/core/models/TopoApp.js +1 -1
  44. package/lib/core/models/utils/linkUtils.js +13 -14
  45. package/lib/hooks/useTopoEdit.js +0 -5
  46. package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +16 -12
  47. package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +3 -4
  48. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +94 -59
  49. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +17 -16
  50. package/lib/topoCenter/hooks/editor/useDeleteEdges.js +2 -0
  51. package/lib/topoCenter/services/link.js +22 -14
  52. package/lib/topoCenter/store/topoTreeMod.js +7 -20
  53. package/lib/topoCenter/utils/linPermissionUtil.js +3 -4
  54. package/package.json +3 -3
@@ -51,6 +51,10 @@ function AddLinkDrawer(props) {
51
51
  lineData = props.lineData;
52
52
  var store = topo.store;
53
53
 
54
+ var _topo$store$useModel = topo.store.useModel("topoMod"),
55
+ topoState = _topo$store$useModel[0],
56
+ topoDispatchers = _topo$store$useModel[1];
57
+
54
58
  var _store$useModel = store.useModel("topoConfig"),
55
59
  editState = _store$useModel[0],
56
60
  editDispatchers = _store$useModel[1];
@@ -61,8 +65,6 @@ function AddLinkDrawer(props) {
61
65
 
62
66
  var addLinkIsOpen = editState.addLinkIsOpen,
63
67
  currentLink = editState.currentLink;
64
- var ciConnectable = linkState.ciConnectable; // // rlog.debug("addLinkDrawer--init-addLinkIsOpen", addLinkIsOpen, currentLink);
65
- // const [visible, { setTrue, setFalse }] = useBoolean();
66
68
 
67
69
  var _useState = (0, _react.useState)(),
68
70
  link = _useState[0],
@@ -74,12 +76,16 @@ function AddLinkDrawer(props) {
74
76
 
75
77
  var _useState3 = (0, _react.useState)(false),
76
78
  loading = _useState3[0],
77
- setLoading = _useState3[1]; // 保存后更新拓扑图状态
79
+ setLoading = _useState3[1];
80
+
81
+ var _useState4 = (0, _react.useState)(),
82
+ sourceIFDoc = _useState4[0],
83
+ setSourceIFDoc = _useState4[1]; // 保存后更新拓扑图状态
78
84
 
79
85
 
80
- var _useState4 = (0, _react.useState)([]),
81
- ciIdsConnectable = _useState4[0],
82
- setCiIdsConnectable = _useState4[1];
86
+ var _useState5 = (0, _react.useState)([]),
87
+ ciIdsConnectable = _useState5[0],
88
+ setCiIdsConnectable = _useState5[1];
83
89
 
84
90
  var linkNodesRef = (0, _react.useRef)();
85
91
 
@@ -222,6 +228,7 @@ function AddLinkDrawer(props) {
222
228
 
223
229
  case 6:
224
230
  targetPorts = _context3.sent;
231
+ setSourceIFDoc(sourcePorts.portsDoc);
225
232
  connect_type = currentLink.attributes["network_link.connect_type"] === "exit" ? "exit" : "phy";
226
233
  setLink({
227
234
  source: {
@@ -249,7 +256,7 @@ function AddLinkDrawer(props) {
249
256
  })
250
257
  });
251
258
 
252
- case 9:
259
+ case 10:
253
260
  case "end":
254
261
  return _context3.stop();
255
262
  }
@@ -272,23 +279,17 @@ function AddLinkDrawer(props) {
272
279
 
273
280
  var getCiTypesConnectable = /*#__PURE__*/function () {
274
281
  var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
275
- var notifier, ciTypesConnectable, nodes, ciIds, ciNodes;
282
+ var ciTypesConnectable, nodes, ciIds, ciNodes;
276
283
  return _regenerator["default"].wrap(function _callee4$(_context4) {
277
284
  while (1) {
278
285
  switch (_context4.prev = _context4.next) {
279
286
  case 0:
280
- notifier = topo.view.topoClient.notifier; // rlog.debug("加载哪些ci类型可创建链路-getCiTypesConnectable");
281
- // 加载哪些ci类型可创建链路
282
-
283
- _context4.next = 3;
287
+ _context4.next = 2;
284
288
  return _topo["default"].networkLink.getCiTypesConnectable(_ResourceTypeLimit.RESOURCE_LIMIT_TYPES);
285
289
 
286
- case 3:
290
+ case 2:
287
291
  ciTypesConnectable = _context4.sent;
288
- nodes = (0, _htElementUtils.getNodes)(topo.getDataModel()); // rlog.debug("getCiTypesConnectable", nodes);
289
- // const tags = topo.getTag();
290
- // rlog.debug("加载哪些ci类型可创建链路", ciTypesConnectable, topo, nodes);
291
-
292
+ nodes = (0, _htElementUtils.getNodes)(topo.getDataModel());
292
293
  ciIds = [];
293
294
  ciNodes = [];
294
295
  nodes.map(function (node) {
@@ -304,7 +305,7 @@ function AddLinkDrawer(props) {
304
305
  setCiIdsConnectable(ciIds);
305
306
  return _context4.abrupt("return", ciNodes);
306
307
 
307
- case 11:
308
+ case 10:
308
309
  case "end":
309
310
  return _context4.stop();
310
311
  }
@@ -371,15 +372,7 @@ function AddLinkDrawer(props) {
371
372
  var htTopo = topo.getHtTopo();
372
373
  var _linkNodesRef$current = linkNodesRef.current,
373
374
  source = _linkNodesRef$current.source,
374
- target = _linkNodesRef$current.target; // rlog.debug(
375
- // "addLinkToGraph",
376
- // source,
377
- // source.getTag(),
378
- // target,
379
- // target.getTag(),
380
- // linkData,
381
- // htTopo
382
- // );
375
+ target = _linkNodesRef$current.target;
383
376
 
384
377
  try {
385
378
  // 获取两个节点间的连线数据列表
@@ -404,10 +397,7 @@ function AddLinkDrawer(props) {
404
397
  // rlog.debug("addLinkToGraph-exit-target", target, target.getTag());
405
398
  target.a("name", targetName);
406
399
  }
407
- } //console.log("选中", topo.getGraphView().dm().sm());
408
- //console.log("选中", topo.getDataModel().getDataByTag(linkData.id));
409
- // TODO 选中
410
-
400
+ }
411
401
 
412
402
  topo.getGraphView().dm().sm().ss(topo.getDataModel().getDataByTag(linkData.id));
413
403
  } catch (error) {
@@ -415,16 +405,43 @@ function AddLinkDrawer(props) {
415
405
  }
416
406
  };
417
407
 
408
+ var mergeExitLinkData = function mergeExitLinkData(data, attributes) {
409
+ return {
410
+ id: data.id,
411
+ name: data.name,
412
+ source: data["network_link.source_device_id"],
413
+ target: data["network_link.destination_device_id"],
414
+ operation: data.operation,
415
+ interfaceSource: data["source_id"],
416
+ interfaceTarget: data["destination_id"],
417
+ ciType: data.ciType,
418
+ attributes: (0, _extends2["default"])({}, attributes, {
419
+ display_name: data.display_name,
420
+ name: data.name,
421
+ "network_link.actual_bandwidth": data["network_link.actual_bandwidth"],
422
+ "network_link.connect_type": data["network_link.connect_type"],
423
+ "network_link.destination_ipv4": data["network_link.destination_ipv4"],
424
+ "network_link.source_device_id": data["network_link.source_device_id"],
425
+ source_id: data.source_id,
426
+ support_templates: data.support_templates,
427
+ use: data.use,
428
+ source_id_object: {
429
+ displayName: sourceIFDoc[data.source_id].label
430
+ }
431
+ })
432
+ };
433
+ };
434
+
418
435
  var onSave = /*#__PURE__*/function () {
419
436
  var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
420
- var parm, result, config, exportLinkIdList, _yield$editDispatcher, elements, linkData, linkType;
437
+ var parm, result, linkType, config, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target, links, linkAttrKey, newLinkData, newLinks, newData;
421
438
 
422
439
  return _regenerator["default"].wrap(function _callee5$(_context5) {
423
440
  while (1) {
424
441
  switch (_context5.prev = _context5.next) {
425
442
  case 0:
426
443
  //editDispatchers.update({ addLinkIsOpen: false });
427
- // rlog.debug("保存链路信息", data);
444
+ // rlog.debug("保存链路信息", isAddMode, data);
428
445
  setLoading(true);
429
446
  parm = {
430
447
  attributes: data
@@ -453,23 +470,19 @@ function AddLinkDrawer(props) {
453
470
  result = _context5.sent;
454
471
 
455
472
  case 13:
456
- setLoading(false); // if (result) {
457
- // Message.success("保存成功");
458
- // }
459
-
460
- _context5.prev = 14;
473
+ setLoading(false);
474
+ linkType = data["network_link.connect_type"];
475
+ _context5.prev = 15;
461
476
 
462
477
  if (!result) {
463
- _context5.next = 36;
478
+ _context5.next = 35;
464
479
  break;
465
480
  }
466
481
 
467
- config = topo.resourceConfig.getConfigFromHt(); // rlog.debug("getConfigFromHt", config, topo.resourceConfig);
468
-
469
- console.log("save success", data, result); // 新建后显示到图上
482
+ config = topo.resourceConfig.getConfigFromHt(); // 新建后显示到图上
470
483
 
471
484
  if (!isAddMode) {
472
- _context5.next = 33;
485
+ _context5.next = 31;
473
486
  break;
474
487
  }
475
488
 
@@ -481,7 +494,8 @@ function AddLinkDrawer(props) {
481
494
 
482
495
  topo.resourceConfig.updateConfig((0, _extends2["default"])({}, config, {
483
496
  exportLinkIdList: exportLinkIdList
484
- }));
497
+ })); // const linkType = data["network_link.connect_type"];
498
+
485
499
  _context5.next = 24;
486
500
  return editDispatchers.fetchDataByConfig();
487
501
 
@@ -491,46 +505,67 @@ function AddLinkDrawer(props) {
491
505
  linkData = elements.find(function (element) {
492
506
  return element.id === result;
493
507
  });
494
- linkType = data["network_link.connect_type"];
495
508
  addLinkToGraph({
496
509
  linkData: (0, _copyUtil.clone)(linkData),
497
510
  linkType: linkType,
498
511
  targetName: data["network_link.destination_ipv4"]
499
512
  });
500
513
 
501
- if (data["network_link.connect_type"] === "exit") {
502
- console.log("save success--- data, elements", data, elements);
503
- }
504
-
505
514
  _message["default"].success("创建成功");
506
515
 
507
- _context5.next = 34;
516
+ _context5.next = 33;
508
517
  break;
509
518
 
510
- case 33:
519
+ case 31:
520
+ // console.log("保存编辑信息", data, linkType);
521
+ if (linkType === "exit") {
522
+ edge = topo.getGraphView().dm().sm().ld();
523
+ aobj = edge.getAttrObject();
524
+ edge.setAttrObject((0, _extends2["default"])({}, aobj, data));
525
+ target = edge.getTarget();
526
+
527
+ if (target.getTag() === undefined) {
528
+ target.a("name", data["network_link.destination_ipv4"]);
529
+ }
530
+
531
+ links = topoState.data.links;
532
+ linkAttrKey = links.findIndex(function (item) {
533
+ return item.id === aobj.id;
534
+ });
535
+ newLinkData = mergeExitLinkData(edge.getAttrObject(), links[linkAttrKey]);
536
+ newLinks = (0, _copyUtil.clone)(links);
537
+ newLinks.splice(linkAttrKey, 1, newLinkData);
538
+ newData = (0, _extends2["default"])({}, topoState.data, {
539
+ links: newLinks
540
+ });
541
+ topoDispatchers.update({
542
+ data: newData
543
+ });
544
+ }
545
+
511
546
  _message["default"].success("保存成功");
512
547
 
513
- case 34:
548
+ case 33:
514
549
  editDispatchers.update({
515
550
  addLinkIsOpen: false,
516
551
  currentLink: null
517
552
  });
518
553
  topo.linkDynamicStyleExecutor.execute();
519
554
 
520
- case 36:
521
- _context5.next = 40;
555
+ case 35:
556
+ _context5.next = 39;
522
557
  break;
523
558
 
524
- case 38:
525
- _context5.prev = 38;
526
- _context5.t0 = _context5["catch"](14);
559
+ case 37:
560
+ _context5.prev = 37;
561
+ _context5.t0 = _context5["catch"](15);
527
562
 
528
- case 40:
563
+ case 39:
529
564
  case "end":
530
565
  return _context5.stop();
531
566
  }
532
567
  }
533
- }, _callee5, null, [[14, 38]]);
568
+ }, _callee5, null, [[15, 37]]);
534
569
  }));
535
570
 
536
571
  return function onSave(_x3) {
@@ -88,9 +88,7 @@ function EditLinkInfo(props) {
88
88
  setConnectEnable = _useState4[1];
89
89
 
90
90
  var fieldOnChange = function fieldOnChange(name, value) {
91
- var newValues = field.getValues();
92
-
93
- _rlog["default"].debug("Field-onChange", newValues, name, value);
91
+ var newValues = field.getValues(); // rlog.debug("Field-onChange", newValues, name, value);
94
92
 
95
93
  setValus(newValues);
96
94
  };
@@ -140,7 +138,6 @@ function EditLinkInfo(props) {
140
138
  };
141
139
 
142
140
  var connectHandleChange = function connectHandleChange(v) {
143
- console.log("connectHandleChange", v);
144
141
  field.setValue("connect_type", v);
145
142
  };
146
143
 
@@ -158,9 +155,8 @@ function EditLinkInfo(props) {
158
155
  actualBandwidth = Math.min(sourceRb, targetRb);
159
156
  } else {
160
157
  actualBandwidth = sourceRb || targetRb;
161
- }
158
+ } // rlog.debug("network_link.actual_bandwidth", actualBandwidth);
162
159
 
163
- _rlog["default"].debug("network_link.actual_bandwidth", actualBandwidth);
164
160
 
165
161
  field.setValue("network_link.actual_bandwidth", actualBandwidth);
166
162
  };
@@ -170,7 +166,7 @@ function EditLinkInfo(props) {
170
166
  if (errors) {
171
167
  _rlog["default"].debug("saveHandleChange-error", errors, values);
172
168
  } else {
173
- var _valus$destination_id, _sourceValue$portsDoc3, _sourceValue$portsDoc4, _targetValue$portsDoc3, _targetValue$portsDoc4, _sourceValue$ipAddres, _targetValue$ipAddres, _targetValue$id;
169
+ var _valus$destination_id, _sourceValue$portsDoc3, _sourceValue$portsDoc4, _targetValue$portsDoc3, _targetValue$portsDoc4, _targetValue$ipAddres, _sourceValue$ipAddres, _targetValue$id;
174
170
 
175
171
  _rlog["default"].debug("saveHandleChange", valus, source, target);
176
172
 
@@ -178,7 +174,8 @@ function EditLinkInfo(props) {
178
174
  var destinationId = (_valus$destination_id = valus["destination_id"]) !== null && _valus$destination_id !== void 0 ? _valus$destination_id : "";
179
175
  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 : "";
180
176
  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 : "";
181
- var typeJudge = linkTypeJudge(sourceType, destinationType, valus["connect_type"]);
177
+ var typeJudge = linkTypeJudge(sourceType, destinationType, valus["network_link.connect_type"]);
178
+ var destination_ipv4 = valus["network_link.connect_type"] !== "exit" ? (_targetValue$ipAddres = targetValue.ipAddress) !== null && _targetValue$ipAddres !== void 0 ? _targetValue$ipAddres : valus["network_link.destination_ipv4"] : valus["network_link.destination_ipv4"];
182
179
  var obj = {
183
180
  display_name: valus["display_name"],
184
181
  // 链路名称
@@ -186,7 +183,7 @@ function EditLinkInfo(props) {
186
183
  // 链路名称
187
184
  "network_link.source_ipv4": (_sourceValue$ipAddres = sourceValue.ipAddress) !== null && _sourceValue$ipAddres !== void 0 ? _sourceValue$ipAddres : valus["network_link.source_ipv4"],
188
185
  // 源IP
189
- "network_link.destination_ipv4": (_targetValue$ipAddres = targetValue.ipAddress) !== null && _targetValue$ipAddres !== void 0 ? _targetValue$ipAddres : valus["network_link.destination_ipv4"],
186
+ "network_link.destination_ipv4": destination_ipv4,
190
187
  // 目的IP
191
188
  // source_id, // 源端口
192
189
  // destination_id, // 目的端口
@@ -255,6 +252,16 @@ function EditLinkInfo(props) {
255
252
  });
256
253
  };
257
254
 
255
+ var targetIpComp = function targetIpComp(targetValue) {
256
+ return targetValue.ipAddress && targetValue.ciType !== "customNode" ? /*#__PURE__*/_react["default"].createElement("div", {
257
+ className: _indexModule["default"].label
258
+ }, targetValue.ipAddress) : /*#__PURE__*/_react["default"].createElement(_input["default"], {
259
+ placeholder: "\u8BF7\u8F93\u5165",
260
+ name: "network_link.destination_ipv4",
261
+ maxLength: 128
262
+ });
263
+ };
264
+
258
265
  return /*#__PURE__*/_react["default"].createElement("div", {
259
266
  className: _indexModule["default"].editForm
260
267
  }, /*#__PURE__*/_react["default"].createElement(_form["default"], {
@@ -293,13 +300,7 @@ function EditLinkInfo(props) {
293
300
  }, /*#__PURE__*/_react["default"].createElement(FormItem, (0, _extends2["default"])({}, formItemLayout, {
294
301
  labelAlign: labelAlign,
295
302
  label: "\u76EE\u7684\u8282\u70B9IP"
296
- }), targetValue.ipAddress ? /*#__PURE__*/_react["default"].createElement("div", {
297
- className: _indexModule["default"].label
298
- }, targetValue.ipAddress) : /*#__PURE__*/_react["default"].createElement(_input["default"], {
299
- placeholder: "\u8BF7\u8F93\u5165",
300
- name: "network_link.destination_ipv4",
301
- maxLength: 128
302
- })))), /*#__PURE__*/_react["default"].createElement(Row, {
303
+ }), targetIpComp(target)))), /*#__PURE__*/_react["default"].createElement(Row, {
303
304
  gutter: "16"
304
305
  }, /*#__PURE__*/_react["default"].createElement(Col, {
305
306
  span: "12"
@@ -182,6 +182,8 @@ var _default = function _default(_ref) {
182
182
  } else {
183
183
  htTopo.deleteEdge(edge);
184
184
  }
185
+
186
+ topo.linkDynamicStyleExecutor.execute();
185
187
  };
186
188
 
187
189
  var deleteEdges = function deleteEdges(edges) {
@@ -163,42 +163,50 @@ var _default = {
163
163
  *
164
164
  * @param {array} ciIds
165
165
  */
166
- queryAssociatedlinks: function queryAssociatedlinks(ids) {
166
+ queryAssociatedlinks: function queryAssociatedlinks(ids, type) {
167
167
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
168
- var idtxt, parm, jsonParm, result;
168
+ var stag, ttag, condition, parm, jsonParm, result;
169
169
  return _regenerator["default"].wrap(function _callee5$(_context5) {
170
170
  while (1) {
171
171
  switch (_context5.prev = _context5.next) {
172
172
  case 0:
173
- idtxt = "'" + ids[0] + "','" + ids[1] + "'";
173
+ // const idtxt = `'${ids[0]}','${ids[1]}'`;
174
+ stag = ids[0];
175
+ ttag = ids[1];
176
+ condition = "type('network_link') && network_link.connect_type = 'exit' && network_link.source_device_id ='" + stag + "'";
177
+
178
+ if (ttag) {
179
+ condition = "type('network_link') && network_link.connect_type = 'exit' && network_link.source_device_id ='" + stag + "' && network_link.destination_device_id='" + ttag + "'";
180
+ }
181
+
174
182
  parm = {
175
- condition: "type('network_link') && network_link.connect_type = 'exit' && network_link.source_device_id in [" + idtxt + "]",
183
+ condition: condition,
176
184
  sort: "name asc",
177
185
  currentPage: 1,
178
- pageSize: 20
186
+ pageSize: 99
179
187
  };
180
188
  jsonParm = JSON.stringify(parm);
181
- console.log("queryAssociatedlinks", ids, idtxt, parm, jsonParm);
182
- _context5.prev = 4;
183
- _context5.next = 7;
189
+ console.log("queryAssociatedlinks", ids, parm, jsonParm);
190
+ _context5.prev = 7;
191
+ _context5.next = 10;
184
192
  return (0, _componentTopologyCommon.getRequest)().post("/mdc/v1/api/cmdb/commonQueryCiData", jsonParm);
185
193
 
186
- case 7:
194
+ case 10:
187
195
  result = _context5.sent;
188
196
  return _context5.abrupt("return", result);
189
197
 
190
- case 11:
191
- _context5.prev = 11;
192
- _context5.t0 = _context5["catch"](4);
198
+ case 14:
199
+ _context5.prev = 14;
200
+ _context5.t0 = _context5["catch"](7);
193
201
 
194
202
  _rlog["default"].error("查询可关联链路", _context5.t0);
195
203
 
196
- case 14:
204
+ case 17:
197
205
  case "end":
198
206
  return _context5.stop();
199
207
  }
200
208
  }
201
- }, _callee5, null, [[4, 11]]);
209
+ }, _callee5, null, [[7, 14]]);
202
210
  }))();
203
211
  }
204
212
  };
@@ -7,6 +7,8 @@ exports["default"] = _default;
7
7
 
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
 
10
+ var _message = _interopRequireDefault(require("@alifd/next/lib/message"));
11
+
10
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
13
 
12
14
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
@@ -15,8 +17,6 @@ var _topo = _interopRequireDefault(require("@riil-frontend/component-topology-co
15
17
 
16
18
  var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
17
19
 
18
- var _topoMocks = require("../../utils/topoMocks");
19
-
20
20
  var _tree = require("../../utils/tree");
21
21
 
22
22
  var clone = function clone(data) {
@@ -33,7 +33,6 @@ function _default(topoApp) {
33
33
  treeData: [],
34
34
  // 是否加载数据
35
35
  loaded: false,
36
- topoInteData: _topoMocks.topoInteData,
37
36
  selectedNode: [],
38
37
  defId: '',
39
38
  drawVisible: false,
@@ -280,25 +279,13 @@ function _default(topoApp) {
280
279
 
281
280
  case 4:
282
281
  resTreeData = _context5.sent;
282
+ _context5.next = 7;
283
+ return _this4.refreshTree();
283
284
 
284
- _this4.refreshTree(); // let treeData = clone(state.topoTreeMod.treeData);
285
- // loopTree(
286
- // treeData,
287
- // conditions,
288
- // (parent, index, arr) => {
289
- // arr[index].showDefault = true;
290
- // }
291
- // );
292
- //
293
- // treeData = formatTree(treeData, state.functionAuth.permissions);
294
- //
295
- // this.update({
296
- // treeData,
297
- // defId: conditions,
298
- // });
299
-
285
+ case 7:
286
+ _message["default"].success('设置成功');
300
287
 
301
- case 6:
288
+ case 8:
302
289
  case "end":
303
290
  return _context5.stop();
304
291
  }
@@ -23,14 +23,13 @@ var isWriteable = function isWriteable(link, source, target, linkType) {
23
23
 
24
24
  function getLinkPermission(edge, nodes, link) {
25
25
  var source = nodes.find(function (node) {
26
- return node.id === edge.source;
26
+ return node.id === edge.getSource().getTag();
27
27
  });
28
28
  var target = nodes.find(function (node) {
29
- return node.id === edge.target;
29
+ return node.id === edge.getTarget().getTag();
30
30
  }); // console.log("getLinkPermission", edge, source, target, link);
31
31
 
32
- var linkType = link.attributes["network_link.connect_type"]; //TODO 这里的逻辑因为 出口链路 可能需要调整
33
-
32
+ var linkType = link ? link.attributes["network_link.connect_type"] : edge.a("network_link.connect_type");
34
33
  return {
35
34
  readable: (source === null || source === void 0 ? void 0 : source.operation) || (target === null || target === void 0 ? void 0 : target.operation),
36
35
  writeable: isWriteable(edge, source, target, linkType),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "3.3.0",
3
+ "version": "3.5.0-a.1",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -68,7 +68,7 @@
68
68
  "@riil-frontend/component-table-filter-tags": "latest",
69
69
  "@riil-frontend/component-table-layout": "^2.0.2",
70
70
  "@riil-frontend/component-topology-common": "^1.0.9",
71
- "@riil-frontend/component-topology-graph": "^2.6.0",
71
+ "@riil-frontend/component-topology-graph": "^2.7.0-a.1",
72
72
  "@riil-frontend/css": "^2.0.2",
73
73
  "@riil-frontend/hooks": "latest",
74
74
  "@riil-frontend/next-collapse": "^1.0.1-a.0",
@@ -110,6 +110,6 @@
110
110
  "access": "public"
111
111
  },
112
112
  "license": "MIT",
113
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@3.3.0/build/index.html",
113
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@3.5.0-a.1/build/index.html",
114
114
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
115
115
  }