@riil-frontend/component-topology 5.0.0-alpha.9 → 5.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.
Files changed (195) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.css +1 -1
  4. package/build/index.js +20 -20
  5. package/es/common/components/ColorPicker/ColorPicker.js +5 -3
  6. package/es/components/BatchAttrMetric/setting.js +3 -5
  7. package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +2 -1
  8. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +2 -1
  9. package/es/core/components/DisplaySettingDrawer/LinkTip.js +5 -1
  10. package/es/core/components/DisplaySettingDrawer/demo/Demo.js +63 -0
  11. package/es/core/components/ResourceViewAttributeSetting/Setting.js +9 -48
  12. package/es/core/components/TopoView/TopoView.module.scss +1 -1
  13. package/es/core/components/TopoView/topoView.js +31 -22
  14. package/es/core/editor/components/BackgroundView/index.js +74 -35
  15. package/es/core/editor/components/settings/common/LineType/index.js +7 -1
  16. package/es/core/editor/components/settings/common/text/FontStyleCheckbox.js +3 -3
  17. package/es/core/editor/components/settings/common/text/TextStyle.js +21 -6
  18. package/es/core/editor/components/settings/common/text/fontStyleUtil.js +0 -1
  19. package/es/core/editor/components/settings/propertyViews/box/BoxPropertyView.js +12 -1
  20. package/es/core/editor/components/settings/propertyViews/box/NameInput.js +9 -1
  21. package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +15 -1
  22. package/es/core/editor/components/settings/propertyViews/group/DataTab/GroupNodeList.js +2 -0
  23. package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +9 -5
  24. package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandStatus.js +10 -2
  25. package/es/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +12 -1
  26. package/es/core/editor/components/settings/propertyViews/layer/SettingTab/Setting.js +13 -3
  27. package/es/core/editor/components/settings/propertyViews/layer/SettingTab/Setting_bak.js +0 -1
  28. package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeIcon.js +2 -0
  29. package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize.js +2 -0
  30. package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +4 -1
  31. package/es/core/editor/components/settings/propertyViews/node/Setting/Setting.js +4 -0
  32. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +34 -6
  33. package/es/core/editor/components/settings/propertyViews/text/TextPropertyView.js +9 -2
  34. package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +30 -1
  35. package/es/core/editor/components/settings/propertyViews/view/GlobalLayout.js +2 -0
  36. package/es/core/editor/components/settings/propertyViews/view/GlobalNodeLabelStyle.js +15 -1
  37. package/es/core/editor/components/settings/propertyViews/view/hooks/useBackgroundSizeConfig.js +0 -1
  38. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +4 -1
  39. package/es/core/editor/components/titlebar/widgets/DebugTools.js +29 -0
  40. package/es/core/hooks/useAlarm.js +18 -0
  41. package/es/core/hooks/useGraphAlarmDisplay.js +25 -3
  42. package/es/core/hooks/useResourceConfig.js +2 -1
  43. package/es/core/hooks/useRouterAdapter.js +7 -1
  44. package/es/core/hooks/useTopoEdit.js +220 -163
  45. package/es/core/models/AttributeMetricDisplay.js +31 -73
  46. package/es/core/models/HistoryManager.js +100 -50
  47. package/es/core/models/TopoApp.js +1 -1
  48. package/es/core/models/cache/CiTypeCache.js +10 -44
  49. package/es/core/models/cache/DictCache.js +2 -1
  50. package/es/core/models/graph/Background.js +31 -14
  51. package/es/core/models/tagstips/ElementTagTipConfig.js +46 -12
  52. package/es/core/models/tagstips/utils.js +1 -1
  53. package/es/core/models/topoData.js +7 -3
  54. package/es/core/models/utils/linkUtils.js +18 -0
  55. package/es/core/store/models/topoAlarm.js +5 -1
  56. package/es/core/store/models/topoMod.js +6 -31
  57. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +51 -249
  58. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +218 -0
  59. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +2 -2
  60. package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +1 -1
  61. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +0 -1
  62. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +79 -43
  63. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +2 -3
  64. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +2 -2
  65. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +23 -0
  66. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +11 -0
  67. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +34 -0
  68. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/constants.js +6 -0
  69. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +62 -0
  70. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +188 -0
  71. package/es/core/viewer/components/titlebar/BasicTools.js +1 -1
  72. package/es/core/viewer/components/titlebar/widgets/NodesDragSwitchWrapper.js +18 -0
  73. package/es/core/viewer/components/titlebar/widgets/SettingButton.js +11 -1
  74. package/es/networkTopo/components/TopoView.js +2 -1
  75. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +164 -225
  76. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +4 -0
  77. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +161 -137
  78. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +104 -0
  79. package/es/networkTopo/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +17 -7
  80. package/es/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.js +8 -9
  81. package/es/networkTopo/components/viewer/displaySetting/LinkAttrCustomSettingDrawer.js +59 -0
  82. package/es/networkTopo/components/viewer/displaySetting/LinkTagV2.js +10 -4
  83. package/es/networkTopo/getTopoData.js +11 -14
  84. package/es/networkTopo/hooks/editor/useDeleteEdges.js +11 -8
  85. package/es/networkTopo/hooks/viewer/useRelateTopo.js +1 -1
  86. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -0
  87. package/es/networkTopo/models/TopoCenter.js +1 -1
  88. package/es/networkTopo/services/index.js +6 -4
  89. package/es/networkTopo/services/link.js +2 -2
  90. package/es/networkTopo/store/topoCenter.js +5 -2
  91. package/es/networkTopo/store/topoTreeMod.js +84 -43
  92. package/es/networkTopo/utils/__tests__/resourcePermissionUtil.test.js +135 -0
  93. package/es/networkTopo/utils/resourcePermissionUtil.js +10 -6
  94. package/es/style.js +2 -1
  95. package/es/utils/ResourceConfigUtil.js +79 -39
  96. package/es/utils/clusterUtil.js +1 -1
  97. package/es/utils/htElementUtils.js +0 -1
  98. package/es/utils/topoData.js +24 -63
  99. package/es/utils/tree.js +1 -3
  100. package/lib/common/components/ColorPicker/ColorPicker.js +6 -3
  101. package/lib/components/BatchAttrMetric/setting.js +3 -6
  102. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +4 -1
  103. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +4 -1
  104. package/lib/core/components/DisplaySettingDrawer/LinkTip.js +6 -1
  105. package/lib/core/components/DisplaySettingDrawer/demo/Demo.js +71 -0
  106. package/lib/core/components/ResourceViewAttributeSetting/Setting.js +8 -48
  107. package/lib/core/components/TopoView/TopoView.module.scss +1 -1
  108. package/lib/core/components/TopoView/topoView.js +26 -17
  109. package/lib/core/editor/components/BackgroundView/index.js +75 -35
  110. package/lib/core/editor/components/settings/common/LineType/index.js +7 -1
  111. package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.js +5 -4
  112. package/lib/core/editor/components/settings/common/text/TextStyle.js +23 -7
  113. package/lib/core/editor/components/settings/common/text/fontStyleUtil.js +0 -1
  114. package/lib/core/editor/components/settings/propertyViews/box/BoxPropertyView.js +13 -1
  115. package/lib/core/editor/components/settings/propertyViews/box/NameInput.js +9 -1
  116. package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +15 -1
  117. package/lib/core/editor/components/settings/propertyViews/group/DataTab/GroupNodeList.js +2 -0
  118. package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +9 -5
  119. package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandStatus.js +10 -2
  120. package/lib/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +12 -1
  121. package/lib/core/editor/components/settings/propertyViews/layer/SettingTab/Setting.js +17 -3
  122. package/lib/core/editor/components/settings/propertyViews/layer/SettingTab/Setting_bak.js +0 -1
  123. package/lib/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeIcon.js +2 -0
  124. package/lib/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize.js +2 -0
  125. package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +4 -1
  126. package/lib/core/editor/components/settings/propertyViews/node/Setting/Setting.js +4 -0
  127. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +36 -6
  128. package/lib/core/editor/components/settings/propertyViews/text/TextPropertyView.js +9 -2
  129. package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +32 -1
  130. package/lib/core/editor/components/settings/propertyViews/view/GlobalLayout.js +2 -0
  131. package/lib/core/editor/components/settings/propertyViews/view/GlobalNodeLabelStyle.js +15 -1
  132. package/lib/core/editor/components/settings/propertyViews/view/hooks/useBackgroundSizeConfig.js +0 -1
  133. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +5 -1
  134. package/lib/core/editor/components/titlebar/widgets/DebugTools.js +38 -0
  135. package/lib/core/hooks/useAlarm.js +19 -0
  136. package/lib/core/hooks/useGraphAlarmDisplay.js +27 -3
  137. package/lib/core/hooks/useResourceConfig.js +2 -1
  138. package/lib/core/hooks/useRouterAdapter.js +8 -1
  139. package/lib/core/hooks/useTopoEdit.js +219 -162
  140. package/lib/core/models/AttributeMetricDisplay.js +31 -73
  141. package/lib/core/models/HistoryManager.js +105 -51
  142. package/lib/core/models/TopoApp.js +1 -1
  143. package/lib/core/models/cache/CiTypeCache.js +12 -44
  144. package/lib/core/models/cache/DictCache.js +4 -1
  145. package/lib/core/models/graph/Background.js +36 -16
  146. package/lib/core/models/tagstips/ElementTagTipConfig.js +49 -12
  147. package/lib/core/models/tagstips/utils.js +1 -1
  148. package/lib/core/models/topoData.js +7 -3
  149. package/lib/core/models/utils/linkUtils.js +22 -0
  150. package/lib/core/store/models/topoAlarm.js +5 -1
  151. package/lib/core/store/models/topoMod.js +7 -32
  152. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +51 -261
  153. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +245 -0
  154. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +2 -2
  155. package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +1 -1
  156. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +0 -1
  157. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +79 -42
  158. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +2 -3
  159. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +2 -2
  160. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +36 -0
  161. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +11 -0
  162. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +45 -0
  163. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/constants.js +11 -0
  164. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +77 -0
  165. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +214 -0
  166. package/lib/core/viewer/components/titlebar/BasicTools.js +2 -2
  167. package/lib/core/viewer/components/titlebar/widgets/NodesDragSwitchWrapper.js +28 -0
  168. package/lib/core/viewer/components/titlebar/widgets/SettingButton.js +10 -0
  169. package/lib/networkTopo/components/TopoView.js +3 -2
  170. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +160 -223
  171. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +12 -0
  172. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +161 -137
  173. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +120 -0
  174. package/lib/networkTopo/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +19 -7
  175. package/lib/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.js +8 -9
  176. package/lib/networkTopo/components/viewer/displaySetting/LinkAttrCustomSettingDrawer.js +76 -0
  177. package/lib/networkTopo/components/viewer/displaySetting/LinkTagV2.js +10 -4
  178. package/lib/networkTopo/getTopoData.js +10 -13
  179. package/lib/networkTopo/hooks/editor/useDeleteEdges.js +11 -8
  180. package/lib/networkTopo/hooks/viewer/useRelateTopo.js +2 -1
  181. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -0
  182. package/lib/networkTopo/models/TopoCenter.js +2 -2
  183. package/lib/networkTopo/services/index.js +6 -4
  184. package/lib/networkTopo/services/link.js +2 -2
  185. package/lib/networkTopo/store/topoCenter.js +5 -2
  186. package/lib/networkTopo/store/topoTreeMod.js +84 -43
  187. package/lib/networkTopo/utils/__tests__/resourcePermissionUtil.test.js +137 -0
  188. package/lib/networkTopo/utils/resourcePermissionUtil.js +11 -6
  189. package/lib/style.js +2 -1
  190. package/lib/utils/ResourceConfigUtil.js +78 -37
  191. package/lib/utils/clusterUtil.js +1 -1
  192. package/lib/utils/htElementUtils.js +0 -1
  193. package/lib/utils/topoData.js +25 -64
  194. package/lib/utils/tree.js +1 -3
  195. package/package.json +3 -2
@@ -26,7 +26,8 @@ import styles from "./index.module.scss";
26
26
  import ResourceOverviewMetric from "./ResourceOverviewMetric";
27
27
  import useCiAttrAndMetricData from "./useCiAttrAndMetricData";
28
28
  import Configurator from "./components/Configurator";
29
- import { formatMetric } from "../../../../../../models/attributeFormatter"; // url 处理,UICBB 的地址需截取前缀
29
+ import { formatMetric } from "../../../../../../models/attributeFormatter";
30
+ import LinkTopoCard from "./components/LinkTopo/LinkTopoCard"; // url 处理,UICBB 的地址需截取前缀
30
31
 
31
32
  function formatUrl(url) {
32
33
  var _window, _window$location;
@@ -57,7 +58,6 @@ export default function ResourceOverview(props) {
57
58
  var resourceOverviewProps = (viewerProps === null || viewerProps === void 0 ? void 0 : (_viewerProps$resource = viewerProps.resourceDetailProps) === null || _viewerProps$resource === void 0 ? void 0 : _viewerProps$resource.resourceOverviewProps) || {}; // 是否是业务拓扑
58
59
 
59
60
  var isAppTopo = !!resourceOverviewProps.getData;
60
- console.log('resourceOverviewProps', resourceOverviewProps);
61
61
 
62
62
  var _topo$store$useModelS = topo.store.useModelState('topoMod'),
63
63
  topoId = _topo$store$useModelS.topoId; // 拓扑id
@@ -112,17 +112,7 @@ export default function ResourceOverview(props) {
112
112
  setInitFlag = _useState7[1];
113
113
 
114
114
  var ciTypeMeta = useMemo(function () {
115
- var typeMeta;
116
-
117
- if (ciType === 'network_link') {
118
- // 网络链路要按链路类型查询属性、指标
119
- var link = topo.dataModel.getDataById(id);
120
- var linkConnectType = link.attributes['network_link.connect_type'];
121
- typeMeta = topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
122
- } else {
123
- typeMeta = topo.ciTyeCache.getCiType(ciType);
124
- }
125
-
115
+ var typeMeta = topo.ciTyeCache.getCiType(ciType);
126
116
  return typeMeta;
127
117
  }, [id]);
128
118
 
@@ -538,7 +528,7 @@ export default function ResourceOverview(props) {
538
528
  _baseInfoColChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(col) {
539
529
  var _col;
540
530
 
541
- var infoData, attributeMap, _iterator, _step, item, value, contentTitle, link, node, _data, _ref2, _ref2$, _item, _attributeMap, object, _object, displayName, attr;
531
+ var infoData, attributeMap, _iterator, _step, item, value, contentTitle, link, address, owned_computer_room, owned_cabinet, roomLink, node, _data, _ref2, _ref2$, _item, _attributeMap, object, _object, displayName, attr;
542
532
 
543
533
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
544
534
  while (1) {
@@ -568,7 +558,7 @@ export default function ResourceOverview(props) {
568
558
 
569
559
  case 11:
570
560
  if ((_step = _iterator()).done) {
571
- _context5.next = 46;
561
+ _context5.next = 48;
572
562
  break;
573
563
  }
574
564
 
@@ -576,7 +566,7 @@ export default function ResourceOverview(props) {
576
566
  value = formatMetric(attributeMap[item.dataIndex], ciTypeMeta.attributeMap[item.dataIndex]);
577
567
  contentTitle = value;
578
568
  _context5.t0 = item.dataIndex;
579
- _context5.next = _context5.t0 === 'display_name' ? 18 : _context5.t0 === 'ciName' ? 22 : _context5.t0 === 'res_address' ? 25 : _context5.t0 === 'imageName' ? 30 : 34;
569
+ _context5.next = _context5.t0 === 'display_name' ? 18 : _context5.t0 === 'ciName' ? 22 : _context5.t0 === 'res_address' ? 25 : _context5.t0 === 'imageName' ? 32 : 36;
580
570
  break;
581
571
 
582
572
  case 18:
@@ -586,36 +576,53 @@ export default function ResourceOverview(props) {
586
576
  onClick: onClose
587
577
  }, /*#__PURE__*/React.createElement(Link, {
588
578
  className: styles.link,
589
- title: attributeMap.display_name || "",
579
+ title: attributeMap.display_name || '',
590
580
  to: formatUrl(link)
591
- }, attributeMap.display_name || "-"));
592
- contentTitle = attributeMap.display_name || "-";
593
- return _context5.abrupt("break", 35);
581
+ }, attributeMap.display_name || '-'));
582
+ contentTitle = attributeMap.display_name || '-';
583
+ return _context5.abrupt("break", 37);
594
584
 
595
585
  case 22:
596
586
  value = ciTypeMeta.displayName;
597
587
  contentTitle = value;
598
- return _context5.abrupt("break", 35);
588
+ return _context5.abrupt("break", 37);
599
589
 
600
590
  case 25:
601
591
  _context5.next = 27;
602
592
  return getAddressFormat(attributeMap);
603
593
 
604
594
  case 27:
605
- value = _context5.sent;
606
- contentTitle = value;
607
- return _context5.abrupt("break", 35);
595
+ address = _context5.sent;
596
+ owned_computer_room = attributeMap.owned_computer_room, owned_cabinet = attributeMap.owned_cabinet; // 跳转3D机房定位设备
597
+
598
+ if (owned_computer_room && owned_cabinet) {
599
+ // /visual/room/index_runtime.html?type=preview&room_id=00000000383e3381&rack_id=11&device_id=122
600
+ roomLink = "/visual/room/index_runtime.html?type=preview&room_id=" + owned_computer_room + "&rack_id=" + owned_cabinet + "&device_id=" + id;
601
+ value = /*#__PURE__*/React.createElement("span", {
602
+ onClick: onClose
603
+ }, /*#__PURE__*/React.createElement(Link, {
604
+ className: styles.link,
605
+ title: address,
606
+ to: roomLink,
607
+ target: "_blank"
608
+ }, address));
609
+ } else {
610
+ value = address;
611
+ }
608
612
 
609
- case 30:
613
+ contentTitle = address;
614
+ return _context5.abrupt("break", 37);
615
+
616
+ case 32:
610
617
  node = topo.getDataModel().getDataByTag(id);
611
618
  value = (node === null || node === void 0 ? void 0 : node.a('customName')) || (node === null || node === void 0 ? void 0 : node.a('name')) || '-';
612
619
  contentTitle = value;
613
- return _context5.abrupt("break", 35);
620
+ return _context5.abrupt("break", 37);
614
621
 
615
- case 34:
616
- return _context5.abrupt("break", 35);
622
+ case 36:
623
+ return _context5.abrupt("break", 37);
617
624
 
618
- case 35:
625
+ case 37:
619
626
  // 拿翻译字段属性数据
620
627
  if (attributeMap[item.dataIndex] && attributeMap[item.dataIndex + ".name"]) {
621
628
  value = attributeMap[item.dataIndex + ".name"];
@@ -651,15 +658,15 @@ export default function ResourceOverview(props) {
651
658
  contentTitle: contentTitle
652
659
  }));
653
660
 
654
- case 44:
661
+ case 46:
655
662
  _context5.next = 11;
656
663
  break;
657
664
 
658
- case 46:
665
+ case 48:
659
666
  settBaseInfoInitLoading(false);
660
667
  setBaseInfo(infoData);
661
668
 
662
- case 48:
669
+ case 50:
663
670
  case "end":
664
671
  return _context5.stop();
665
672
  }
@@ -676,7 +683,7 @@ export default function ResourceOverview(props) {
676
683
 
677
684
  function _getAttribute() {
678
685
  _getAttribute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
679
- var res, _ref3, attributes;
686
+ var _yield$resourceOvervi2, baseInfos, res, _ref3, attributes;
680
687
 
681
688
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
682
689
  while (1) {
@@ -690,25 +697,46 @@ export default function ResourceOverview(props) {
690
697
  return _context6.abrupt("return");
691
698
 
692
699
  case 2:
693
- _context6.next = 4;
700
+ if (!(resourceOverviewProps !== null && resourceOverviewProps !== void 0 && resourceOverviewProps.getData)) {
701
+ _context6.next = 9;
702
+ break;
703
+ }
704
+
705
+ _context6.next = 5;
706
+ return resourceOverviewProps === null || resourceOverviewProps === void 0 ? void 0 : resourceOverviewProps.getData({
707
+ id: id
708
+ });
709
+
710
+ case 5:
711
+ _yield$resourceOvervi2 = _context6.sent;
712
+ baseInfos = _yield$resourceOvervi2.baseInfos;
713
+
714
+ if (!baseInfos) {
715
+ _context6.next = 9;
716
+ break;
717
+ }
718
+
719
+ return _context6.abrupt("return", baseInfos);
720
+
721
+ case 9:
722
+ _context6.next = 11;
694
723
  return service.commonQueryCiData({
695
724
  condition: "id('" + id + "')",
696
725
  refAttribute: true,
697
726
  orders: [{
698
- name: "CREATED_TIME",
699
- type: "asc"
727
+ name: 'CREATED_TIME',
728
+ type: 'asc'
700
729
  }],
701
730
  pageIndex: 1,
702
- pageSize: 100000
731
+ pageSize: 10
703
732
  });
704
733
 
705
- case 4:
734
+ case 11:
706
735
  res = _context6.sent;
707
- console.log('getAttribute res', res);
708
736
  _ref3 = (res === null || res === void 0 ? void 0 : res.data[0]) || {}, attributes = _ref3.attributes;
709
- return _context6.abrupt("return", attributes);
737
+ return _context6.abrupt("return", attributes || {});
710
738
 
711
- case 8:
739
+ case 14:
712
740
  case "end":
713
741
  return _context6.stop();
714
742
  }
@@ -819,7 +847,7 @@ export default function ResourceOverview(props) {
819
847
  return item.dataIndex;
820
848
  });
821
849
  } else if (type === 'link') {
822
- baseInfo = ['display_name', 'network_link.actual_bandwidth', 'network_link.source_ipv4', 'network_link.destination_ipv4', 'network_link.connect_type'];
850
+ baseInfo = ['display_name', 'network_link.actual_bandwidth', 'network_link.source_ipv4', 'network_link.destination_ipv4'];
823
851
  keyIndicators = metricCol.slice(0, 3).map(function (item) {
824
852
  return item.dataIndex;
825
853
  });
@@ -886,7 +914,15 @@ export default function ResourceOverview(props) {
886
914
  onChange: baseInfoColChange
887
915
  }));
888
916
  }
889
- })), /*#__PURE__*/React.createElement(BlockBox, {
917
+ })), ciType === 'network_link' ? /*#__PURE__*/React.createElement(LinkTopoCard, {
918
+ data: data,
919
+ topoId: topoId,
920
+ metricCol: metricCol,
921
+ metricColChange: metricColChange,
922
+ metricCodes: metric.map(function (item) {
923
+ return item.code;
924
+ })
925
+ }) : /*#__PURE__*/React.createElement(BlockBox, {
890
926
  headerTitle: "\u5173\u952E\u6307\u6807",
891
927
  headerExtra: /*#__PURE__*/React.createElement(Configurator, {
892
928
  topoId: topoId,
@@ -68,7 +68,6 @@ export default function ResourceOverviewMetric(props) {
68
68
  var code = itemData.code,
69
69
  metricItem = itemData.metricItem,
70
70
  list = itemData.list;
71
- console.log('formatValue', itemData);
72
71
  var format = metricValueFormat({
73
72
  value: (_list = list[list.length - 1]) === null || _list === void 0 ? void 0 : _list.metricValue,
74
73
  dataType: metricItem.dataType,
@@ -90,9 +89,9 @@ export default function ResourceOverviewMetric(props) {
90
89
  value: item.metricValue == -2 ? null : Number(item.metricValue)
91
90
  };
92
91
  });
93
- }
92
+ } // console.log('ResourceOverviewMetric', data);
93
+
94
94
 
95
- console.log('ResourceOverviewMetric', data);
96
95
  var content;
97
96
 
98
97
  if (data.length) {
@@ -33,8 +33,8 @@ function Configurator(props) {
33
33
  type = props.type,
34
34
  max = props.max,
35
35
  _props$btnStyle = props.btnStyle,
36
- btnStyle = _props$btnStyle === void 0 ? {} : _props$btnStyle;
37
- console.log('Configurator props', props);
36
+ btnStyle = _props$btnStyle === void 0 ? {} : _props$btnStyle; // console.log('Configurator props', props);
37
+
38
38
  var buttonRef = useRef(null);
39
39
 
40
40
  var _useState = useState(false),
@@ -0,0 +1,23 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import CrucialLinkTopo from '@riil-frontend/component-crucial-link-topo';
4
+ import { request, getHistory } from '@riil-frontend/component-topology-utils';
5
+ import useMetricPolling from "./hooks/useMetricPolling";
6
+ import styles from "./LinkTopo.module.scss";
7
+ export default function LinkTopo(props) {
8
+ var data = props.data,
9
+ linkMetricCodes = props.linkMetricCodes;
10
+ var metricData = useMetricPolling({
11
+ linkCi: data,
12
+ linkMetricCodes: linkMetricCodes
13
+ });
14
+ return /*#__PURE__*/React.createElement("div", {
15
+ className: styles.container
16
+ }, /*#__PURE__*/React.createElement(CrucialLinkTopo, _extends({
17
+ request: request,
18
+ data: data // 链路ci数据
19
+ ,
20
+ isNarrow: true,
21
+ jumpto: getHistory().push
22
+ }, metricData)));
23
+ }
@@ -0,0 +1,11 @@
1
+ .container {
2
+ width: 100%;
3
+ height: 100%;
4
+ min-height: 250px;
5
+ position: relative;
6
+ .floatBox{
7
+ position: absolute;
8
+ top:50px;
9
+ left: 40px;
10
+ }
11
+ }
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import BlockBox from "../../BlockBox";
3
+ import Configurator from "../Configurator";
4
+ import LinkTopo from "./LinkTopo";
5
+ export default function LinkTopoCard(props) {
6
+ var _data$attributes;
7
+
8
+ var topoId = props.topoId,
9
+ data = props.data,
10
+ defaultCols = props.defaultCols,
11
+ metricCol = props.metricCol,
12
+ metricColChange = props.metricColChange,
13
+ metricCodes = props.metricCodes; // eslint-disable-next-line camelcase
14
+
15
+ var supportTemplates = (data === null || data === void 0 ? void 0 : (_data$attributes = data.attributes) === null || _data$attributes === void 0 ? void 0 : _data$attributes.support_templates) || ''; // 该资源监控模板
16
+
17
+ var isCrucial = data === null || data === void 0 ? void 0 : data.attributes['network_link.is_crucial'];
18
+ return /*#__PURE__*/React.createElement(BlockBox, {
19
+ headerTitle: "\u8FD0\u884C\u60C5\u51B5",
20
+ headerExtra: /*#__PURE__*/React.createElement(Configurator, {
21
+ topoId: topoId,
22
+ templateCode: supportTemplates,
23
+ type: "keyIndicators" // 关键链路默认展示的指标展示【端到端ping时延】和【端到端ping丢包率】
24
+ ,
25
+ defaultCol: isCrucial ? ['remote_ping_delayed', 'remote_ping_discards_rate'] : [],
26
+ max: 5,
27
+ columns: metricCol,
28
+ onChange: metricColChange
29
+ })
30
+ }, /*#__PURE__*/React.createElement(LinkTopo, {
31
+ data: data,
32
+ linkMetricCodes: metricCodes
33
+ }));
34
+ }
@@ -0,0 +1,6 @@
1
+ export var INTERFACE_METRIC_CODES = ['out_rate', // 发送速率、接收速率发送接收利用率、总错包数
2
+ 'out_bandwidth_utilization', // 发送带宽利用率
3
+ 'in_rate', // 接收速率
4
+ 'in_bandwidth_utilization', // 接收带宽利用率
5
+ 'total_errors_packets' // 总错包数
6
+ ];
@@ -0,0 +1,62 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useEffect, useState } from 'react';
3
+ import { useRequest } from 'ahooks';
4
+ import { queryLinkInterfacesLatestMetrics, queryLinkLatestMetrics } from "../services"; // 资源节点上方色块展示资源的发送速率发送带宽利用率、接收速率发送接收利用率、总错包数
5
+
6
+ export default function useMetricPolling(_ref) {
7
+ var linkCi = _ref.linkCi,
8
+ linkMetricCodes = _ref.linkMetricCodes;
9
+ var linkId = linkCi.id;
10
+
11
+ var _useState = useState({
12
+ sourceMetrics: null,
13
+ destinationMetrics: null,
14
+ // 链路指标列表
15
+ linkMetrics: []
16
+ }),
17
+ data = _useState[0],
18
+ setData = _useState[1]; // 轮询hooks
19
+
20
+
21
+ var queryLinkMetricsRequest = useRequest(queryLinkLatestMetrics, {
22
+ pollingInterval: 1000 * 15,
23
+ pollingWhenHidden: false,
24
+ debounceInterval: 200,
25
+ manual: true,
26
+ onSuccess: function onSuccess(result) {
27
+ setData(_extends({}, data, {
28
+ linkMetrics: result
29
+ }));
30
+ console.info('链路拓扑指标轮询', result);
31
+ }
32
+ });
33
+ var queryInterfaceMetricsRequest = useRequest(queryLinkInterfacesLatestMetrics, {
34
+ pollingInterval: 1000 * 15,
35
+ pollingWhenHidden: false,
36
+ debounceInterval: 200,
37
+ manual: true,
38
+ onSuccess: function onSuccess(result) {
39
+ setData(_extends({}, data, result));
40
+ console.info('链路拓扑指标轮询 queryInterfaceMetricsRequest 结果', result);
41
+ }
42
+ });
43
+ var linkMetricCodesStr = linkMetricCodes.map(function (item) {
44
+ return item;
45
+ }).sort().join(',');
46
+ useEffect(function () {
47
+ console.info('链路拓扑指标轮询 切换', {
48
+ linkCi: linkCi,
49
+ linkMetricCodes: linkMetricCodes
50
+ });
51
+ queryLinkMetricsRequest.run(linkCi, linkMetricCodes);
52
+ return function () {};
53
+ }, [linkId, linkMetricCodesStr]);
54
+ useEffect(function () {
55
+ console.info('链路拓扑指标轮询 queryInterfaceMetricsRequest 开始', {
56
+ linkCi: linkCi
57
+ });
58
+ queryInterfaceMetricsRequest.run(linkCi);
59
+ return function () {};
60
+ }, [linkId]);
61
+ return data;
62
+ }
@@ -0,0 +1,188 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { request } from '@riil-frontend/component-topology-utils';
4
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
5
+ import { formatMetric } from "../../../../../../../../../models/attributeFormatter";
6
+ import ciTypeCache from "../../../../../../../../../models/cache/CiTypeCache";
7
+ import { INTERFACE_METRIC_CODES } from "../constants";
8
+ export function queryAssetModel(_x) {
9
+ return _queryAssetModel.apply(this, arguments);
10
+ }
11
+
12
+ function _queryAssetModel() {
13
+ _queryAssetModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(code) {
14
+ var result;
15
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
16
+ while (1) {
17
+ switch (_context.prev = _context.next) {
18
+ case 0:
19
+ _context.next = 2;
20
+ return request.get("/mdc/v1/api/model-asset/" + code);
21
+
22
+ case 2:
23
+ result = _context.sent;
24
+ return _context.abrupt("return", result);
25
+
26
+ case 4:
27
+ case "end":
28
+ return _context.stop();
29
+ }
30
+ }
31
+ }, _callee);
32
+ }));
33
+ return _queryAssetModel.apply(this, arguments);
34
+ }
35
+
36
+ export function queryLatestMetrics(_x2) {
37
+ return _queryLatestMetrics.apply(this, arguments);
38
+ }
39
+ /**
40
+ * 查询链路及两端接口指标数据
41
+ *
42
+ * @param {*} linkCi
43
+ * @param {*} linkMetricCodes
44
+ * @returns
45
+ */
46
+
47
+ function _queryLatestMetrics() {
48
+ _queryLatestMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(params) {
49
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
50
+ while (1) {
51
+ switch (_context2.prev = _context2.next) {
52
+ case 0:
53
+ return _context2.abrupt("return", request.post('/mdc/v1/api/cmdb/metric/queryLatestMetrics', params));
54
+
55
+ case 1:
56
+ case "end":
57
+ return _context2.stop();
58
+ }
59
+ }
60
+ }, _callee2);
61
+ }));
62
+ return _queryLatestMetrics.apply(this, arguments);
63
+ }
64
+
65
+ export function queryLinkLatestMetrics(_x3, _x4) {
66
+ return _queryLinkLatestMetrics.apply(this, arguments);
67
+ }
68
+
69
+ function _queryLinkLatestMetrics() {
70
+ _queryLinkLatestMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(linkCi, linkMetricCodes) {
71
+ var linkMetrics, resultData;
72
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
73
+ while (1) {
74
+ switch (_context3.prev = _context3.next) {
75
+ case 0:
76
+ rlog.debug('链路拓扑指标轮询 queryLinkLatestMetrics', linkCi, linkMetricCodes);
77
+
78
+ if (linkMetricCodes.length) {
79
+ _context3.next = 3;
80
+ break;
81
+ }
82
+
83
+ return _context3.abrupt("return", []);
84
+
85
+ case 3:
86
+ _context3.next = 5;
87
+ return queryLatestMetrics({
88
+ ciId: [linkCi.id],
89
+ 'metricCode': linkMetricCodes
90
+ });
91
+
92
+ case 5:
93
+ linkMetrics = _context3.sent;
94
+ // format
95
+ resultData = linkMetricCodes.map(function (code) {
96
+ var _linkMetrics$find;
97
+
98
+ var value = (_linkMetrics$find = linkMetrics.find(function (m) {
99
+ return m.metricCode === code;
100
+ })) === null || _linkMetrics$find === void 0 ? void 0 : _linkMetrics$find.metricValue;
101
+ var metricDef = ciTypeCache.getMetric(linkCi.ciType, code);
102
+ return {
103
+ code: code,
104
+ name: metricDef.name,
105
+ value: formatMetric(value, metricDef) || ''
106
+ };
107
+ });
108
+ return _context3.abrupt("return", resultData);
109
+
110
+ case 8:
111
+ case "end":
112
+ return _context3.stop();
113
+ }
114
+ }
115
+ }, _callee3);
116
+ }));
117
+ return _queryLinkLatestMetrics.apply(this, arguments);
118
+ }
119
+
120
+ export function queryLinkInterfacesLatestMetrics(_x5) {
121
+ return _queryLinkInterfacesLatestMetrics.apply(this, arguments);
122
+ }
123
+
124
+ function _queryLinkInterfacesLatestMetrics() {
125
+ _queryLinkInterfacesLatestMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(linkCi) {
126
+ var _linkCi$attributes, sourceType, sourceId, destinationId, destinationType, typeCodes, queryInterfaceMetricsParam, interfaceMetrics, resultData, parseInterfaceMetrics;
127
+
128
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
129
+ while (1) {
130
+ switch (_context4.prev = _context4.next) {
131
+ case 0:
132
+ parseInterfaceMetrics = function _parseInterfaceMetric(subCiId) {
133
+ var metrics = interfaceMetrics.filter(function (metric) {
134
+ return metric.subCiId === subCiId;
135
+ });
136
+ return INTERFACE_METRIC_CODES.reduce(function (res, code) {
137
+ var _metrics$find;
138
+
139
+ var value = (_metrics$find = metrics.find(function (m) {
140
+ return m.metricCode === code;
141
+ })) === null || _metrics$find === void 0 ? void 0 : _metrics$find.metricValue;
142
+ var metricDef = ciTypeCache.getMetric(linkCi.ciType, code);
143
+ var formatValue = formatMetric(value, metricDef);
144
+ res[code] = formatValue === 'undefined' ? '-' : formatValue;
145
+ return res;
146
+ }, {});
147
+ };
148
+
149
+ _linkCi$attributes = linkCi.attributes, sourceType = _linkCi$attributes.source_type, sourceId = _linkCi$attributes.source_id, destinationId = _linkCi$attributes.destination_id, destinationType = _linkCi$attributes.destination_type;
150
+ rlog.debug('查询链路接口指标', linkCi); // 查询指标模型
151
+
152
+ typeCodes = [sourceType];
153
+ queryInterfaceMetricsParam = {
154
+ 'subCiId': [sourceId],
155
+ 'metricCode': [].concat(INTERFACE_METRIC_CODES)
156
+ };
157
+
158
+ if (destinationId) {
159
+ queryInterfaceMetricsParam.subCiId.push(destinationId);
160
+ typeCodes.push(destinationType);
161
+ }
162
+
163
+ _context4.next = 8;
164
+ return ciTypeCache.load(typeCodes);
165
+
166
+ case 8:
167
+ _context4.next = 10;
168
+ return queryLatestMetrics(queryInterfaceMetricsParam);
169
+
170
+ case 10:
171
+ interfaceMetrics = _context4.sent;
172
+ // format
173
+ resultData = {
174
+ sourceMetrics: parseInterfaceMetrics(sourceId),
175
+ destinationMetrics: destinationId ? parseInterfaceMetrics(destinationId) : null
176
+ };
177
+ rlog.debug('查询链路接口指标 结果', linkCi);
178
+ return _context4.abrupt("return", resultData);
179
+
180
+ case 14:
181
+ case "end":
182
+ return _context4.stop();
183
+ }
184
+ }
185
+ }, _callee4);
186
+ }));
187
+ return _queryLinkInterfacesLatestMetrics.apply(this, arguments);
188
+ }
@@ -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
+ }
@@ -1,6 +1,6 @@
1
1
  import _Button from "@alifd/next/es/button";
2
2
  import _Icon from "@alifd/next/es/icon";
3
- import React, { useState } from 'react';
3
+ import React, { useState, useEffect } from 'react';
4
4
  import DisplaySettingDrawer from "../../../../components/DisplaySettingDrawer";
5
5
  /**
6
6
  * 设置按钮
@@ -17,10 +17,20 @@ export default function SettingButton(props) {
17
17
  visible = _useState[0],
18
18
  setVisible = _useState[1];
19
19
 
20
+ var topoModState = topo.store.useModelState('topoMod');
21
+ var graphLoaded = topoModState.graphLoaded;
22
+
20
23
  var changeClick = function changeClick() {
21
24
  setVisible(true);
22
25
  };
23
26
 
27
+ useEffect(function () {
28
+ if (graphLoaded) {
29
+ var _topo$viewProps$urlPa;
30
+
31
+ setVisible(!!((_topo$viewProps$urlPa = topo.viewProps.urlParams) !== null && _topo$viewProps$urlPa !== void 0 && _topo$viewProps$urlPa.showSetting));
32
+ }
33
+ }, [graphLoaded]);
24
34
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
25
35
  style: style,
26
36
  onClick: changeClick,