@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
@@ -13,6 +13,24 @@ import { queryCisByIds, queryModelAsset } from "../../services"; // const interf
13
13
  // },
14
14
  // };
15
15
 
16
+ /**
17
+ * 是否关键链路
18
+ * @param {*} link
19
+ * @returns
20
+ */
21
+
22
+ export function isCrucialLink(link) {
23
+ return !!link.attributes['network_link.is_crucial'];
24
+ }
25
+ /**
26
+ * 是否出口链路
27
+ * @param {*} link
28
+ * @returns
29
+ */
30
+
31
+ export function isExitLink(link) {
32
+ return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes['network_link.destination_device_id']);
33
+ }
16
34
  export function isAggLink(link) {
17
35
  return link.attributes["network_link.connect_type"] === "agg";
18
36
  }
@@ -21,6 +21,9 @@ export default function (topo) {
21
21
  alarmDatas: [],
22
22
  alarmPanelIsOpen: false,
23
23
  risks: [],
24
+ // 风险
25
+ // 关联拓扑最高告警级别
26
+ relateTopoAlarm: {},
24
27
  currentTopoId: undefined
25
28
  },
26
29
  // 定义改变该模型状态的纯函数
@@ -44,7 +47,8 @@ export default function (topo) {
44
47
  alarmDoc: {},
45
48
  alarmList: [],
46
49
  alarmRecord: [],
47
- risks: []
50
+ risks: [],
51
+ relateTopoAlarm: {}
48
52
  });
49
53
 
50
54
  return _context.abrupt("return", "resetAlarmDoc Over");
@@ -63,14 +63,14 @@ export default function (topoApp) {
63
63
  params = {};
64
64
  }
65
65
 
66
- rlog.debug("topoMod.init 初始化...", {
67
- params: params,
68
- rootState: rootState
69
- });
70
66
  topoModState = rootState.topoMod; // 处理URL参数
71
67
 
72
68
  type = params.type || "view";
73
69
  id = params.id || topoModState.topoId || "";
70
+ rlog.debug("topoMod.init \u521D\u59CB\u5316(" + id + ")...", {
71
+ params: params,
72
+ rootState: rootState
73
+ });
74
74
 
75
75
  _this.update({
76
76
  viewState: type,
@@ -428,7 +428,7 @@ export default function (topoApp) {
428
428
  result = parseTopoData(result);
429
429
  rlog.debug("topoMod.initTopoData 查询数据完成", topoId, linkTo, result);
430
430
  _context6.next = 41;
431
- return Promise.all([topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)), dispatch.customIcon.loadCustomIcons() // topoApp.elementTagTipConfig.init(result), // 暂停新配置开发
431
+ return Promise.all([topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)), dispatch.customIcon.loadCustomIcons(), topoApp.elementTagTipConfig.init(result) // 暂停新配置开发
432
432
  ]);
433
433
 
434
434
  case 41:
@@ -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
  }
@@ -1,259 +1,61 @@
1
- import _Drawer from "@alifd/next/es/drawer";
2
1
  import _extends from "@babel/runtime/helpers/extends";
3
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
- import _regeneratorRuntime from "@babel/runtime/regenerator";
5
- import { TopoEvent } from '@riil-frontend/component-topology-graph';
6
- import PropTypes from 'prop-types';
7
- import React, { useEffect, useState } from 'react';
2
+ import React from 'react';
8
3
  import Tab from "../../../../../components/FullheightTab";
9
- import service from "../../../../services/overview";
10
4
  import ClusterMemberTable from "./components/ClusterMemberTable";
11
- import Title from "./components/DrawerTitle";
12
5
  import ResourceOverview from "./components/ResourceOverview";
13
6
  import WebConsole from "./components/WebConsole/WebConsoleContainer";
14
- import styles from "./index.module.scss"; // 基本信息
7
+ import styles from "./index.module.scss";
8
+ export default function ResourceDetail(props) {
9
+ var _topo$viewProps, _topo$viewProps$topoC;
15
10
 
16
- function ResourceDetail(props) {
17
11
  var topo = props.topo,
18
- canShow = props.canShow;
19
-
20
- var _topo$store$useModel = topo.store.useModel('topoBaseInfoOverview'),
21
- topoState = _topo$store$useModel[0],
22
- topoDispatchers = _topo$store$useModel[1];
23
-
24
- var _topo$store$useModelS = topo.store.useModelState('topoMod'),
25
- topoId = _topo$store$useModelS.topoId,
26
- topoModData = _topo$store$useModelS.data;
27
-
28
- var _topo$store$useModelS2 = topo.store.useModelState("lock"),
29
- lock = _topo$store$useModelS2.lock;
30
-
31
- var _useState = useState(false),
32
- visible = _useState[0],
33
- setVisible = _useState[1];
34
-
35
- var _useState2 = useState({
36
- id: '',
37
- name: '',
38
- type: '',
39
- // 类型: node、link
40
- ciType: '',
41
- ciName: ''
42
- }),
43
- activeData = _useState2[0],
44
- setActiveData = _useState2[1];
45
-
46
- var _useState3 = useState(''),
47
- userId = _useState3[0],
48
- setUserId = _useState3[1];
49
-
50
- var resourceData = topo.dataModel.useDataById(activeData.id);
51
- useEffect(function () {
52
- var notifier = topo.view.topoClient.notifier;
53
- notifier.on(TopoEvent.EVENT_DOUBLE_CLICK, openOverview);
54
- notifier.on('topo_element_click', changeOverview);
55
- return function () {
56
- notifier.off(TopoEvent.EVENT_DOUBLE_CLICK, openOverview);
57
- notifier.off('topo_element_click', changeOverview); // 清除数据
58
-
59
- topoDispatchers.update({
60
- id: '',
61
- metricCodes: []
62
- });
63
- };
64
- }, [lock]); // 解决切换拓扑图隐藏概览
65
-
66
- useEffect(function () {
67
- setVisible(false); // TODO 其他数据重置
68
- }, [topoId]);
69
-
70
- function getUser() {
71
- return _getUser.apply(this, arguments);
72
- } // select切换
73
-
74
-
75
- function _getUser() {
76
- _getUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
77
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
78
- while (1) {
79
- switch (_context2.prev = _context2.next) {
80
- case 0:
81
- setUserId(function (prev) {
82
- console.log('获取用户id', prev); // 如果已经获取过,就不再重新获取
83
-
84
- if (!prev) {
85
- _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
86
- var res;
87
- return _regeneratorRuntime.wrap(function _callee$(_context) {
88
- while (1) {
89
- switch (_context.prev = _context.next) {
90
- case 0:
91
- _context.next = 2;
92
- return service.getUserId();
93
-
94
- case 2:
95
- res = _context.sent;
96
- setUserId((res === null || res === void 0 ? void 0 : res.user_id) || '');
97
-
98
- case 4:
99
- case "end":
100
- return _context.stop();
101
- }
102
- }
103
- }, _callee);
104
- }))();
105
- }
106
-
107
- return prev;
108
- });
109
-
110
- case 1:
111
- case "end":
112
- return _context2.stop();
113
- }
114
- }
115
- }, _callee2);
12
+ userId = props.userId,
13
+ activeData = props.activeData,
14
+ resourceData = props.resourceData; // {/* <Tab.Item title="操作" key="2">操作</Tab.Item>
15
+ // <Tab.Item title="网络信息表" key="3">网络信息表</Tab.Item>
16
+ // <Tab.Item title="Web工作台" key="4">Web工作台</Tab.Item> */}
17
+
18
+ var tabBodys = [{
19
+ title: '资源概览',
20
+ content: /*#__PURE__*/React.createElement(ResourceOverview, _extends({}, props, activeData, {
21
+ userId: userId
22
+ }))
23
+ }, {
24
+ title: '集群成员',
25
+ content: /*#__PURE__*/React.createElement(ClusterMemberTable, {
26
+ data: resourceData,
27
+ topo: topo
28
+ }),
29
+ visible: !!resourceData.cluster
30
+ }, {
31
+ title: 'Web工作台',
32
+ content: /*#__PURE__*/React.createElement(WebConsole, {
33
+ data: resourceData,
34
+ topo: topo
35
+ }),
36
+ visible: activeData.type === 'node' && !!((_topo$viewProps = topo.viewProps) !== null && _topo$viewProps !== void 0 && (_topo$viewProps$topoC = _topo$viewProps.topoContext) !== null && _topo$viewProps$topoC !== void 0 && _topo$viewProps$topoC.isNetworkTopo)
37
+ }].filter(function (item) {
38
+ return item.visible !== false;
39
+ });
40
+
41
+ if (tabBodys.length === 1) {
42
+ return /*#__PURE__*/React.createElement(ResourceOverview, _extends({}, props, activeData, {
43
+ userId: userId,
44
+ style: {
45
+ overflowY: 'auto',
46
+ height: '100%'
47
+ }
116
48
  }));
117
- return _getUser.apply(this, arguments);
118
- }
119
-
120
- function onChangeActive(activeNode) {
121
- activeNode && init(_extends({}, activeNode, {
122
- type: 'node'
123
- }), 'select');
124
- } // 单击切换
125
-
126
-
127
- function changeOverview(node) {
128
- var data = node.getAttrObject();
129
- init(data, 'click');
130
- }
131
-
132
- function openOverviewByHtElement(element) {
133
- openOverview(element.getAttrObject());
134
- } // 双击打开
135
-
136
-
137
- function openOverview(data) {
138
- if (lock) {
139
- init(data, 'doubleClick');
140
- }
141
- }
142
-
143
- function init(data, targetType) {
144
- console.log('初始化基本信息', data, targetType);
145
- var id = data.id,
146
- name = data.name,
147
- type = data.type,
148
- ciType = data.ciType,
149
- ciName = data.ciName; // 仅展示资源和链路的概览
150
-
151
- var resourceData = topo.dataModel.getDataById(id);
152
-
153
- if (!resourceData) {
154
- return;
155
- }
156
-
157
- var operation = resourceData.operation,
158
- permission = resourceData.permission;
159
- if ( // 没有权限不显示
160
- !operation && !(permission !== null && permission !== void 0 && permission.readable) || // 没有citype不显示
161
- !ciType) return;
162
- var htElement = topo.getDataModel().getDataByTag(id);
163
-
164
- if (!canShow(htElement)) {
165
- return;
166
- }
167
-
168
- setActiveData({
169
- id: id,
170
- name: name,
171
- type: {
172
- linkGroup: 'link',
173
- group: 'node'
174
- }[type] || type,
175
- ciType: ciType,
176
- ciName: ciName
177
- }); // 显示隐藏
178
-
179
- targetType === 'doubleClick' && setVisible(true); // userId
180
-
181
- getUser();
182
49
  }
183
50
 
184
- var renderContent = function renderContent() {
185
- var _topo$viewProps, _topo$viewProps$viewe, _topo$viewProps$viewe2;
186
-
187
- // {/* <Tab.Item title="操作" key="2">操作</Tab.Item>
188
- // <Tab.Item title="网络信息表" key="3">网络信息表</Tab.Item>
189
- // <Tab.Item title="Web工作台" key="4">Web工作台</Tab.Item> */}
190
- var tabBodys = [{
191
- title: '资源概览',
192
- content: /*#__PURE__*/React.createElement(ResourceOverview, _extends({}, props, activeData, {
193
- userId: userId
194
- }))
195
- }, {
196
- title: '集群成员',
197
- content: /*#__PURE__*/React.createElement(ClusterMemberTable, {
198
- data: resourceData,
199
- topo: topo
200
- }),
201
- visible: resourceData.cluster
202
- }, {
203
- title: 'Web工作台',
204
- content: /*#__PURE__*/React.createElement(WebConsole, {
205
- data: resourceData,
206
- topo: topo
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
209
- }].filter(function (item) {
210
- return item.visible !== false;
211
- });
212
-
213
- if (tabBodys.length === 1) {
214
- return /*#__PURE__*/React.createElement(ResourceOverview, _extends({}, props, activeData, {
215
- userId: userId,
216
- style: {
217
- overflowY: 'auto',
218
- height: '100%'
219
- }
220
- }));
221
- }
222
-
223
- return /*#__PURE__*/React.createElement("div", {
224
- className: styles.tabContainer
225
- }, /*#__PURE__*/React.createElement(Tab, {
226
- className: styles.tab
227
- }, tabBodys.map(function (item, key) {
228
- return /*#__PURE__*/React.createElement(Tab.Item, {
229
- title: item.title,
230
- key: item.title
231
- }, item.content);
232
- })));
233
- };
234
-
235
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Drawer, {
236
- className: styles.baseInfo,
237
- closeMode: ['close', 'esc'],
238
- visible: visible,
239
- title: /*#__PURE__*/React.createElement(Title, _extends({}, activeData, {
240
- topo: topo,
241
- onChange: onChangeActive
242
- })),
243
- width: 580,
244
- hasMask: false,
245
- onClose: function onClose() {
246
- return setVisible(false);
247
- }
248
- }, visible && resourceData && renderContent()));
249
- }
250
-
251
- ResourceDetail.propTypes = {
252
- canShow: PropTypes.func
253
- };
254
- ResourceDetail.defaultProps = {
255
- canShow: function canShow(htElement) {
256
- return true;
257
- }
258
- };
259
- export default ResourceDetail;
51
+ return /*#__PURE__*/React.createElement("div", {
52
+ className: styles.tabContainer
53
+ }, /*#__PURE__*/React.createElement(Tab, {
54
+ className: styles.tab
55
+ }, tabBodys.map(function (item, key) {
56
+ return /*#__PURE__*/React.createElement(Tab.Item, {
57
+ title: item.title,
58
+ key: item.title
59
+ }, item.content);
60
+ })));
61
+ }
@@ -0,0 +1,218 @@
1
+ import _Drawer from "@alifd/next/es/drawer";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
+ import { TopoEvent } from '@riil-frontend/component-topology-graph';
6
+ import PropTypes from 'prop-types';
7
+ import React, { useEffect, useId, useState } from 'react';
8
+ import Tab from "../../../../../components/FullheightTab";
9
+ import service from "../../../../services/overview";
10
+ import ClusterMemberTable from "./components/ClusterMemberTable";
11
+ import Title from "./components/DrawerTitle";
12
+ import ResourceOverview from "./components/ResourceOverview";
13
+ import WebConsole from "./components/WebConsole/WebConsoleContainer";
14
+ import styles from "./index.module.scss";
15
+ import ResourceDetail from "./ResourceDetail"; // 基本信息
16
+
17
+ function ResourceDetailDrawer(props) {
18
+ var topo = props.topo,
19
+ canShow = props.canShow;
20
+
21
+ var _topo$store$useModel = topo.store.useModel('topoBaseInfoOverview'),
22
+ topoState = _topo$store$useModel[0],
23
+ topoDispatchers = _topo$store$useModel[1];
24
+
25
+ var _topo$store$useModelS = topo.store.useModelState('topoMod'),
26
+ topoId = _topo$store$useModelS.topoId,
27
+ topoModData = _topo$store$useModelS.data;
28
+
29
+ var _topo$store$useModelS2 = topo.store.useModelState("lock"),
30
+ lock = _topo$store$useModelS2.lock;
31
+
32
+ var _useState = useState(false),
33
+ visible = _useState[0],
34
+ setVisible = _useState[1];
35
+
36
+ var _useState2 = useState({
37
+ id: '',
38
+ name: '',
39
+ type: '',
40
+ // 类型: node、link
41
+ ciType: '',
42
+ ciName: ''
43
+ }),
44
+ activeData = _useState2[0],
45
+ setActiveData = _useState2[1];
46
+
47
+ var _useState3 = useState(''),
48
+ userId = _useState3[0],
49
+ setUserId = _useState3[1];
50
+
51
+ var resourceData = topo.dataModel.useDataById(activeData.id);
52
+ useEffect(function () {
53
+ var notifier = topo.view.topoClient.notifier;
54
+ notifier.on(TopoEvent.EVENT_DOUBLE_CLICK, openOverview);
55
+ notifier.on('topo_element_click', changeOverview);
56
+ return function () {
57
+ notifier.off(TopoEvent.EVENT_DOUBLE_CLICK, openOverview);
58
+ notifier.off('topo_element_click', changeOverview); // 清除数据
59
+
60
+ topoDispatchers.update({
61
+ id: '',
62
+ metricCodes: []
63
+ });
64
+ };
65
+ }, [lock]); // 解决切换拓扑图隐藏概览
66
+
67
+ useEffect(function () {
68
+ setVisible(false); // TODO 其他数据重置
69
+ }, [topoId]);
70
+
71
+ function getUser() {
72
+ return _getUser.apply(this, arguments);
73
+ } // select切换
74
+
75
+
76
+ function _getUser() {
77
+ _getUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
78
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
79
+ while (1) {
80
+ switch (_context2.prev = _context2.next) {
81
+ case 0:
82
+ setUserId(function (prev) {
83
+ console.log('获取用户id', prev); // 如果已经获取过,就不再重新获取
84
+
85
+ if (!prev) {
86
+ _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
87
+ var res;
88
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
89
+ while (1) {
90
+ switch (_context.prev = _context.next) {
91
+ case 0:
92
+ _context.next = 2;
93
+ return service.getUserId();
94
+
95
+ case 2:
96
+ res = _context.sent;
97
+ setUserId((res === null || res === void 0 ? void 0 : res.user_id) || '');
98
+
99
+ case 4:
100
+ case "end":
101
+ return _context.stop();
102
+ }
103
+ }
104
+ }, _callee);
105
+ }))();
106
+ }
107
+
108
+ return prev;
109
+ });
110
+
111
+ case 1:
112
+ case "end":
113
+ return _context2.stop();
114
+ }
115
+ }
116
+ }, _callee2);
117
+ }));
118
+ return _getUser.apply(this, arguments);
119
+ }
120
+
121
+ function onChangeActive(activeNode) {
122
+ activeNode && init(_extends({}, activeNode, {
123
+ type: 'node'
124
+ }), 'select');
125
+ } // 单击切换
126
+
127
+
128
+ function changeOverview(node) {
129
+ var data = node.getAttrObject();
130
+ init(data, 'click');
131
+ }
132
+
133
+ function openOverviewByHtElement(element) {
134
+ openOverview(element.getAttrObject());
135
+ } // 双击打开
136
+
137
+
138
+ function openOverview(data) {
139
+ if (lock) {
140
+ init(data, 'doubleClick');
141
+ }
142
+ }
143
+
144
+ function init(data, targetType) {
145
+ console.log('初始化基本信息', data, targetType);
146
+ var id = data.id,
147
+ name = data.name,
148
+ type = data.type,
149
+ ciType = data.ciType,
150
+ ciName = data.ciName; // 仅展示资源和链路的概览
151
+
152
+ var resourceData = topo.dataModel.getDataById(id);
153
+
154
+ if (!resourceData) {
155
+ return;
156
+ }
157
+
158
+ var operation = resourceData.operation,
159
+ permission = resourceData.permission;
160
+ if ( // 没有权限不显示
161
+ !operation && !(permission !== null && permission !== void 0 && permission.readable) || // 没有citype不显示
162
+ !ciType) return;
163
+ var htElement = topo.getDataModel().getDataByTag(id);
164
+
165
+ if (!canShow(htElement)) {
166
+ return;
167
+ }
168
+
169
+ setActiveData({
170
+ id: id,
171
+ name: name,
172
+ type: {
173
+ linkGroup: 'link',
174
+ group: 'node'
175
+ }[type] || type,
176
+ ciType: ciType,
177
+ ciName: ciName
178
+ }); // 显示隐藏
179
+
180
+ targetType === 'doubleClick' && setVisible(true); // userId
181
+
182
+ getUser();
183
+ }
184
+
185
+ var renderContent = function renderContent() {
186
+ return /*#__PURE__*/React.createElement(ResourceDetail, _extends({}, props, {
187
+ topo: topo,
188
+ userId: useId,
189
+ activeData: activeData,
190
+ resourceData: resourceData
191
+ }));
192
+ };
193
+
194
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Drawer, {
195
+ className: styles.baseInfo,
196
+ closeMode: ['close', 'esc'],
197
+ visible: visible,
198
+ title: /*#__PURE__*/React.createElement(Title, _extends({}, activeData, {
199
+ topo: topo,
200
+ onChange: onChangeActive
201
+ })),
202
+ width: 580,
203
+ hasMask: false,
204
+ onClose: function onClose() {
205
+ return setVisible(false);
206
+ }
207
+ }, visible && resourceData && renderContent()));
208
+ }
209
+
210
+ ResourceDetailDrawer.propTypes = {
211
+ canShow: PropTypes.func
212
+ };
213
+ ResourceDetailDrawer.defaultProps = {
214
+ canShow: function canShow(htElement) {
215
+ return true;
216
+ }
217
+ };
218
+ export default ResourceDetailDrawer;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
- import ResourceDetail from "./ResourceDetail";
3
+ import ResourceDetailDrawer from "./ResourceDetailDrawer";
4
4
 
5
5
  function ResourceDetailPlugin(props) {
6
6
  var viewerProps = props.viewerProps;
@@ -11,7 +11,7 @@ function ResourceDetailPlugin(props) {
11
11
  return null;
12
12
  }
13
13
 
14
- return /*#__PURE__*/React.createElement(ResourceDetail, _extends({}, props, resourceDetailProps));
14
+ return /*#__PURE__*/React.createElement(ResourceDetailDrawer, _extends({}, props, resourceDetailProps));
15
15
  }
16
16
 
17
17
  export default ResourceDetailPlugin;
@@ -56,7 +56,7 @@ export default function ClusterChildrenTable(props) {
56
56
  });
57
57
  return _extends({}, ci, {
58
58
  typeObject: ciTypeMap[ci.typeCode],
59
- memberRole: topo.dictCache.dictObject.member_role[memberRoleMetric.metricValue]
59
+ memberRole: topo.dictCache.dictObject.member_role[memberRoleMetric === null || memberRoleMetric === void 0 ? void 0 : memberRoleMetric.metricValue]
60
60
  });
61
61
  }),
62
62
  total: ciDataResult.totalRecord,
@@ -16,7 +16,6 @@ export default function BaseInfoBlock(props) {
16
16
  ciType = data.ciType,
17
17
  type = data.type,
18
18
  name = data.name;
19
- console.log('111 data', data);
20
19
  return /*#__PURE__*/React.createElement(BlockBox, {
21
20
  headerTitle: "\u57FA\u672C\u4FE1\u606F",
22
21
  headerExtra: /*#__PURE__*/React.createElement("div", {