@riil-frontend/component-topology 5.0.10 → 5.0.12

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.
@@ -18,10 +18,12 @@ var LineExpandAllRadioGroup = /*#__PURE__*/React.forwardRef(function LineExpandA
18
18
  showType = _useState[0],
19
19
  setShowType = _useState[1];
20
20
 
21
- var _useState2 = useState((_plurals = plurals[value !== null && value !== void 0 ? value : 2]) !== null && _plurals !== void 0 ? _plurals : []),
21
+ var _useState2 = useState((_plurals = plurals[value === false ? 2 : value]) !== null && _plurals !== void 0 ? _plurals : []),
22
22
  pluralType = _useState2[0],
23
23
  setPluralType = _useState2[1];
24
24
 
25
+ console.log("LineExpandAllRadioGroup-value", value, pluralType);
26
+
25
27
  var handleTypeChange = function handleTypeChange(newValue) {
26
28
  setShowType(newValue);
27
29
 
@@ -457,6 +457,20 @@ var useTopoEdit = function useTopoEdit(params) {
457
457
  });
458
458
  return newLinkElements;
459
459
  }
460
+ /**
461
+ * 获得未存在的元素
462
+ * @param {Array} elements
463
+ * @returns
464
+ */
465
+
466
+
467
+ function findUNExistedElements(elements) {
468
+ var dm = topo.getDataModel();
469
+ var newLinkElements = elements.filter(function (element) {
470
+ return !isExistedElement(topo.getHtTopo(), dm, element);
471
+ });
472
+ return newLinkElements;
473
+ }
460
474
  /**
461
475
  * 关联容器的资源
462
476
  */
@@ -599,7 +613,7 @@ var useTopoEdit = function useTopoEdit(params) {
599
613
 
600
614
  function _addLayerResources() {
601
615
  _addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(group, newResourceIds) {
602
- var _yield$editDispatcher4, elements, data;
616
+ var _yield$editDispatcher4, elements, newElements;
603
617
 
604
618
  return _regeneratorRuntime.wrap(function _callee15$(_context15) {
605
619
  while (1) {
@@ -617,24 +631,14 @@ var useTopoEdit = function useTopoEdit(params) {
617
631
  case 5:
618
632
  _yield$editDispatcher4 = _context15.sent;
619
633
  elements = _yield$editDispatcher4.elements;
620
- // 过滤出新增的资源和链路
621
- data = {
622
- groups: elements.filter(function (ele) {
623
- return ele.type === 'group';
624
- }),
625
- nodes: elements.filter(function (ele) {
626
- return ele.type === 'node';
627
- }),
628
- lines: elements.filter(function (ele) {
629
- return ele.type === 'link';
630
- })
631
- }; // 添加到分层
632
-
633
- _context15.next = 10;
634
- return topo.updateElements(data);
634
+ // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
635
+ newElements = findUNExistedElements(elements);
636
+ rlog.debug('添加分层资源', {
637
+ layer: group,
638
+ newElements: newElements
639
+ });
640
+ topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
635
641
 
636
- case 10:
637
- // 临时放这里,仅拓扑中心有
638
642
  if (topo.linkDynamicStyleExecutor) {
639
643
  topo.linkDynamicStyleExecutor.execute();
640
644
  }
@@ -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.10" === 'string' ? "5.0.10" : null;
24
+ var version = typeof "5.0.12" === 'string' ? "5.0.12" : null;
25
25
  console.info("\u62D3\u6251\u7248\u672C: " + version);
26
26
  /**
27
27
  * 拓扑显示和编辑
@@ -187,14 +187,14 @@ export var plurals = {
187
187
  4: ["phy", "agg"]
188
188
  };
189
189
  export var showLinkByConfig = function showLinkByConfig(props) {
190
- var _plurals$showType;
190
+ var _plurals;
191
191
 
192
192
  var topo = props.topo,
193
193
  _props$showType = props.showType,
194
194
  showType = _props$showType === void 0 ? 2 : _props$showType;
195
195
  console.log("showLinkByConfig-----------------------------", props, showType); //const displayConfig = topo.store.getModelState("displayConfig");
196
196
 
197
- var types = (_plurals$showType = plurals[showType]) !== null && _plurals$showType !== void 0 ? _plurals$showType : []; // 查询所有连线
197
+ var types = (_plurals = plurals[showType === false ? 2 : showType]) !== null && _plurals !== void 0 ? _plurals : []; // 查询所有连线
198
198
 
199
199
  var gv = topo.getGraphView();
200
200
  var dm = gv.getDataModel();
@@ -726,6 +726,20 @@ export var combSaveTopoData = function combSaveTopoData(_ref4) {
726
726
  extraConfig: extraConfig
727
727
  };
728
728
  };
729
+ export function transtormElementsToMap(elements) {
730
+ var data = {
731
+ groups: elements.filter(function (ele) {
732
+ return ele.type === 'group';
733
+ }),
734
+ nodes: elements.filter(function (ele) {
735
+ return ele.type === 'node';
736
+ }),
737
+ lines: elements.filter(function (ele) {
738
+ return ele.type === 'link';
739
+ })
740
+ };
741
+ return data;
742
+ }
729
743
  /**
730
744
  * 从拓扑数据中获取区域的子区域、子节点
731
745
  * @param {*} elements
@@ -37,10 +37,12 @@ var LineExpandAllRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function
37
37
  showType = _useState[0],
38
38
  setShowType = _useState[1];
39
39
 
40
- var _useState2 = (0, _react.useState)((_plurals = _linkUtils.plurals[value !== null && value !== void 0 ? value : 2]) !== null && _plurals !== void 0 ? _plurals : []),
40
+ var _useState2 = (0, _react.useState)((_plurals = _linkUtils.plurals[value === false ? 2 : value]) !== null && _plurals !== void 0 ? _plurals : []),
41
41
  pluralType = _useState2[0],
42
42
  setPluralType = _useState2[1];
43
43
 
44
+ console.log("LineExpandAllRadioGroup-value", value, pluralType);
45
+
44
46
  var handleTypeChange = function handleTypeChange(newValue) {
45
47
  setShowType(newValue);
46
48
 
@@ -487,6 +487,20 @@ var useTopoEdit = function useTopoEdit(params) {
487
487
  });
488
488
  return newLinkElements;
489
489
  }
490
+ /**
491
+ * 获得未存在的元素
492
+ * @param {Array} elements
493
+ * @returns
494
+ */
495
+
496
+
497
+ function findUNExistedElements(elements) {
498
+ var dm = topo.getDataModel();
499
+ var newLinkElements = elements.filter(function (element) {
500
+ return !(0, _htElementUtils.isExistedElement)(topo.getHtTopo(), dm, element);
501
+ });
502
+ return newLinkElements;
503
+ }
490
504
  /**
491
505
  * 关联容器的资源
492
506
  */
@@ -631,7 +645,7 @@ var useTopoEdit = function useTopoEdit(params) {
631
645
 
632
646
  function _addLayerResources() {
633
647
  _addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(group, newResourceIds) {
634
- var _yield$editDispatcher4, elements, data;
648
+ var _yield$editDispatcher4, elements, newElements;
635
649
 
636
650
  return _regenerator["default"].wrap(function _callee15$(_context15) {
637
651
  while (1) {
@@ -649,24 +663,16 @@ var useTopoEdit = function useTopoEdit(params) {
649
663
  case 5:
650
664
  _yield$editDispatcher4 = _context15.sent;
651
665
  elements = _yield$editDispatcher4.elements;
652
- // 过滤出新增的资源和链路
653
- data = {
654
- groups: elements.filter(function (ele) {
655
- return ele.type === 'group';
656
- }),
657
- nodes: elements.filter(function (ele) {
658
- return ele.type === 'node';
659
- }),
660
- lines: elements.filter(function (ele) {
661
- return ele.type === 'link';
662
- })
663
- }; // 添加到分层
664
-
665
- _context15.next = 10;
666
- return topo.updateElements(data);
666
+ // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
667
+ newElements = findUNExistedElements(elements);
668
+
669
+ _rlog["default"].debug('添加分层资源', {
670
+ layer: group,
671
+ newElements: newElements
672
+ });
673
+
674
+ topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
667
675
 
668
- case 10:
669
- // 临时放这里,仅拓扑中心有
670
676
  if (topo.linkDynamicStyleExecutor) {
671
677
  topo.linkDynamicStyleExecutor.execute();
672
678
  }
@@ -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.10" === 'string' ? "5.0.10" : null;
53
+ var version = typeof "5.0.12" === 'string' ? "5.0.12" : null;
54
54
  console.info("\u62D3\u6251\u7248\u672C: " + version);
55
55
  /**
56
56
  * 拓扑显示和编辑
@@ -217,14 +217,14 @@ var plurals = {
217
217
  exports.plurals = plurals;
218
218
 
219
219
  var showLinkByConfig = function showLinkByConfig(props) {
220
- var _plurals$showType;
220
+ var _plurals;
221
221
 
222
222
  var topo = props.topo,
223
223
  _props$showType = props.showType,
224
224
  showType = _props$showType === void 0 ? 2 : _props$showType;
225
225
  console.log("showLinkByConfig-----------------------------", props, showType); //const displayConfig = topo.store.getModelState("displayConfig");
226
226
 
227
- var types = (_plurals$showType = plurals[showType]) !== null && _plurals$showType !== void 0 ? _plurals$showType : []; // 查询所有连线
227
+ var types = (_plurals = plurals[showType === false ? 2 : showType]) !== null && _plurals !== void 0 ? _plurals : []; // 查询所有连线
228
228
 
229
229
  var gv = topo.getGraphView();
230
230
  var dm = gv.getDataModel();
@@ -15,7 +15,9 @@ exports.getCiTypesFromCiElements = getCiTypesFromCiElements;
15
15
  exports.getLinksBetweenTwoNodes = getLinksBetweenTwoNodes;
16
16
  exports.getMonitorTemplateCodes = getMonitorTemplateCodes;
17
17
  exports.parseTopoData = parseTopoData;
18
- exports.updateCiDoc = exports.updateAllCiDoc = exports.sortList = void 0;
18
+ exports.sortList = void 0;
19
+ exports.transtormElementsToMap = transtormElementsToMap;
20
+ exports.updateCiDoc = exports.updateAllCiDoc = void 0;
19
21
 
20
22
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
21
23
 
@@ -790,6 +792,23 @@ var combSaveTopoData = function combSaveTopoData(_ref4) {
790
792
  extraConfig: extraConfig
791
793
  };
792
794
  };
795
+
796
+ exports.combSaveTopoData = combSaveTopoData;
797
+
798
+ function transtormElementsToMap(elements) {
799
+ var data = {
800
+ groups: elements.filter(function (ele) {
801
+ return ele.type === 'group';
802
+ }),
803
+ nodes: elements.filter(function (ele) {
804
+ return ele.type === 'node';
805
+ }),
806
+ lines: elements.filter(function (ele) {
807
+ return ele.type === 'link';
808
+ })
809
+ };
810
+ return data;
811
+ }
793
812
  /**
794
813
  * 从拓扑数据中获取区域的子区域、子节点
795
814
  * @param {*} elements
@@ -798,8 +817,6 @@ var combSaveTopoData = function combSaveTopoData(_ref4) {
798
817
  */
799
818
 
800
819
 
801
- exports.combSaveTopoData = combSaveTopoData;
802
-
803
820
  function findGroupChildren(elements, group) {
804
821
  var id = group.id,
805
822
  tag = group.tag;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "5.0.10",
3
+ "version": "5.0.12",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -115,6 +115,6 @@
115
115
  "access": "public"
116
116
  },
117
117
  "license": "MIT",
118
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@5.0.10/build/index.html",
118
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@5.0.12/build/index.html",
119
119
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
120
120
  }