@riil-frontend/component-topology 4.0.1 → 4.0.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.
@@ -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 "4.0.1" === 'string' ? "4.0.1" : null;
24
+ var version = typeof "4.0.2" === 'string' ? "4.0.2" : null;
25
25
  console.info("\u62D3\u6251\u7248\u672C: " + version);
26
26
  /**
27
27
  * 拓扑显示和编辑
@@ -152,7 +152,7 @@ function AddLinkDrawer(props) {
152
152
 
153
153
  var handleEvent = /*#__PURE__*/function () {
154
154
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
155
- var sourcePorts, targetPorts, source, target, connect_type;
155
+ var sourcePorts, targetPorts, source, target, targetDisableCreatePhyAggLink, connect_type;
156
156
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
157
157
  while (1) {
158
158
  switch (_context2.prev = _context2.next) {
@@ -177,11 +177,12 @@ function AddLinkDrawer(props) {
177
177
  setTargetIFDoc(targetPorts.portsDoc);
178
178
  source = translationNode(e.source, sourcePorts);
179
179
  target = translationNode(e.target, targetPorts);
180
+ targetDisableCreatePhyAggLink = !target.ciData || !(target.ciData.permission.writeable || target.ciData.permission.deleteable);
180
181
  editDispatchers.update({
181
182
  addLinkIsOpen: true,
182
183
  currentLink: null
183
184
  });
184
- connect_type = target.ciType !== "customNode" && target.ipAddress && targetPorts.ports.length > 0 ? "phy" : "exit";
185
+ connect_type = target.ciType !== "customNode" && target.ipAddress && targetPorts.ports.length > 0 && !targetDisableCreatePhyAggLink ? "phy" : "exit";
185
186
  setLink({
186
187
  source: source,
187
188
  target: target,
@@ -200,20 +201,20 @@ function AddLinkDrawer(props) {
200
201
  connect_type: connect_type
201
202
  }
202
203
  });
203
- _context2.next = 22;
204
+ _context2.next = 23;
204
205
  break;
205
206
 
206
- case 19:
207
- _context2.prev = 19;
207
+ case 20:
208
+ _context2.prev = 20;
208
209
  _context2.t0 = _context2["catch"](3);
209
210
  rlog.error("出现异常", _context2.t0);
210
211
 
211
- case 22:
212
+ case 23:
212
213
  case "end":
213
214
  return _context2.stop();
214
215
  }
215
216
  }
216
- }, _callee2, null, [[3, 19]]);
217
+ }, _callee2, null, [[3, 20]]);
217
218
  }));
218
219
 
219
220
  return function handleEvent(_x3) {
@@ -254,6 +255,7 @@ function AddLinkDrawer(props) {
254
255
  connect_type = currentLink.attributes["network_link.connect_type"] === "exit" ? "exit" : "phy";
255
256
  setLink({
256
257
  source: {
258
+ ciData: topo.dataModel.getDataById(currentLink.source),
257
259
  id: currentLink.source,
258
260
  name: currentLink.attributes["network_link.source_device_id_object"].displayName,
259
261
  ciId: currentLink.attributes["network_link.source_device_id"],
@@ -265,6 +267,7 @@ function AddLinkDrawer(props) {
265
267
  portsDoc: sourcePorts.portsDoc
266
268
  },
267
269
  target: {
270
+ ciData: topo.dataModel.getDataById(currentLink.target),
268
271
  id: currentLink.target,
269
272
  name: currentLink.attributes["network_link.destination_device_id_object"].displayName,
270
273
  ciId: currentLink.attributes["network_link.destination_device_id"],
@@ -384,6 +387,7 @@ function AddLinkDrawer(props) {
384
387
 
385
388
  var attrObject = node._attrObject;
386
389
  return {
390
+ ciData: topo.dataModel.getDataById(attrObject.id),
387
391
  id: attrObject.id,
388
392
  name: attrObject.name,
389
393
  ciId: attrObject.id,
@@ -23,6 +23,13 @@ import styles from "./index.module.scss";
23
23
  function parseValues(values) {
24
24
  return _extends({}, values);
25
25
  }
26
+ /**
27
+ * 两端都有编辑/删除权限才能创建物理和聚合链路。
28
+ * 目的没编辑/删除权限时,在添加链路抽屉中链接方式默认出口,物理/聚合置灰不可选
29
+ * @param {*} props
30
+ * @returns
31
+ */
32
+
26
33
 
27
34
  export default function EditLinkInfo(props) {
28
35
  var _sourceValue$ipAddres2, _sourceValue$portsDoc5, _sourceValue$portsDoc6, _targetValue$portsDoc5, _targetValue$portsDoc6;
@@ -257,8 +264,10 @@ export default function EditLinkInfo(props) {
257
264
  name: "network_link.destination_ipv4",
258
265
  maxLength: 128
259
266
  });
260
- };
267
+ }; // 目的没编辑/删除权限时,在添加链路抽屉中链接方式默认出口,物理/聚合置灰不可选
268
+
261
269
 
270
+ var disableCreatePhyAggLink = target.ciType === "customNode" || !targetValue.ipAddress || targetValue.ports.length === 0 || !lineData.target || isAdd && !(lineData.target.ciData.permission.writeable || lineData.target.ciData.permission.deleteable);
262
271
  return /*#__PURE__*/React.createElement("div", {
263
272
  className: styles.editForm
264
273
  }, /*#__PURE__*/React.createElement(_Form, {
@@ -378,7 +387,7 @@ export default function EditLinkInfo(props) {
378
387
  }, /*#__PURE__*/React.createElement(_Radio, {
379
388
  id: "phy",
380
389
  value: "phy",
381
- disabled: target.ciType === "customNode" || !targetValue.ipAddress || targetValue.ports.length === 0
390
+ disabled: disableCreatePhyAggLink
382
391
  }, "\u7269\u7406/\u805A\u5408"), /*#__PURE__*/React.createElement(_Radio, {
383
392
  id: "exit",
384
393
  value: "exit"
@@ -82,7 +82,7 @@ export function handleClusterNoPermission(topo) {
82
82
  var dm = topo.getHtTopo().getGraphView().dm();
83
83
  var groups = getGroups(dm);
84
84
  groups.forEach(function (group) {
85
- if (isClusterHtElement(group) && !group.a('operation')) {
85
+ if (isClusterHtElement(group) && !group.a('operation') && group.isExpanded()) {
86
86
  group.setExpanded(false);
87
87
  }
88
88
  });
@@ -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 "4.0.1" === 'string' ? "4.0.1" : null;
53
+ var version = typeof "4.0.2" === 'string' ? "4.0.2" : null;
54
54
  console.info("\u62D3\u6251\u7248\u672C: " + version);
55
55
  /**
56
56
  * 拓扑显示和编辑
@@ -182,7 +182,7 @@ function AddLinkDrawer(props) {
182
182
 
183
183
  var handleEvent = /*#__PURE__*/function () {
184
184
  var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(e) {
185
- var sourcePorts, targetPorts, source, target, connect_type;
185
+ var sourcePorts, targetPorts, source, target, targetDisableCreatePhyAggLink, connect_type;
186
186
  return _regenerator["default"].wrap(function _callee2$(_context2) {
187
187
  while (1) {
188
188
  switch (_context2.prev = _context2.next) {
@@ -208,11 +208,12 @@ function AddLinkDrawer(props) {
208
208
  setTargetIFDoc(targetPorts.portsDoc);
209
209
  source = translationNode(e.source, sourcePorts);
210
210
  target = translationNode(e.target, targetPorts);
211
+ targetDisableCreatePhyAggLink = !target.ciData || !(target.ciData.permission.writeable || target.ciData.permission.deleteable);
211
212
  editDispatchers.update({
212
213
  addLinkIsOpen: true,
213
214
  currentLink: null
214
215
  });
215
- connect_type = target.ciType !== "customNode" && target.ipAddress && targetPorts.ports.length > 0 ? "phy" : "exit";
216
+ connect_type = target.ciType !== "customNode" && target.ipAddress && targetPorts.ports.length > 0 && !targetDisableCreatePhyAggLink ? "phy" : "exit";
216
217
  setLink({
217
218
  source: source,
218
219
  target: target,
@@ -231,21 +232,21 @@ function AddLinkDrawer(props) {
231
232
  connect_type: connect_type
232
233
  }
233
234
  });
234
- _context2.next = 22;
235
+ _context2.next = 23;
235
236
  break;
236
237
 
237
- case 19:
238
- _context2.prev = 19;
238
+ case 20:
239
+ _context2.prev = 20;
239
240
  _context2.t0 = _context2["catch"](3);
240
241
 
241
242
  _rlog["default"].error("出现异常", _context2.t0);
242
243
 
243
- case 22:
244
+ case 23:
244
245
  case "end":
245
246
  return _context2.stop();
246
247
  }
247
248
  }
248
- }, _callee2, null, [[3, 19]]);
249
+ }, _callee2, null, [[3, 20]]);
249
250
  }));
250
251
 
251
252
  return function handleEvent(_x3) {
@@ -286,6 +287,7 @@ function AddLinkDrawer(props) {
286
287
  connect_type = currentLink.attributes["network_link.connect_type"] === "exit" ? "exit" : "phy";
287
288
  setLink({
288
289
  source: {
290
+ ciData: topo.dataModel.getDataById(currentLink.source),
289
291
  id: currentLink.source,
290
292
  name: currentLink.attributes["network_link.source_device_id_object"].displayName,
291
293
  ciId: currentLink.attributes["network_link.source_device_id"],
@@ -297,6 +299,7 @@ function AddLinkDrawer(props) {
297
299
  portsDoc: sourcePorts.portsDoc
298
300
  },
299
301
  target: {
302
+ ciData: topo.dataModel.getDataById(currentLink.target),
300
303
  id: currentLink.target,
301
304
  name: currentLink.attributes["network_link.destination_device_id_object"].displayName,
302
305
  ciId: currentLink.attributes["network_link.destination_device_id"],
@@ -416,6 +419,7 @@ function AddLinkDrawer(props) {
416
419
 
417
420
  var attrObject = node._attrObject;
418
421
  return {
422
+ ciData: topo.dataModel.getDataById(attrObject.id),
419
423
  id: attrObject.id,
420
424
  name: attrObject.name,
421
425
  ciId: attrObject.id,
@@ -49,6 +49,13 @@ var Row = _grid["default"].Row,
49
49
  function parseValues(values) {
50
50
  return (0, _extends2["default"])({}, values);
51
51
  }
52
+ /**
53
+ * 两端都有编辑/删除权限才能创建物理和聚合链路。
54
+ * 目的没编辑/删除权限时,在添加链路抽屉中链接方式默认出口,物理/聚合置灰不可选
55
+ * @param {*} props
56
+ * @returns
57
+ */
58
+
52
59
 
53
60
  function EditLinkInfo(props) {
54
61
  var _sourceValue$ipAddres2, _sourceValue$portsDoc5, _sourceValue$portsDoc6, _targetValue$portsDoc5, _targetValue$portsDoc6;
@@ -285,8 +292,10 @@ function EditLinkInfo(props) {
285
292
  name: "network_link.destination_ipv4",
286
293
  maxLength: 128
287
294
  });
288
- };
295
+ }; // 目的没编辑/删除权限时,在添加链路抽屉中链接方式默认出口,物理/聚合置灰不可选
296
+
289
297
 
298
+ var disableCreatePhyAggLink = target.ciType === "customNode" || !targetValue.ipAddress || targetValue.ports.length === 0 || !lineData.target || isAdd && !(lineData.target.ciData.permission.writeable || lineData.target.ciData.permission.deleteable);
290
299
  return /*#__PURE__*/_react["default"].createElement("div", {
291
300
  className: _indexModule["default"].editForm
292
301
  }, /*#__PURE__*/_react["default"].createElement(_form["default"], {
@@ -406,7 +415,7 @@ function EditLinkInfo(props) {
406
415
  }, /*#__PURE__*/_react["default"].createElement(_radio["default"], {
407
416
  id: "phy",
408
417
  value: "phy",
409
- disabled: target.ciType === "customNode" || !targetValue.ipAddress || targetValue.ports.length === 0
418
+ disabled: disableCreatePhyAggLink
410
419
  }, "\u7269\u7406/\u805A\u5408"), /*#__PURE__*/_react["default"].createElement(_radio["default"], {
411
420
  id: "exit",
412
421
  value: "exit"
@@ -106,7 +106,7 @@ function handleClusterNoPermission(topo) {
106
106
  var dm = topo.getHtTopo().getGraphView().dm();
107
107
  var groups = (0, _htElementUtils.getGroups)(dm);
108
108
  groups.forEach(function (group) {
109
- if (isClusterHtElement(group) && !group.a('operation')) {
109
+ if (isClusterHtElement(group) && !group.a('operation') && group.isExpanded()) {
110
110
  group.setExpanded(false);
111
111
  }
112
112
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -114,6 +114,6 @@
114
114
  "access": "public"
115
115
  },
116
116
  "license": "MIT",
117
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@4.0.1/build/index.html",
117
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@4.0.2/build/index.html",
118
118
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
119
119
  }