@riil-frontend/component-topology 5.0.0-alpha.11 → 5.0.0-alpha.13

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.
@@ -21,7 +21,7 @@ import PluginManager from "./PluginManager";
21
21
  import topoFactory from "./topoFactory";
22
22
  import ElementTagTipConfig from "./tagstips/ElementTagTipConfig"; // eslint-disable-next-line no-undef
23
23
 
24
- var version = typeof "5.0.0-alpha.11" === 'string' ? "5.0.0-alpha.11" : null;
24
+ var version = typeof "5.0.0-alpha.13" === 'string' ? "5.0.0-alpha.13" : null;
25
25
  console.info("\u62D3\u6251\u7248\u672C: " + version);
26
26
  /**
27
27
  * 拓扑显示和编辑
@@ -337,7 +337,7 @@ export default function (topoApp) {
337
337
 
338
338
  topoApp.options.onLoadStart(); // TODO 待移到拓扑中心
339
339
 
340
- permission = "write";
340
+ permission = "none";
341
341
 
342
342
  if (!topoApp.options.usePermission) {
343
343
  _context6.next = 18;
@@ -617,31 +617,6 @@ export default function (topoApp) {
617
617
  rlog.error("\u67E5\u8BE2\u62D3\u6251" + id + "\u7684\u6743\u9650\u5931\u8D25", _context11.t0); // 尚未区分拓扑图不存在还是接口请求报错
618
618
 
619
619
  case 10:
620
- if (!topoPermission) {
621
- _context11.next = 19;
622
- break;
623
- }
624
-
625
- _context11.next = 13;
626
- return dispatch.functionAuth.checkAuth('createTopo');
627
-
628
- case 13:
629
- if (!_context11.sent) {
630
- _context11.next = 17;
631
- break;
632
- }
633
-
634
- _context11.t1 = 'delete';
635
- _context11.next = 18;
636
- break;
637
-
638
- case 17:
639
- _context11.t1 = 'read';
640
-
641
- case 18:
642
- topoPermission = _context11.t1;
643
-
644
- case 19:
645
620
  if (update !== false) {
646
621
  _this8.update({
647
622
  topoPermission: topoPermission
@@ -650,7 +625,7 @@ export default function (topoApp) {
650
625
 
651
626
  return _context11.abrupt("return", topoPermission);
652
627
 
653
- case 21:
628
+ case 12:
654
629
  case "end":
655
630
  return _context11.stop();
656
631
  }
@@ -205,7 +205,7 @@ function ResourceDetail(props) {
205
205
  data: resourceData,
206
206
  topo: topo
207
207
  }),
208
- visible: (_topo$viewProps = topo.viewProps) === null || _topo$viewProps === void 0 ? void 0 : (_topo$viewProps$viewe = _topo$viewProps.viewerProps) === null || _topo$viewProps$viewe === void 0 ? void 0 : (_topo$viewProps$viewe2 = _topo$viewProps$viewe.topoContext) === null || _topo$viewProps$viewe2 === void 0 ? void 0 : _topo$viewProps$viewe2.isNetworkTopo
208
+ visible: activeData.type === 'node' && ((_topo$viewProps = topo.viewProps) === null || _topo$viewProps === void 0 ? void 0 : (_topo$viewProps$viewe = _topo$viewProps.viewerProps) === null || _topo$viewProps$viewe === void 0 ? void 0 : (_topo$viewProps$viewe2 = _topo$viewProps$viewe.topoContext) === null || _topo$viewProps$viewe2 === void 0 ? void 0 : _topo$viewProps$viewe2.isNetworkTopo)
209
209
  }].filter(function (item) {
210
210
  return item.visible !== false;
211
211
  });
@@ -2,7 +2,7 @@ import _Box from "@alifd/next/es/box";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import React from "react";
4
4
  import EditButton from "./widgets/EditButton";
5
- import NodesDragSwitch from "./widgets/NodesDragSwitch";
5
+ import NodesDragSwitch from "./widgets/NodesDragSwitchWrapper";
6
6
  import AlarmListShowButton from "./widgets/AlarmListShowButton";
7
7
  import SettingButton from "./widgets/SettingButtonWidget";
8
8
  import useEventData from "../../../hooks/useEventData";
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import NodesDragSwitch from "./NodesDragSwitch";
3
+ import topoPermissonUtil from "../../../../../utils/topoPermissionUtil";
4
+ export default function NodesDragSwitchWrapper(props) {
5
+ var topo = props.topo;
6
+ var store = topo.store;
7
+
8
+ var _store$useModel = store.useModel('topoMod'),
9
+ topoState = _store$useModel[0];
10
+
11
+ var topoPermission = topoState.topoPermission;
12
+
13
+ if (!topoPermissonUtil.isEditable(topoPermission)) {
14
+ return null;
15
+ }
16
+
17
+ return /*#__PURE__*/React.createElement(NodesDragSwitch, props);
18
+ }
@@ -63,6 +63,23 @@ export default function EditLinkInfo(props) {
63
63
  var fieldOnChange = function fieldOnChange(name, value) {
64
64
  var newValues = field.getValues();
65
65
  rlog.debug("Field-onChange", newValues, name, value);
66
+
67
+ if (isAdd && sourceValue.portsDoc[newValues["source_id"]] && targetValue.portsDoc[newValues["destination_id"]]) {
68
+ var obj = {
69
+ 'FastEthernet': 'Fa',
70
+ 'GigabitEthernet': 'Gi',
71
+ 'TwoGigabitEthernet': 'Tw',
72
+ 'FiveGigabitEthernet': 'Fi',
73
+ 'TenGigabitEthernet': 'Te',
74
+ 'TwentyFiveGigE': 'Twe',
75
+ 'FortyGigabitEthernet': 'Fo',
76
+ 'XGigabitEthernet': 'Te',
77
+ 'Ten-GigabitEthernet': 'Te'
78
+ };
79
+ var str = newValues['network_link.source_ipv4 '] + '(' + obj[sourceValue.portsDoc[newValues["source_id"]].label.split(' ')[0]] + ' ' + sourceValue.portsDoc[newValues["source_id"]].label.split(' ')[1] + ') - ' + newValues['network_link.destination_ipv4 '] + '(' + obj[targetValue.portsDoc[newValues["destination_id"]].label.split(' ')[0]] + ' ' + targetValue.portsDoc[newValues["destination_id"]].label.split(' ')[1] + ')';
80
+ field.setValue('display_name', str);
81
+ }
82
+
66
83
  setValus(newValues);
67
84
  };
68
85
 
@@ -122,6 +139,7 @@ export default function EditLinkInfo(props) {
122
139
  var targetId = nowValues["destination_id"];
123
140
  var sourceRb = (_sourceValue$portsDoc = (_sourceValue$portsDoc2 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc2 === void 0 ? void 0 : _sourceValue$portsDoc2.ratedBandwidth) !== null && _sourceValue$portsDoc !== void 0 ? _sourceValue$portsDoc : 0;
124
141
  var targetRb = (_targetValue$portsDoc = (_targetValue$portsDoc2 = targetValue.portsDoc[targetId]) === null || _targetValue$portsDoc2 === void 0 ? void 0 : _targetValue$portsDoc2.ratedBandwidth) !== null && _targetValue$portsDoc !== void 0 ? _targetValue$portsDoc : 0;
142
+ console.log(sourceRb, targetRb, 'sourceRbQZQ');
125
143
  var actualBandwidth = 0;
126
144
 
127
145
  if (sourceRb && targetRb) {
@@ -38,37 +38,18 @@ export default function (topoApp) {
38
38
  var _this = this;
39
39
 
40
40
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
41
- var id, showAllTree, resTreeData, _formatTree, treeData, defId, selectedTopoId;
41
+ var id, resTreeData, _formatTree, treeData, defId, selectedTopoId;
42
42
 
43
43
  return _regeneratorRuntime.wrap(function _callee$(_context) {
44
44
  while (1) {
45
45
  switch (_context.prev = _context.next) {
46
46
  case 0:
47
- id = payload.id; // 拓扑中心 如果有管理导航树权限,展示完整拓扑树
47
+ id = payload.id;
48
+ _context.next = 3;
49
+ return _this.getTopoTree();
48
50
 
49
- showAllTree = topoApp.options.full && rootState.functionAuth.permissions.manageNavTree;
50
-
51
- if (!showAllTree) {
52
- _context.next = 8;
53
- break;
54
- }
55
-
56
- _context.next = 5;
57
- return topoService.getTopoTree();
58
-
59
- case 5:
51
+ case 3:
60
52
  resTreeData = _context.sent;
61
- _context.next = 11;
62
- break;
63
-
64
- case 8:
65
- _context.next = 10;
66
- return topoService.getTopoTreeByLoginUser();
67
-
68
- case 10:
69
- resTreeData = _context.sent;
70
-
71
- case 11:
72
53
  // 格式化tree数据
73
54
  _formatTree = formatTree(resTreeData, rootState.functionAuth.permissions), treeData = _formatTree[0], defId = _formatTree[1]; // 选中上次选择或指定的,如无则选中默认
74
55
 
@@ -83,7 +64,7 @@ export default function (topoApp) {
83
64
  }); // console.log('resTreeData', resTreeData, rootState.topoMod.topoId);
84
65
 
85
66
 
86
- case 14:
67
+ case 7:
87
68
  case "end":
88
69
  return _context.stop();
89
70
  }
@@ -91,24 +72,65 @@ export default function (topoApp) {
91
72
  }, _callee);
92
73
  }))();
93
74
  },
75
+ getTopoTree: function getTopoTree(payload, rootState) {
76
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
77
+ var showAllTree, resTreeData;
78
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
79
+ while (1) {
80
+ switch (_context2.prev = _context2.next) {
81
+ case 0:
82
+ // 拓扑中心 如果有管理导航树权限,展示完整拓扑树
83
+ showAllTree = topoApp.options.full && rootState.functionAuth.permissions.manageNavTree;
84
+
85
+ if (!showAllTree) {
86
+ _context2.next = 7;
87
+ break;
88
+ }
89
+
90
+ _context2.next = 4;
91
+ return topoService.getTopoTree();
92
+
93
+ case 4:
94
+ resTreeData = _context2.sent;
95
+ _context2.next = 10;
96
+ break;
97
+
98
+ case 7:
99
+ _context2.next = 9;
100
+ return topoService.getTopoTreeByLoginUser();
101
+
102
+ case 9:
103
+ resTreeData = _context2.sent;
104
+
105
+ case 10:
106
+ return _context2.abrupt("return", resTreeData);
107
+
108
+ case 11:
109
+ case "end":
110
+ return _context2.stop();
111
+ }
112
+ }
113
+ }, _callee2);
114
+ }))();
115
+ },
94
116
  getSelectedTopoId: function getSelectedTopoId(payload, rootState) {
95
117
  return rootState.topoTreeMod.selectedNode[0];
96
118
  },
97
119
  refreshTree: function refreshTree(payload, rootState) {
98
120
  var _this2 = this;
99
121
 
100
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
122
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
101
123
  var resTreeData, _formatTree2, treeData, defId;
102
124
 
103
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
125
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
104
126
  while (1) {
105
- switch (_context2.prev = _context2.next) {
127
+ switch (_context3.prev = _context3.next) {
106
128
  case 0:
107
- _context2.next = 2;
108
- return topoServer.getTopoTree();
129
+ _context3.next = 2;
130
+ return _this2.getTopoTree();
109
131
 
110
132
  case 2:
111
- resTreeData = _context2.sent;
133
+ resTreeData = _context3.sent;
112
134
  // 格式化tree数据
113
135
  _formatTree2 = formatTree(resTreeData, rootState.functionAuth.permissions), treeData = _formatTree2[0], defId = _formatTree2[1];
114
136
 
@@ -120,31 +142,31 @@ export default function (topoApp) {
120
142
 
121
143
  case 5:
122
144
  case "end":
123
- return _context2.stop();
145
+ return _context3.stop();
124
146
  }
125
147
  }
126
- }, _callee2);
148
+ }, _callee3);
127
149
  }))();
128
150
  },
129
151
  editTopoOnTree: function editTopoOnTree(conditions, state) {
130
152
  var _this3 = this;
131
153
 
132
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
154
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
133
155
  var resTreeData, treeData;
134
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
156
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
135
157
  while (1) {
136
- switch (_context3.prev = _context3.next) {
158
+ switch (_context4.prev = _context4.next) {
137
159
  case 0:
138
160
  if (conditions === void 0) {
139
161
  conditions = {};
140
162
  }
141
163
 
142
164
  rlog.debug('editTopoOnTree', conditions);
143
- _context3.next = 4;
144
- return topoServer.editTopoonTree(parseInt(conditions.id, 10), conditions.name, conditions.type);
165
+ _context4.next = 4;
166
+ return topoService.editTopoonTree(parseInt(conditions.id, 10), conditions.name, conditions.type);
145
167
 
146
168
  case 4:
147
- resTreeData = _context3.sent;
169
+ resTreeData = _context4.sent;
148
170
  treeData = clone(state.topoTreeMod.treeData);
149
171
 
150
172
  if (resTreeData) {
@@ -166,10 +188,10 @@ export default function (topoApp) {
166
188
 
167
189
  case 7:
168
190
  case "end":
169
- return _context3.stop();
191
+ return _context4.stop();
170
192
  }
171
193
  }
172
- }, _callee3);
194
+ }, _callee4);
173
195
  }))();
174
196
  },
175
197
 
@@ -201,34 +223,34 @@ export default function (topoApp) {
201
223
  * @param {*} state
202
224
  */
203
225
  deleteTopoOnTree: function deleteTopoOnTree(conditions, state) {
204
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
226
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
205
227
  var currentTopoId, isDeleteCurrentP;
206
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
228
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
207
229
  while (1) {
208
- switch (_context4.prev = _context4.next) {
230
+ switch (_context5.prev = _context5.next) {
209
231
  case 0:
210
232
  rlog.debug('deleteTopoOnTree', conditions, state, dispatch.topoMod);
211
233
  currentTopoId = state.topoMod.topoId;
212
234
 
213
235
  if (!("" + conditions === "" + currentTopoId)) {
214
- _context4.next = 13;
236
+ _context5.next = 13;
215
237
  break;
216
238
  }
217
239
 
218
240
  rlog.debug('deleteTopo-currentTopo', conditions);
219
- _context4.next = 6;
241
+ _context5.next = 6;
220
242
  return dispatch.topoMod.updateDelId("" + conditions);
221
243
 
222
244
  case 6:
223
- _context4.next = 8;
245
+ _context5.next = 8;
224
246
  return topoApp.alarm.close();
225
247
 
226
248
  case 8:
227
- _context4.next = 10;
228
- return topoServer.deleteTopoonTree(parseInt(conditions, 10));
249
+ _context5.next = 10;
250
+ return topoService.deleteTopoonTree(parseInt(conditions, 10));
229
251
 
230
252
  case 10:
231
- return _context4.abrupt("return", _context4.sent);
253
+ return _context5.abrupt("return", _context5.sent);
232
254
 
233
255
  case 13:
234
256
  // 判断删除的拓扑或文件,是否包含当前拓扑,如果包含就先关闭告警
@@ -240,48 +262,48 @@ export default function (topoApp) {
240
262
  });
241
263
 
242
264
  if (!isDeleteCurrentP) {
243
- _context4.next = 18;
265
+ _context5.next = 18;
244
266
  break;
245
267
  }
246
268
 
247
- _context4.next = 18;
269
+ _context5.next = 18;
248
270
  return topoApp.alarm.close();
249
271
 
250
272
  case 18:
251
- _context4.next = 20;
252
- return topoServer.deleteTopoonTree(parseInt(conditions, 10));
273
+ _context5.next = 20;
274
+ return topoService.deleteTopoonTree(parseInt(conditions, 10));
253
275
 
254
276
  case 20:
255
- return _context4.abrupt("return", _context4.sent);
277
+ return _context5.abrupt("return", _context5.sent);
256
278
 
257
279
  case 21:
258
280
  case "end":
259
- return _context4.stop();
281
+ return _context5.stop();
260
282
  }
261
283
  }
262
- }, _callee4);
284
+ }, _callee5);
263
285
  }))();
264
286
  },
265
287
  setDefTopoOnTree: function setDefTopoOnTree(conditions, state) {
266
288
  var _this4 = this;
267
289
 
268
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
290
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
269
291
  var resTreeData;
270
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
292
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
271
293
  while (1) {
272
- switch (_context5.prev = _context5.next) {
294
+ switch (_context6.prev = _context6.next) {
273
295
  case 0:
274
296
  if (conditions === void 0) {
275
297
  conditions = {};
276
298
  }
277
299
 
278
300
  rlog.debug('setDefTopoOnTree', conditions);
279
- _context5.next = 4;
280
- return topoServer.setDefTopo(parseInt(conditions, 10));
301
+ _context6.next = 4;
302
+ return topoService.setDefTopo(parseInt(conditions, 10));
281
303
 
282
304
  case 4:
283
- resTreeData = _context5.sent;
284
- _context5.next = 7;
305
+ resTreeData = _context6.sent;
306
+ _context6.next = 7;
285
307
  return _this4.refreshTree();
286
308
 
287
309
  case 7:
@@ -289,10 +311,10 @@ export default function (topoApp) {
289
311
 
290
312
  case 8:
291
313
  case "end":
292
- return _context5.stop();
314
+ return _context6.stop();
293
315
  }
294
316
  }
295
- }, _callee5);
317
+ }, _callee6);
296
318
  }))();
297
319
  },
298
320
  setDefaultTopoId: function setDefaultTopoId(defaultTopoId) {
package/es/utils/tree.js CHANGED
@@ -40,9 +40,7 @@ export function formatTree(json, funcPermissions) {
40
40
  type: type,
41
41
  name: name,
42
42
  showDefault: showDefault,
43
- // permission: node.operation,
44
- // FIXME 拓扑数据权限临时方案,待移除
45
- permission: funcPermissions.createTopo ? 'delete' : 'read',
43
+ permission: node.operation,
46
44
  children: node !== null && node !== void 0 && node.children ? loop(node.children) : []
47
45
  };
48
46
  });
@@ -50,7 +50,7 @@ var _topoFactory = _interopRequireDefault(require("./topoFactory"));
50
50
  var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTagTipConfig"));
51
51
 
52
52
  // eslint-disable-next-line no-undef
53
- var version = typeof "5.0.0-alpha.11" === 'string' ? "5.0.0-alpha.11" : null;
53
+ var version = typeof "5.0.0-alpha.13" === 'string' ? "5.0.0-alpha.13" : null;
54
54
  console.info("\u62D3\u6251\u7248\u672C: " + version);
55
55
  /**
56
56
  * 拓扑显示和编辑
@@ -354,7 +354,7 @@ function _default(topoApp) {
354
354
 
355
355
  topoApp.options.onLoadStart(); // TODO 待移到拓扑中心
356
356
 
357
- permission = "write";
357
+ permission = "none";
358
358
 
359
359
  if (!topoApp.options.usePermission) {
360
360
  _context6.next = 18;
@@ -642,31 +642,6 @@ function _default(topoApp) {
642
642
 
643
643
 
644
644
  case 10:
645
- if (!topoPermission) {
646
- _context11.next = 19;
647
- break;
648
- }
649
-
650
- _context11.next = 13;
651
- return dispatch.functionAuth.checkAuth('createTopo');
652
-
653
- case 13:
654
- if (!_context11.sent) {
655
- _context11.next = 17;
656
- break;
657
- }
658
-
659
- _context11.t1 = 'delete';
660
- _context11.next = 18;
661
- break;
662
-
663
- case 17:
664
- _context11.t1 = 'read';
665
-
666
- case 18:
667
- topoPermission = _context11.t1;
668
-
669
- case 19:
670
645
  if (update !== false) {
671
646
  _this8.update({
672
647
  topoPermission: topoPermission
@@ -675,7 +650,7 @@ function _default(topoApp) {
675
650
 
676
651
  return _context11.abrupt("return", topoPermission);
677
652
 
678
- case 21:
653
+ case 12:
679
654
  case "end":
680
655
  return _context11.stop();
681
656
  }
@@ -230,7 +230,7 @@ function ResourceDetail(props) {
230
230
  data: resourceData,
231
231
  topo: topo
232
232
  }),
233
- visible: (_topo$viewProps = topo.viewProps) === null || _topo$viewProps === void 0 ? void 0 : (_topo$viewProps$viewe = _topo$viewProps.viewerProps) === null || _topo$viewProps$viewe === void 0 ? void 0 : (_topo$viewProps$viewe2 = _topo$viewProps$viewe.topoContext) === null || _topo$viewProps$viewe2 === void 0 ? void 0 : _topo$viewProps$viewe2.isNetworkTopo
233
+ visible: activeData.type === 'node' && ((_topo$viewProps = topo.viewProps) === null || _topo$viewProps === void 0 ? void 0 : (_topo$viewProps$viewe = _topo$viewProps.viewerProps) === null || _topo$viewProps$viewe === void 0 ? void 0 : (_topo$viewProps$viewe2 = _topo$viewProps$viewe.topoContext) === null || _topo$viewProps$viewe2 === void 0 ? void 0 : _topo$viewProps$viewe2.isNetworkTopo)
234
234
  }].filter(function (item) {
235
235
  return item.visible !== false;
236
236
  });
@@ -13,7 +13,7 @@ var _react = _interopRequireDefault(require("react"));
13
13
 
14
14
  var _EditButton = _interopRequireDefault(require("./widgets/EditButton"));
15
15
 
16
- var _NodesDragSwitch = _interopRequireDefault(require("./widgets/NodesDragSwitch"));
16
+ var _NodesDragSwitchWrapper = _interopRequireDefault(require("./widgets/NodesDragSwitchWrapper"));
17
17
 
18
18
  var _AlarmListShowButton = _interopRequireDefault(require("./widgets/AlarmListShowButton"));
19
19
 
@@ -45,7 +45,7 @@ function BasicTools(props) {
45
45
  }, props, {
46
46
  alarmPanelIsOpen: alarmPanelIsOpen,
47
47
  alarmData: alarmData
48
- })), /*#__PURE__*/_react["default"].createElement(_SettingButtonWidget["default"], props), /*#__PURE__*/_react["default"].createElement(_NodesDragSwitch["default"], (0, _extends2["default"])({
48
+ })), /*#__PURE__*/_react["default"].createElement(_SettingButtonWidget["default"], props), /*#__PURE__*/_react["default"].createElement(_NodesDragSwitchWrapper["default"], (0, _extends2["default"])({
49
49
  topo: topo
50
50
  }, props)), children);
51
51
  }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports["default"] = NodesDragSwitchWrapper;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _NodesDragSwitch = _interopRequireDefault(require("./NodesDragSwitch"));
11
+
12
+ var _topoPermissionUtil = _interopRequireDefault(require("../../../../../utils/topoPermissionUtil"));
13
+
14
+ function NodesDragSwitchWrapper(props) {
15
+ var topo = props.topo;
16
+ var store = topo.store;
17
+
18
+ var _store$useModel = store.useModel('topoMod'),
19
+ topoState = _store$useModel[0];
20
+
21
+ var topoPermission = topoState.topoPermission;
22
+
23
+ if (!_topoPermissionUtil["default"].isEditable(topoPermission)) {
24
+ return null;
25
+ }
26
+
27
+ return /*#__PURE__*/_react["default"].createElement(_NodesDragSwitch["default"], props);
28
+ }
@@ -91,6 +91,22 @@ function EditLinkInfo(props) {
91
91
 
92
92
  _rlog["default"].debug("Field-onChange", newValues, name, value);
93
93
 
94
+ if (isAdd && sourceValue.portsDoc[newValues["source_id"]] && targetValue.portsDoc[newValues["destination_id"]]) {
95
+ var obj = {
96
+ 'FastEthernet': 'Fa',
97
+ 'GigabitEthernet': 'Gi',
98
+ 'TwoGigabitEthernet': 'Tw',
99
+ 'FiveGigabitEthernet': 'Fi',
100
+ 'TenGigabitEthernet': 'Te',
101
+ 'TwentyFiveGigE': 'Twe',
102
+ 'FortyGigabitEthernet': 'Fo',
103
+ 'XGigabitEthernet': 'Te',
104
+ 'Ten-GigabitEthernet': 'Te'
105
+ };
106
+ var str = newValues['network_link.source_ipv4 '] + '(' + obj[sourceValue.portsDoc[newValues["source_id"]].label.split(' ')[0]] + ' ' + sourceValue.portsDoc[newValues["source_id"]].label.split(' ')[1] + ') - ' + newValues['network_link.destination_ipv4 '] + '(' + obj[targetValue.portsDoc[newValues["destination_id"]].label.split(' ')[0]] + ' ' + targetValue.portsDoc[newValues["destination_id"]].label.split(' ')[1] + ')';
107
+ field.setValue('display_name', str);
108
+ }
109
+
94
110
  setValus(newValues);
95
111
  };
96
112
 
@@ -150,6 +166,7 @@ function EditLinkInfo(props) {
150
166
  var targetId = nowValues["destination_id"];
151
167
  var sourceRb = (_sourceValue$portsDoc = (_sourceValue$portsDoc2 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc2 === void 0 ? void 0 : _sourceValue$portsDoc2.ratedBandwidth) !== null && _sourceValue$portsDoc !== void 0 ? _sourceValue$portsDoc : 0;
152
168
  var targetRb = (_targetValue$portsDoc = (_targetValue$portsDoc2 = targetValue.portsDoc[targetId]) === null || _targetValue$portsDoc2 === void 0 ? void 0 : _targetValue$portsDoc2.ratedBandwidth) !== null && _targetValue$portsDoc !== void 0 ? _targetValue$portsDoc : 0;
169
+ console.log(sourceRb, targetRb, 'sourceRbQZQ');
153
170
  var actualBandwidth = 0;
154
171
 
155
172
  if (sourceRb && targetRb) {