@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
@@ -16,25 +16,28 @@ export default function LindInfoPreview(props) {
16
16
  name: "network_link.source_device_id"
17
17
  }, {
18
18
  label: "源节点IP",
19
- name: "network_link.source_ipv4"
19
+ name: "network_link.source_device_ipv4"
20
20
  }, {
21
21
  label: "源端口",
22
22
  name: "source_id"
23
+ }, {
24
+ label: "源端IP",
25
+ name: "network_link.source_ipv4"
23
26
  }, {
24
27
  label: "目的节点名称",
25
28
  name: "network_link.destination_device_id"
26
29
  }, {
27
30
  label: "目的节点IP",
28
- name: "network_link.destination_ipv4"
31
+ name: "network_link.destination_device_ipv4"
29
32
  }, {
30
33
  label: "目的端口",
31
34
  name: "destination_id"
35
+ }, {
36
+ label: "目的端IP",
37
+ name: "network_link.destination_ipv4"
32
38
  }, {
33
39
  label: "取值端口",
34
40
  name: "network_link.value_port"
35
- }, {
36
- label: "链接方式",
37
- name: "network_link.connect_type"
38
41
  }, {
39
42
  label: "实际带宽",
40
43
  name: "network_link.actual_bandwidth"
@@ -59,10 +62,6 @@ export default function LindInfoPreview(props) {
59
62
  if (name === "network_link.value_port") {
60
63
  value = "源端口";
61
64
  }
62
-
63
- if (name === "network_link.connect_type") {
64
- value = data.attributes[name] === "exit" ? "出口" : "物理/聚合";
65
- }
66
65
  } else {
67
66
  value = "-";
68
67
  }
@@ -0,0 +1,59 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { forwardRef, useEffect, useState } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import ResourceDiplayInfoSetting from "../../../../core/components/ResourceViewAttributeSetting/Setting";
5
+ import rlog from '@riil-frontend/component-topology-utils/lib/rlog';
6
+ /**
7
+ * 链路标注、悬浮框设置
8
+ */
9
+
10
+ var LinkAttrCustomSettingDrawer = /*#__PURE__*/forwardRef(function (props, ref) {
11
+ var topo = props.topo,
12
+ showType = props.showType,
13
+ value = props.value;
14
+
15
+ var _useState = useState({}),
16
+ data = _useState[0],
17
+ setData = _useState[1];
18
+
19
+ var queryData = function queryData() {
20
+ rlog.info('链路属性配置:加载数据');
21
+ var valueData = value.data || {};
22
+ var result = {};
23
+ topo.elementTagTipConfig.getLinkConfigItems().forEach(function (item) {
24
+ var valueAttrs = valueData[item.id] || [];
25
+ result[item.id] = {
26
+ code: item.id,
27
+ name: item.label,
28
+ icon: 'networkLink',
29
+ list: item.list.map(function (listItem) {
30
+ var code = listItem.code.split(':')[1];
31
+ return {
32
+ id: listItem.code.split(':')[1] + "-" + listItem.type,
33
+ code: code,
34
+ name: listItem.name,
35
+ type: listItem.type,
36
+ tag: !!valueAttrs.find(function (a) {
37
+ return a.code === code && a.type === listItem.type;
38
+ }),
39
+ tip: !!valueAttrs.find(function (a) {
40
+ return a.code === code && a.type === listItem.type;
41
+ })
42
+ };
43
+ })
44
+ };
45
+ });
46
+ setData(result);
47
+ return result;
48
+ };
49
+
50
+ return /*#__PURE__*/React.createElement(ResourceDiplayInfoSetting, _extends({
51
+ ref: ref
52
+ }, props, {
53
+ data: data,
54
+ queryData: queryData
55
+ }));
56
+ });
57
+ LinkAttrCustomSettingDrawer.displayName = 'LinkAttrCustomSettingDrawer';
58
+ LinkAttrCustomSettingDrawer.propTypes = {};
59
+ export default LinkAttrCustomSettingDrawer;
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import { DEFAULT_LINK_TAG_COMMON_CONFIG } from "../../../../constants/ResourceInfoDisplay";
4
4
  import BasicConfig from "../../../../core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig";
5
- import ResourceDiplayInfoSetting from "../../../../core/components/ResourceViewAttributeSetting/Setting";
5
+ import LinkAttrCustomSettingDrawer from "./LinkAttrCustomSettingDrawer";
6
6
  import LinkTagCommonRidioGroup from "./LinkTagCommonRidioGroup"; // 默认中可配置内容包括总速率、带宽利用率、发送速率、发送带宽利用率、接收速率、接收带宽利用率
7
7
 
8
8
  var CommonOptions = [{
@@ -65,20 +65,26 @@ function LinkTagV2(props, ref) {
65
65
  }
66
66
  };
67
67
 
68
+ var LinkTagCommonRidioGroupWrapper = function LinkTagCommonRidioGroupWrapper(aaProps) {
69
+ return /*#__PURE__*/React.createElement(LinkTagCommonRidioGroup, _extends({}, aaProps, {
70
+ value: value ? value.type : undefined
71
+ }));
72
+ };
73
+
68
74
  return /*#__PURE__*/React.createElement(BasicConfig, _extends({
69
75
  ref: ref
70
76
  }, props, {
71
77
  value: value ? _extends({}, value, {
72
- data: value.type
78
+ data: value.data
73
79
  }) : value,
74
80
  limit: 2,
75
81
  elementType: "link",
76
82
  showType: "tag",
77
83
  commonOptions: CommonOptions,
78
84
  defaultCommonConfig: DEFAULT_LINK_TAG_COMMON_CONFIG,
79
- commonSelectWidget: LinkTagCommonRidioGroup,
85
+ commonSelectWidget: LinkTagCommonRidioGroupWrapper,
80
86
  customSettingDrawer: function customSettingDrawer(params) {
81
- return /*#__PURE__*/React.createElement(ResourceDiplayInfoSetting, params);
87
+ return /*#__PURE__*/React.createElement(LinkAttrCustomSettingDrawer, params);
82
88
  },
83
89
  onChange: handleChange
84
90
  }));
@@ -4,7 +4,8 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import topoService from "@riil-frontend/component-topology-common/es/services/topo";
5
5
  import { getLinksDetail } from "../core/models/utils/linkUtils";
6
6
  import { queryCisByIds } from "../core/services";
7
- import { addTopoDataResourcePermission } from "./utils/resourcePermissionUtil";
7
+ import { addTopoDataResourcePermission } from "./utils/resourcePermissionUtil"; // import "./utils/__tests__/resourcePermissionUtil.test";
8
+
8
9
  export function addLinkData(_x, _x2) {
9
10
  return _addLinkData.apply(this, arguments);
10
11
  }
@@ -39,12 +40,8 @@ function _addLinkData() {
39
40
  case 3:
40
41
  links = _context.sent;
41
42
  return _context.abrupt("return", {
42
- links: links.filter(function (link) {
43
- return link.attributes['network_link.connect_type'] !== 'agg';
44
- }),
45
- linkGroups: links.filter(function (link) {
46
- return link.attributes['network_link.connect_type'] === 'agg';
47
- })
43
+ links: links,
44
+ linkGroups: []
48
45
  });
49
46
 
50
47
  case 5:
@@ -83,7 +80,6 @@ function _buildData() {
83
80
  switch (_context2.prev = _context2.next) {
84
81
  case 0:
85
82
  newData = _extends({}, data);
86
- newData = fixAlarmConfig(newData);
87
83
  nodes = (data.nodes || [] // 修正容器找不到时groupId设为空
88
84
  ).map(function (node) {
89
85
  var groupExisted = !!(data.groups || []).filter(function (g) {
@@ -93,13 +89,13 @@ function _buildData() {
93
89
  groupId: groupExisted ? node.groupId : null
94
90
  });
95
91
  });
96
- _context2.next = 5;
92
+ _context2.next = 4;
97
93
  return Promise.all([// 查询节点属性
98
94
  queryCisByIds(nodes.map(function (node) {
99
95
  return node.id;
100
96
  })), addLinkData(data.links || [], nodes)]);
101
97
 
102
- case 5:
98
+ case 4:
103
99
  _yield$Promise$all = _context2.sent;
104
100
  nodeCis = _yield$Promise$all[0];
105
101
  linkData = _yield$Promise$all[1];
@@ -121,7 +117,7 @@ function _buildData() {
121
117
  newData = addTopoDataResourcePermission(newData);
122
118
  return _context2.abrupt("return", newData);
123
119
 
124
- case 12:
120
+ case 11:
125
121
  case "end":
126
122
  return _context2.stop();
127
123
  }
@@ -156,14 +152,15 @@ function _getTopoData() {
156
152
  return _context3.abrupt("return", data);
157
153
 
158
154
  case 5:
159
- _context3.next = 7;
155
+ data = fixAlarmConfig(data);
156
+ _context3.next = 8;
160
157
  return buildData(data);
161
158
 
162
- case 7:
159
+ case 8:
163
160
  data = _context3.sent;
164
161
  return _context3.abrupt("return", data);
165
162
 
166
- case 9:
163
+ case 10:
167
164
  case "end":
168
165
  return _context3.stop();
169
166
  }
@@ -42,14 +42,15 @@ export default (function (_ref) {
42
42
 
43
43
  var doDeleteLink = /*#__PURE__*/function () {
44
44
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(link, edge) {
45
- var id, isAgg, success, htTopo, edgesInNodes, edgeGroupData, edgeData, _topo$store$getModel, topoState, topoDispatchers, _topoState$data, links, linkGroups;
45
+ var id, isGroup, success, htTopo, edgesInNodes, edgeGroupData, edgeData, _topo$store$getModel, topoState, topoDispatchers, _topoState$data, links, linkGroups;
46
46
 
47
47
  return _regeneratorRuntime.wrap(function _callee$(_context) {
48
48
  while (1) {
49
49
  switch (_context.prev = _context.next) {
50
50
  case 0:
51
51
  id = link.id;
52
- isAgg = isAggLink(link);
52
+ isGroup = false; // isAggLink(link);
53
+
53
54
  _context.next = 4;
54
55
  return linkService.deleteLink(id);
55
56
 
@@ -68,12 +69,13 @@ export default (function (_ref) {
68
69
  case 8:
69
70
  _Message.success('删除成功');
70
71
 
72
+ topo.historyManager.setDisabled(true, '删除链路');
71
73
  htTopo = topo.getHtTopo(); // 获取两个节点间的连线数据列表
72
74
 
73
75
  edgesInNodes = htTopo.getEdgeDatasInNodes(edge.getSource(), edge.getTarget());
74
76
 
75
77
  if (edgesInNodes.length >= 2) {
76
- if (isAgg) {
78
+ if (isGroup) {
77
79
  htTopo.setEdgeGroupData(edge.getSource(), edge.getTarget(), null);
78
80
  } else {
79
81
  htTopo.deleteEdge(edge);
@@ -83,10 +85,10 @@ export default (function (_ref) {
83
85
  edgeGroupData = htTopo.getEdgeGroupData(edge.getSource(), edge.getTarget());
84
86
  edgeData = htTopo.getEdgeData(edge);
85
87
 
86
- if (isAgg && edgeData) {
88
+ if (isGroup && edgeData) {
87
89
  // 当前是连线组代理 且 有连线数据,清空组数据
88
90
  htTopo.setEdgeGroupData(edge.getSource(), edge.getTarget(), null);
89
- } else if (!isAgg && edgeGroupData) {
91
+ } else if (!isGroup && edgeGroupData) {
90
92
  htTopo.setEdgeData(edge, null);
91
93
  } else {
92
94
  htTopo.deleteEdge(edge);
@@ -96,7 +98,7 @@ export default (function (_ref) {
96
98
 
97
99
  _topo$store$getModel = topo.store.getModel('topoMod'), topoState = _topo$store$getModel[0], topoDispatchers = _topo$store$getModel[1];
98
100
  _topoState$data = topoState.data, links = _topoState$data.links, linkGroups = _topoState$data.linkGroups;
99
- _context.next = 16;
101
+ _context.next = 17;
100
102
  return topoDispatchers.update({
101
103
  data: _extends({}, topoState.data, {
102
104
  links: links.filter(function (item) {
@@ -108,11 +110,12 @@ export default (function (_ref) {
108
110
  })
109
111
  });
110
112
 
111
- case 16:
113
+ case 17:
112
114
  // 刷新链路动态线宽
113
115
  topo.linkDynamicStyleExecutor.execute();
116
+ topo.historyManager.setDisabled(false, '删除链路');
114
117
 
115
- case 17:
118
+ case 19:
116
119
  case "end":
117
120
  return _context.stop();
118
121
  }
@@ -71,7 +71,7 @@ export default function useRelateTopo(params) {
71
71
  break;
72
72
  }
73
73
 
74
- console.error('关联拓扑图不存在:', topoId);
74
+ rlog.error('关联拓扑图不存在:', topoId);
75
75
  return _context.abrupt("return");
76
76
 
77
77
  case 4:
@@ -54,6 +54,7 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
54
54
  var _this = this;
55
55
 
56
56
  var topo = this.topo;
57
+ topo.historyManager && topo.historyManager.setDisabled(true, '链路动态样式');
57
58
 
58
59
  var _topo$dataModel$getDa = topo.dataModel.getData(),
59
60
  links = _topo$dataModel$getDa.links,
@@ -123,6 +124,7 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
123
124
  rlog.error('连线组未关联链路并可见,设置线宽:异常', edge, error);
124
125
  }
125
126
  });
127
+ topo.historyManager && topo.historyManager.setDisabled(false, '链路动态样式');
126
128
  }
127
129
  /**
128
130
  * 处理单个连线组切换。有链路时设置
@@ -3,10 +3,10 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
4
  import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
5
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
6
7
  import TopoApp from "../../core/models/TopoApp";
7
8
  import createMenuCommands from "../../contextmenu/createMenuCommands";
8
9
  import getTopoData from "../getTopoData";
9
- import rlog from '@riil-frontend/component-topology-utils/es/rlog';
10
10
  import customStoreModels from "../store";
11
11
  import { DEFAULT_LINK_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay"; // import LinkTagsTipsBuilder from './LinkTagsTipsBuilder';
12
12
 
@@ -6,16 +6,18 @@ import { request } from '@riil-frontend/component-topology-utils';
6
6
  export default _extends({}, topoService, {
7
7
  // 获取有权限的拓扑树
8
8
  getTopoTreeByLoginUser: function getTopoTreeByLoginUser(params) {
9
- var _this = this;
10
-
11
9
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
12
10
  return _regeneratorRuntime.wrap(function _callee$(_context) {
13
11
  while (1) {
14
12
  switch (_context.prev = _context.next) {
15
13
  case 0:
16
- return _context.abrupt("return", _this.getTopoTree(params));
14
+ _context.next = 2;
15
+ return request.get('/topo/v1/api/menuByLoginUser');
16
+
17
+ case 2:
18
+ return _context.abrupt("return", _context.sent);
17
19
 
18
- case 1:
20
+ case 3:
19
21
  case "end":
20
22
  return _context.stop();
21
23
  }
@@ -156,10 +156,10 @@ export default {
156
156
  // const idtxt = `'${ids[0]}','${ids[1]}'`;
157
157
  stag = ids[0];
158
158
  ttag = ids[1];
159
- condition = "type('network_link') && network_link.connect_type = 'exit' && network_link.source_device_id ='" + stag + "'";
159
+ condition = "type('network_link') && !network_link.destination_device_id && network_link.source_device_id ='" + stag + "'";
160
160
 
161
161
  if (ttag) {
162
- condition = "type('network_link') && network_link.connect_type = 'exit' && network_link.source_device_id ='" + stag + "' && network_link.destination_device_id='" + ttag + "'";
162
+ condition = "type('network_link') && !network_link.destination_device_id && network_link.source_device_id ='" + stag + "' && network_link.destination_device_id='" + ttag + "'";
163
163
  }
164
164
 
165
165
  parm = {
@@ -83,13 +83,16 @@ export default {
83
83
  return _this.refreshTopoTree();
84
84
 
85
85
  case 18:
86
+ if (id) {
87
+ // 左侧树切换选中
88
+ dispatch.topoTreeMod.selectNode(id);
89
+ }
90
+
86
91
  if (!(viewType === 'create')) {
87
92
  _context.next = 24;
88
93
  break;
89
94
  }
90
95
 
91
- // 左侧树切换选中
92
- dispatch.topoTreeMod.selectNode(id);
93
96
  _context.next = 22;
94
97
  return _this.openCreateTopoPage({
95
98
  id: id
@@ -2,7 +2,7 @@ import _Message from "@alifd/next/es/message";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _extends from "@babel/runtime/helpers/extends";
4
4
  import _regeneratorRuntime from "@babel/runtime/regenerator";
5
- import topoServer from '@riil-frontend/component-topology-common/es/services/topo';
5
+ import topoService from "../services";
6
6
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
7
7
  import { formatTree, loopTree, loopTreeFun, findParentIdsById, treeNodeCount } from "../../utils/tree";
8
8
 
@@ -46,7 +46,7 @@ export default function (topoApp) {
46
46
  case 0:
47
47
  id = payload.id;
48
48
  _context.next = 3;
49
- return topoServer.getTopoTree();
49
+ return _this.getTopoTree();
50
50
 
51
51
  case 3:
52
52
  resTreeData = _context.sent;
@@ -72,24 +72,65 @@ export default function (topoApp) {
72
72
  }, _callee);
73
73
  }))();
74
74
  },
75
+ getTopoTree: function getTopoTree(payload, rootState) {
76
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
77
+ var showAllTree, resTreeData;
78
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
79
+ while (1) {
80
+ switch (_context2.prev = _context2.next) {
81
+ case 0:
82
+ // 拓扑中心 如果有管理导航树权限,展示完整拓扑树
83
+ showAllTree = topoApp.options.full && rootState.functionAuth.permissions.manageNavTree;
84
+
85
+ if (!showAllTree) {
86
+ _context2.next = 7;
87
+ break;
88
+ }
89
+
90
+ _context2.next = 4;
91
+ return topoService.getTopoTree();
92
+
93
+ case 4:
94
+ resTreeData = _context2.sent;
95
+ _context2.next = 10;
96
+ break;
97
+
98
+ case 7:
99
+ _context2.next = 9;
100
+ return topoService.getTopoTreeByLoginUser();
101
+
102
+ case 9:
103
+ resTreeData = _context2.sent;
104
+
105
+ case 10:
106
+ return _context2.abrupt("return", resTreeData);
107
+
108
+ case 11:
109
+ case "end":
110
+ return _context2.stop();
111
+ }
112
+ }
113
+ }, _callee2);
114
+ }))();
115
+ },
75
116
  getSelectedTopoId: function getSelectedTopoId(payload, rootState) {
76
117
  return rootState.topoTreeMod.selectedNode[0];
77
118
  },
78
119
  refreshTree: function refreshTree(payload, rootState) {
79
120
  var _this2 = this;
80
121
 
81
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
122
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
82
123
  var resTreeData, _formatTree2, treeData, defId;
83
124
 
84
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
125
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
85
126
  while (1) {
86
- switch (_context2.prev = _context2.next) {
127
+ switch (_context3.prev = _context3.next) {
87
128
  case 0:
88
- _context2.next = 2;
89
- return topoServer.getTopoTree();
129
+ _context3.next = 2;
130
+ return _this2.getTopoTree();
90
131
 
91
132
  case 2:
92
- resTreeData = _context2.sent;
133
+ resTreeData = _context3.sent;
93
134
  // 格式化tree数据
94
135
  _formatTree2 = formatTree(resTreeData, rootState.functionAuth.permissions), treeData = _formatTree2[0], defId = _formatTree2[1];
95
136
 
@@ -101,31 +142,31 @@ export default function (topoApp) {
101
142
 
102
143
  case 5:
103
144
  case "end":
104
- return _context2.stop();
145
+ return _context3.stop();
105
146
  }
106
147
  }
107
- }, _callee2);
148
+ }, _callee3);
108
149
  }))();
109
150
  },
110
151
  editTopoOnTree: function editTopoOnTree(conditions, state) {
111
152
  var _this3 = this;
112
153
 
113
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
154
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
114
155
  var resTreeData, treeData;
115
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
156
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
116
157
  while (1) {
117
- switch (_context3.prev = _context3.next) {
158
+ switch (_context4.prev = _context4.next) {
118
159
  case 0:
119
160
  if (conditions === void 0) {
120
161
  conditions = {};
121
162
  }
122
163
 
123
164
  rlog.debug('editTopoOnTree', conditions);
124
- _context3.next = 4;
125
- return topoServer.editTopoonTree(parseInt(conditions.id, 10), conditions.name, conditions.type);
165
+ _context4.next = 4;
166
+ return topoService.editTopoonTree(parseInt(conditions.id, 10), conditions.name, conditions.type);
126
167
 
127
168
  case 4:
128
- resTreeData = _context3.sent;
169
+ resTreeData = _context4.sent;
129
170
  treeData = clone(state.topoTreeMod.treeData);
130
171
 
131
172
  if (resTreeData) {
@@ -147,10 +188,10 @@ export default function (topoApp) {
147
188
 
148
189
  case 7:
149
190
  case "end":
150
- return _context3.stop();
191
+ return _context4.stop();
151
192
  }
152
193
  }
153
- }, _callee3);
194
+ }, _callee4);
154
195
  }))();
155
196
  },
156
197
 
@@ -182,34 +223,34 @@ export default function (topoApp) {
182
223
  * @param {*} state
183
224
  */
184
225
  deleteTopoOnTree: function deleteTopoOnTree(conditions, state) {
185
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
226
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
186
227
  var currentTopoId, isDeleteCurrentP;
187
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
228
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
188
229
  while (1) {
189
- switch (_context4.prev = _context4.next) {
230
+ switch (_context5.prev = _context5.next) {
190
231
  case 0:
191
232
  rlog.debug('deleteTopoOnTree', conditions, state, dispatch.topoMod);
192
233
  currentTopoId = state.topoMod.topoId;
193
234
 
194
235
  if (!("" + conditions === "" + currentTopoId)) {
195
- _context4.next = 13;
236
+ _context5.next = 13;
196
237
  break;
197
238
  }
198
239
 
199
240
  rlog.debug('deleteTopo-currentTopo', conditions);
200
- _context4.next = 6;
241
+ _context5.next = 6;
201
242
  return dispatch.topoMod.updateDelId("" + conditions);
202
243
 
203
244
  case 6:
204
- _context4.next = 8;
245
+ _context5.next = 8;
205
246
  return topoApp.alarm.close();
206
247
 
207
248
  case 8:
208
- _context4.next = 10;
209
- return topoServer.deleteTopoonTree(parseInt(conditions, 10));
249
+ _context5.next = 10;
250
+ return topoService.deleteTopoonTree(parseInt(conditions, 10));
210
251
 
211
252
  case 10:
212
- return _context4.abrupt("return", _context4.sent);
253
+ return _context5.abrupt("return", _context5.sent);
213
254
 
214
255
  case 13:
215
256
  // 判断删除的拓扑或文件,是否包含当前拓扑,如果包含就先关闭告警
@@ -221,48 +262,48 @@ export default function (topoApp) {
221
262
  });
222
263
 
223
264
  if (!isDeleteCurrentP) {
224
- _context4.next = 18;
265
+ _context5.next = 18;
225
266
  break;
226
267
  }
227
268
 
228
- _context4.next = 18;
269
+ _context5.next = 18;
229
270
  return topoApp.alarm.close();
230
271
 
231
272
  case 18:
232
- _context4.next = 20;
233
- return topoServer.deleteTopoonTree(parseInt(conditions, 10));
273
+ _context5.next = 20;
274
+ return topoService.deleteTopoonTree(parseInt(conditions, 10));
234
275
 
235
276
  case 20:
236
- return _context4.abrupt("return", _context4.sent);
277
+ return _context5.abrupt("return", _context5.sent);
237
278
 
238
279
  case 21:
239
280
  case "end":
240
- return _context4.stop();
281
+ return _context5.stop();
241
282
  }
242
283
  }
243
- }, _callee4);
284
+ }, _callee5);
244
285
  }))();
245
286
  },
246
287
  setDefTopoOnTree: function setDefTopoOnTree(conditions, state) {
247
288
  var _this4 = this;
248
289
 
249
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
290
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
250
291
  var resTreeData;
251
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
292
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
252
293
  while (1) {
253
- switch (_context5.prev = _context5.next) {
294
+ switch (_context6.prev = _context6.next) {
254
295
  case 0:
255
296
  if (conditions === void 0) {
256
297
  conditions = {};
257
298
  }
258
299
 
259
300
  rlog.debug('setDefTopoOnTree', conditions);
260
- _context5.next = 4;
261
- return topoServer.setDefTopo(parseInt(conditions, 10));
301
+ _context6.next = 4;
302
+ return topoService.setDefTopo(parseInt(conditions, 10));
262
303
 
263
304
  case 4:
264
- resTreeData = _context5.sent;
265
- _context5.next = 7;
305
+ resTreeData = _context6.sent;
306
+ _context6.next = 7;
266
307
  return _this4.refreshTree();
267
308
 
268
309
  case 7:
@@ -270,10 +311,10 @@ export default function (topoApp) {
270
311
 
271
312
  case 8:
272
313
  case "end":
273
- return _context5.stop();
314
+ return _context6.stop();
274
315
  }
275
316
  }
276
- }, _callee5);
317
+ }, _callee6);
277
318
  }))();
278
319
  },
279
320
  setDefaultTopoId: function setDefaultTopoId(defaultTopoId) {