@riil-frontend/component-topology 4.0.0-beta.9 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) 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 +32 -32
  5. package/es/components/BatchAttrMetric/setting.js +47 -7
  6. package/es/components/Drawer/Drawer.js +60 -0
  7. package/es/components/Drawer/index.js +1 -59
  8. package/es/constants/ResourceInfoDisplay.js +1 -4
  9. package/es/core/components/AlarmListPanel/components/AlarmListItem.js +31 -1
  10. package/es/core/components/AlarmListPanel/hooks/useAlarmList.js +34 -0
  11. package/es/core/components/AlarmListPanel/index.js +27 -24
  12. package/es/core/components/AlarmListPanel/index.module.scss +46 -16
  13. package/es/core/components/DisplaySettingDrawer/EdgeFlow.js +4 -6
  14. package/es/core/components/DisplaySettingDrawer/EdgeFlowDirection.js +4 -6
  15. package/es/core/components/DisplaySettingDrawer/NodeTag.js +3 -5
  16. package/es/core/components/DisplaySettingDrawer/NodeTip.js +4 -5
  17. package/es/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +3 -1
  18. package/es/core/components/DisplaySettingDrawer/tagtip/CustomSettingDrawer/CustomSetting.js +25 -0
  19. package/es/core/components/DisplaySettingDrawer/tagtip/CustomSettingDrawer/CustomSettingDrawer.js +8 -0
  20. package/es/core/components/TopoView/topoView.js +25 -1
  21. package/es/core/editor/components/settings/propertyViews/group/DataTab/GroupNodeList.js +4 -2
  22. package/es/core/editor/components/settings/propertyViews/group/DataTab/RelateData.js +0 -7
  23. package/es/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +13 -12
  24. package/es/core/editor/components/settings/propertyViews/group/GroupPropertyView.js +4 -1
  25. package/es/core/editor/components/settings/propertyViews/group/{DataTab/ClusterGroupRelateData → cluster}/ClusterGroupRelateData.js +22 -9
  26. package/es/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +2 -5
  27. package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeIcon.js +21 -0
  28. package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +5 -0
  29. package/es/core/editor/components/settings/propertyViews/node/NodePropertyView.js +3 -1
  30. package/es/core/editor/components/settings/propertyViews/node/Setting/NameInput.js +36 -0
  31. package/es/core/editor/components/settings/propertyViews/node/Setting/Setting.js +2 -2
  32. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +3 -5
  33. package/es/core/editor/components/settings/propertyViews/node/data/NodeRelateResourceButton.js +4 -2
  34. package/es/core/hooks/ht/useHtDataPropertyChangeListener.js +28 -0
  35. package/es/core/models/AttributeMetricDisplay.js +28 -10
  36. package/es/core/models/TopoApp.js +12 -7
  37. package/es/core/models/TopoGraphView.js +3 -1
  38. package/es/core/models/attributeFormatter/index.js +2 -26
  39. package/es/core/models/cache/{CiTyeCache.js → CiTypeCache.js} +3 -1
  40. package/es/core/models/tagstips/ElementTagTipConfig.js +132 -0
  41. package/es/core/models/tagstips/utils.js +44 -0
  42. package/es/core/models/utils/linkUtils.js +3 -1
  43. package/es/core/services/topo.js +30 -0
  44. package/es/core/utils/edgeUtil.js +8 -0
  45. package/es/core/utils/graphLinkUtil.js +22 -0
  46. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +1 -1
  47. package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +24 -2
  48. package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.module.scss +1 -1
  49. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +7 -101
  50. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +13 -3
  51. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +166 -89
  52. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +7 -14
  53. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +38 -13
  54. package/es/core/viewer/components/titlebar/BasicTools.js +5 -2
  55. package/es/core/viewer/components/titlebar/widgets/NodesDragSwitch.js +4 -2
  56. package/es/hooks/useAlarm.js +59 -0
  57. package/es/hooks/useEventData.js +20 -0
  58. package/es/hooks/useGraphAlarmDisplay.js +68 -18
  59. package/es/hooks/useManageStatus.js +0 -34
  60. package/es/hooks/useResourceConfig.js +6 -13
  61. package/es/hooks/useSelection.js +2 -4
  62. package/es/hooks/useTopoEdit.js +90 -37
  63. package/es/models/topoAlarm.js +8 -9
  64. package/es/models/topoMod.js +16 -8
  65. package/es/style.js +1 -0
  66. package/es/topoCenter/components/TopoView.js +6 -1
  67. package/es/topoCenter/components/Topology.js +7 -1
  68. package/es/topoCenter/components/editor/propertyViews/LayerRelatedResourceList.js +2 -2
  69. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +35 -15
  70. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +11 -2
  71. package/es/topoCenter/components/viewer/displaySetting/LinkTagCommonRidioGroup.js +24 -0
  72. package/es/topoCenter/components/viewer/displaySetting/LinkTagCommonRidioGroup.module.scss +23 -0
  73. package/es/topoCenter/components/viewer/displaySetting/LinkTagV2.js +87 -0
  74. package/es/topoCenter/getTopoData.js +18 -6
  75. package/es/topoCenter/hooks/editor/useGroupSortResources.js +16 -0
  76. package/es/topoCenter/hooks/useEdgeExpand.js +25 -0
  77. package/es/topoCenter/hooks/useLinkDynamicStyle.js +1 -1
  78. package/es/topoCenter/hooks/useTopoEdit.js +3 -0
  79. package/es/topoCenter/models/LinkDynamicStyleExecutor.js +38 -10
  80. package/es/topoCenter/models/TopoCenter.js +3 -11
  81. package/es/topoCenter/store/functionAuth.js +2 -0
  82. package/es/topoCenter/utils/SortResourcesUtil.js +3 -3
  83. package/es/topoCenter/utils/exportData.js +13 -7
  84. package/es/topoCenter/utils/linkUtil.js +8 -0
  85. package/es/utils/ResourceConfigUtil.js +4 -5
  86. package/es/utils/clusterUtil.js +27 -2
  87. package/es/utils/htElementDataUtil.js +22 -1
  88. package/es/utils/htElementUtils.js +22 -9
  89. package/es/utils/showGraphManageStatusUtil.js +67 -0
  90. package/es/utils/topoData.js +57 -32
  91. package/lib/components/BatchAttrMetric/setting.js +47 -6
  92. package/lib/components/Drawer/Drawer.js +73 -0
  93. package/lib/components/Drawer/index.js +2 -64
  94. package/lib/constants/ResourceInfoDisplay.js +1 -4
  95. package/lib/core/components/AlarmListPanel/components/AlarmListItem.js +31 -1
  96. package/lib/core/components/AlarmListPanel/hooks/useAlarmList.js +40 -0
  97. package/lib/core/components/AlarmListPanel/index.js +30 -24
  98. package/lib/core/components/AlarmListPanel/index.module.scss +46 -16
  99. package/lib/core/components/DisplaySettingDrawer/EdgeFlow.js +4 -6
  100. package/lib/core/components/DisplaySettingDrawer/EdgeFlowDirection.js +4 -6
  101. package/lib/core/components/DisplaySettingDrawer/NodeTag.js +3 -6
  102. package/lib/core/components/DisplaySettingDrawer/NodeTip.js +4 -6
  103. package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +3 -1
  104. package/lib/core/components/DisplaySettingDrawer/tagtip/CustomSettingDrawer/CustomSetting.js +39 -0
  105. package/lib/core/components/DisplaySettingDrawer/tagtip/CustomSettingDrawer/CustomSettingDrawer.js +17 -0
  106. package/lib/core/components/TopoView/topoView.js +28 -1
  107. package/lib/core/editor/components/settings/propertyViews/group/DataTab/GroupNodeList.js +4 -2
  108. package/lib/core/editor/components/settings/propertyViews/group/DataTab/RelateData.js +0 -8
  109. package/lib/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +13 -13
  110. package/lib/core/editor/components/settings/propertyViews/group/GroupPropertyView.js +5 -1
  111. package/lib/core/editor/components/settings/propertyViews/group/{DataTab/ClusterGroupRelateData → cluster}/ClusterGroupRelateData.js +23 -9
  112. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +2 -5
  113. package/lib/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeIcon.js +31 -0
  114. package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +6 -0
  115. package/lib/core/editor/components/settings/propertyViews/node/NodePropertyView.js +3 -1
  116. package/lib/core/editor/components/settings/propertyViews/node/Setting/NameInput.js +52 -0
  117. package/lib/core/editor/components/settings/propertyViews/node/Setting/Setting.js +3 -3
  118. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +3 -5
  119. package/lib/core/editor/components/settings/propertyViews/node/data/NodeRelateResourceButton.js +5 -2
  120. package/lib/core/hooks/ht/useHtDataPropertyChangeListener.js +37 -0
  121. package/lib/core/models/AttributeMetricDisplay.js +28 -10
  122. package/lib/core/models/TopoApp.js +10 -5
  123. package/lib/core/models/TopoGraphView.js +3 -1
  124. package/lib/core/models/attributeFormatter/index.js +2 -26
  125. package/lib/core/models/cache/{CiTyeCache.js → CiTypeCache.js} +3 -1
  126. package/lib/core/models/tagstips/ElementTagTipConfig.js +142 -0
  127. package/lib/core/models/tagstips/utils.js +59 -0
  128. package/lib/core/models/utils/linkUtils.js +3 -1
  129. package/lib/core/services/topo.js +40 -0
  130. package/lib/core/utils/edgeUtil.js +12 -0
  131. package/lib/core/utils/graphLinkUtil.js +27 -0
  132. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +1 -1
  133. package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +25 -2
  134. package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.module.scss +1 -1
  135. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +7 -101
  136. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +13 -3
  137. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +166 -89
  138. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +7 -14
  139. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +38 -13
  140. package/lib/core/viewer/components/titlebar/BasicTools.js +6 -2
  141. package/lib/core/viewer/components/titlebar/widgets/NodesDragSwitch.js +4 -2
  142. package/lib/hooks/useAlarm.js +61 -0
  143. package/lib/hooks/useEventData.js +28 -0
  144. package/lib/hooks/useGraphAlarmDisplay.js +69 -18
  145. package/lib/hooks/useManageStatus.js +0 -34
  146. package/lib/hooks/useResourceConfig.js +6 -12
  147. package/lib/hooks/useSelection.js +1 -5
  148. package/lib/hooks/useTopoEdit.js +94 -36
  149. package/lib/models/topoAlarm.js +8 -9
  150. package/lib/models/topoMod.js +15 -8
  151. package/lib/style.js +1 -0
  152. package/lib/topoCenter/components/TopoView.js +8 -1
  153. package/lib/topoCenter/components/Topology.js +8 -1
  154. package/lib/topoCenter/components/editor/propertyViews/LayerRelatedResourceList.js +1 -1
  155. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +35 -14
  156. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +11 -2
  157. package/lib/topoCenter/components/viewer/displaySetting/LinkTagCommonRidioGroup.js +35 -0
  158. package/lib/topoCenter/components/viewer/displaySetting/LinkTagCommonRidioGroup.module.scss +23 -0
  159. package/lib/topoCenter/components/viewer/displaySetting/LinkTagV2.js +102 -0
  160. package/lib/topoCenter/getTopoData.js +19 -6
  161. package/lib/topoCenter/hooks/editor/useGroupSortResources.js +21 -0
  162. package/lib/topoCenter/hooks/useEdgeExpand.js +33 -0
  163. package/lib/topoCenter/hooks/useLinkDynamicStyle.js +1 -1
  164. package/lib/topoCenter/hooks/useTopoEdit.js +3 -0
  165. package/lib/topoCenter/models/LinkDynamicStyleExecutor.js +38 -9
  166. package/lib/topoCenter/models/TopoCenter.js +3 -12
  167. package/lib/topoCenter/store/functionAuth.js +2 -0
  168. package/lib/topoCenter/utils/SortResourcesUtil.js +3 -3
  169. package/lib/topoCenter/utils/exportData.js +14 -7
  170. package/lib/topoCenter/utils/linkUtil.js +15 -0
  171. package/lib/utils/ResourceConfigUtil.js +4 -4
  172. package/lib/utils/clusterUtil.js +34 -2
  173. package/lib/utils/htElementDataUtil.js +38 -1
  174. package/lib/utils/htElementUtils.js +24 -9
  175. package/lib/utils/showGraphManageStatusUtil.js +78 -0
  176. package/lib/utils/topoData.js +59 -32
  177. package/package.json +5 -5
@@ -2,10 +2,9 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import topoService from "@riil-frontend/component-topology-common/es/services/topo";
5
- import { getCiMeta } from "@riil-frontend/component-topology-common/es/services/model";
6
5
  import moment from "moment";
7
6
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
8
- import { combTopoData, getAlarmSwitch, getCiTypes, parseTopoData } from "../utils/topoData";
7
+ import { combTopoData, getCiTypes, parseTopoData } from "../utils/topoData";
9
8
  import { loopTreeByKey } from "../utils/tree";
10
9
  import topoPermissonUtil from "../utils/topoPermissionUtil"; // const clone = (data) => JSON.parse(JSON.stringify(data));
11
10
 
@@ -16,6 +15,8 @@ export default function (topoApp) {
16
15
  viewState: "view",
17
16
  // view, create, 2种模式
18
17
  graphLoaded: false,
18
+ graphLoaded2: false,
19
+ // 支持编辑模式完全load完
19
20
  // 额外参数
20
21
  urlParams: {},
21
22
  topoLoadError: false,
@@ -79,6 +80,7 @@ export default function (topoApp) {
79
80
  } : null,
80
81
  topoId: id,
81
82
  graphLoaded: false,
83
+ graphLoaded2: false,
82
84
  urlParams: urlParams
83
85
  });
84
86
 
@@ -119,7 +121,8 @@ export default function (topoApp) {
119
121
  },
120
122
  reset: function reset() {
121
123
  this.update({
122
- graphLoaded: false
124
+ graphLoaded: false,
125
+ graphLoaded2: false
123
126
  });
124
127
  topoApp.close();
125
128
  },
@@ -150,6 +153,7 @@ export default function (topoApp) {
150
153
  currentTopo: playload,
151
154
  topoId: topoId,
152
155
  graphLoaded: false,
156
+ graphLoaded2: false,
153
157
  topoPermission: undefined
154
158
  });
155
159
 
@@ -187,6 +191,7 @@ export default function (topoApp) {
187
191
  clearData: function clearData() {
188
192
  this.update({
189
193
  graphLoaded: false,
194
+ graphLoaded2: false,
190
195
  topoId: "",
191
196
  topoData: null,
192
197
  currentTopo: undefined,
@@ -298,7 +303,7 @@ export default function (topoApp) {
298
303
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
299
304
  var _result$config;
300
305
 
301
- var startTime, topoId, data, linkToData, refresh, clear, linkTo, startState, permission, result, topoConfig, _yield$Promise$all, ciTypeMap, customIcons, extraConfig, _combTopoData, topoData, resAndMetrics, endTime;
306
+ var startTime, topoId, data, linkToData, refresh, clear, linkTo, startState, permission, result, topoConfig, _yield$Promise$all, ciTypeMap, customIcons, xxx, extraConfig, _combTopoData, topoData, resAndMetrics, endTime;
302
307
 
303
308
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
304
309
  while (1) {
@@ -315,6 +320,7 @@ export default function (topoApp) {
315
320
  startState = {
316
321
  loading: true,
317
322
  graphLoaded: false,
323
+ graphLoaded2: false,
318
324
  topoLoadError: false,
319
325
  linkTo: linkTo
320
326
  };
@@ -423,18 +429,20 @@ export default function (topoApp) {
423
429
  result = parseTopoData(result);
424
430
  rlog.debug("topoMod.initTopoData 查询数据完成", topoId, linkTo, result);
425
431
  _context6.next = 41;
426
- return Promise.all([topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)), dispatch.customIcon.loadCustomIcons()]);
432
+ return Promise.all([topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)), dispatch.customIcon.loadCustomIcons() // topoApp.elementTagTipConfig.init(result), // 暂停新配置开发
433
+ ]);
427
434
 
428
435
  case 41:
429
436
  _yield$Promise$all = _context6.sent;
430
437
  ciTypeMap = _yield$Promise$all[0];
431
438
  customIcons = _yield$Promise$all[1];
439
+ xxx = _yield$Promise$all[2];
432
440
  rlog.debug("topoMod.initTopoData Ci属性指标元数据", ciTypeMap);
433
441
  extraConfig = result.global.extraConfig;
434
- _context6.next = 48;
442
+ _context6.next = 49;
435
443
  return dispatch.displayConfig.setConfig(extraConfig);
436
444
 
437
- case 48:
445
+ case 49:
438
446
  _combTopoData = combTopoData({
439
447
  engine: topoApp,
440
448
  data: result,
@@ -463,7 +471,7 @@ export default function (topoApp) {
463
471
  rlog.info("topoMod.initTopoData 初始化拓扑图数据完成. 耗时: ", endTime.diff(startTime, "seconds", true));
464
472
  topoApp.options.onLoad();
465
473
 
466
- case 57:
474
+ case 58:
467
475
  case "end":
468
476
  return _context6.stop();
469
477
  }
package/es/style.js CHANGED
@@ -26,6 +26,7 @@ import '@alifd/next/es/overlay/style';
26
26
  import '@alifd/next/es/checkbox/style';
27
27
  import '@alifd/next/es/box/style';
28
28
  import '@alifd/next/es/list/style';
29
+ import '@alifd/next/es/card/style';
29
30
  import '@alifd/next/es/radio/style';
30
31
  import '@alifd/next/es/grid/style';
31
32
  import '@riil-frontend/component-action-tree/es/style';
@@ -17,6 +17,8 @@ import LinkTag from "../../core/components/DisplaySettingDrawer/LinkTag";
17
17
  import LinkTip from "../../core/components/DisplaySettingDrawer/LinkTip";
18
18
  import ViewerTools from "./viewer/titlebar/ViewerTools";
19
19
  import useEdgeFlow from "../hooks/viewer/useEdgeFlow";
20
+ import LinkTagV2 from "./viewer/displaySetting/LinkTagV2";
21
+ import useEdgeExpand from "../hooks/useEdgeExpand";
20
22
  /**
21
23
  * 拓扑组件。变化无权限、无数据显示
22
24
  */
@@ -41,6 +43,9 @@ function NetworkTopologyCore(props) {
41
43
  useEdgeFlow({
42
44
  topo: topo
43
45
  });
46
+ useEdgeExpand({
47
+ topo: topo
48
+ });
44
49
  var relateTopo = useRelateTopo({
45
50
  topo: topo
46
51
  });
@@ -111,7 +116,7 @@ function NetworkTopologyCore(props) {
111
116
  showLinkConfig: true,
112
117
  // 是否显示链路流动效果配置
113
118
  linkTagConfig: function linkTagConfig(params) {
114
- return /*#__PURE__*/React.createElement(LinkTag, params);
119
+ return /*#__PURE__*/React.createElement(LinkTagV2, params);
115
120
  },
116
121
  linkTipConfig: function linkTipConfig(params) {
117
122
  return /*#__PURE__*/React.createElement(LinkTip, params);
@@ -8,6 +8,7 @@ import LinkPropertyView from "./editor/propertyViews/edge/LinkPropertyView";
8
8
  import AddLinkDrawer from "./editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer";
9
9
  import useTopoEdit from "../hooks/useTopoEdit";
10
10
  import EdgePropertyView from "./editor/propertyViews/edge/EdgePropertyView";
11
+ import _useGroupSortResources from "../hooks/editor/useGroupSortResources";
11
12
  export default function NetworkTopologyFull(props) {
12
13
  var topo = props.topo,
13
14
  customEditorProps = props.editorProps,
@@ -17,6 +18,9 @@ export default function NetworkTopologyFull(props) {
17
18
  });
18
19
 
19
20
  var editorProps = _extends({
21
+ useGroupSortResources: function useGroupSortResources(nodes) {
22
+ return _useGroupSortResources(topo.store, nodes);
23
+ },
20
24
  layerRelatedResourceList: LayerRelatedResourceList,
21
25
  multipleElementPropertyViewProps: {
22
26
  showElementAlign: true
@@ -44,7 +48,9 @@ export default function NetworkTopologyFull(props) {
44
48
  showTools: showTools,
45
49
  elementChangeLayerByDrag: true,
46
50
  editor: {
47
- useNewElementsDeleteEvent: true
51
+ useNewElementsDeleteEvent: true,
52
+ // 通过数仓【添加资源】权限控制 是否启用新建链路功能,
53
+ enableRelateResource: topoEdit.canAddLink
48
54
  }
49
55
  }
50
56
  })
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect, useRef, useCallback } from 'react';
2
2
  import { iconFactory } from '@riil-frontend/component-topology-graph';
3
3
  import ResourceList from "../../../../core/editor/components/settings/common/GroupNodeList/ResourceList";
4
- import { getLayerChildrenNodes } from "../../../../utils/htElementUtils";
4
+ import { getLayerChildren } from "../../../../utils/htElementUtils";
5
5
 
6
6
  function getResourceNodes(store, htNodes) {
7
7
  var _store$getModelState = store.getModelState('topoMod'),
@@ -30,7 +30,7 @@ function getResourceNodes(store, htNodes) {
30
30
  export default function LayerResourceList(props) {
31
31
  var topo = props.topo,
32
32
  layer = props.layer;
33
- var nodes = getLayerChildrenNodes(layer);
33
+ var nodes = getLayerChildren(layer);
34
34
  var resourceNodes = getResourceNodes(topo.store, nodes);
35
35
  var data = resourceNodes.map(function (_ref) {
36
36
  var node = _ref.node,
@@ -15,7 +15,8 @@ import styles from "./index.module.scss";
15
15
  import service from "./server";
16
16
  import { clone } from "../../../../../../utils/copyUtil";
17
17
  import { getInterfaceObject } from "../../../../../../core/models/utils/linkUtils";
18
- import { getEdgesBetweenNodes, getNodes } from "../../../../../../utils/htElementUtils";
18
+ import { getEdgesBetweenNodes, getNodes, isGroup } from "../../../../../../utils/htElementUtils";
19
+ import { getCiTypes } from "../../../../../../utils/topoData";
19
20
  var CollapsePanel = _Collapse.Panel;
20
21
 
21
22
  function AddLinkDrawer(props) {
@@ -151,7 +152,7 @@ function AddLinkDrawer(props) {
151
152
 
152
153
  var handleEvent = /*#__PURE__*/function () {
153
154
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
154
- var sourcePorts, targetPorts, source, target, connect_type;
155
+ var sourcePorts, targetPorts, source, target, targetDisableCreatePhyAggLink, connect_type;
155
156
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
156
157
  while (1) {
157
158
  switch (_context2.prev = _context2.next) {
@@ -176,11 +177,12 @@ function AddLinkDrawer(props) {
176
177
  setTargetIFDoc(targetPorts.portsDoc);
177
178
  source = translationNode(e.source, sourcePorts);
178
179
  target = translationNode(e.target, targetPorts);
180
+ targetDisableCreatePhyAggLink = !target.ciData || !(target.ciData.permission.writeable || target.ciData.permission.deleteable);
179
181
  editDispatchers.update({
180
182
  addLinkIsOpen: true,
181
183
  currentLink: null
182
184
  });
183
- connect_type = target.ciType !== "customNode" && target.ipAddress && targetPorts.ports.length > 0 ? "phy" : "exit";
185
+ connect_type = target.ciType !== "customNode" && target.ipAddress && targetPorts.ports.length > 0 && !targetDisableCreatePhyAggLink ? "phy" : "exit";
184
186
  setLink({
185
187
  source: source,
186
188
  target: target,
@@ -199,20 +201,20 @@ function AddLinkDrawer(props) {
199
201
  connect_type: connect_type
200
202
  }
201
203
  });
202
- _context2.next = 22;
204
+ _context2.next = 23;
203
205
  break;
204
206
 
205
- case 19:
206
- _context2.prev = 19;
207
+ case 20:
208
+ _context2.prev = 20;
207
209
  _context2.t0 = _context2["catch"](3);
208
210
  rlog.error("出现异常", _context2.t0);
209
211
 
210
- case 22:
212
+ case 23:
211
213
  case "end":
212
214
  return _context2.stop();
213
215
  }
214
216
  }
215
- }, _callee2, null, [[3, 19]]);
217
+ }, _callee2, null, [[3, 20]]);
216
218
  }));
217
219
 
218
220
  return function handleEvent(_x3) {
@@ -224,7 +226,9 @@ function AddLinkDrawer(props) {
224
226
  // rlog.debug("设置了起始节点", e);
225
227
  //const allData = topo.getData();
226
228
  var enableNodes = getNodes(topo.getDataModel());
227
- topo.view.topoClient.emitEvent("topo_link_set_connectable_nodes", enableNodes);
229
+ topo.view.topoClient.emitEvent("topo_link_set_connectable_nodes", enableNodes.filter(function (ele) {
230
+ return !(isGroup(ele) && !ele.a('ciType'));
231
+ }));
228
232
  };
229
233
 
230
234
  var initEditLineData = /*#__PURE__*/function () {
@@ -251,6 +255,7 @@ function AddLinkDrawer(props) {
251
255
  connect_type = currentLink.attributes["network_link.connect_type"] === "exit" ? "exit" : "phy";
252
256
  setLink({
253
257
  source: {
258
+ ciData: topo.dataModel.getDataById(currentLink.source),
254
259
  id: currentLink.source,
255
260
  name: currentLink.attributes["network_link.source_device_id_object"].displayName,
256
261
  ciId: currentLink.attributes["network_link.source_device_id"],
@@ -262,6 +267,7 @@ function AddLinkDrawer(props) {
262
267
  portsDoc: sourcePorts.portsDoc
263
268
  },
264
269
  target: {
270
+ ciData: topo.dataModel.getDataById(currentLink.target),
265
271
  id: currentLink.target,
266
272
  name: currentLink.attributes["network_link.destination_device_id_object"].displayName,
267
273
  ciId: currentLink.attributes["network_link.destination_device_id"],
@@ -298,25 +304,38 @@ function AddLinkDrawer(props) {
298
304
  initEditLineData();
299
305
  }
300
306
  }, [addLinkIsOpen]);
307
+ useEffect(function () {
308
+ if (!addLinkIsOpen) {
309
+ setLink(null);
310
+ }
311
+ }, [addLinkIsOpen]);
301
312
 
302
313
  var getCiTypesConnectable = /*#__PURE__*/function () {
303
314
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
304
- var ciTypesConnectable, nodes, ciIds, ciNodes;
315
+ var ciTypes, ciTypesConnectable, nodes, ciIds, ciNodes, isWriteable;
305
316
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
306
317
  while (1) {
307
318
  switch (_context4.prev = _context4.next) {
308
319
  case 0:
309
- _context4.next = 2;
310
- return topoService.networkLink.getCiTypesConnectable(RESOURCE_LIMIT_TYPES);
320
+ ciTypes = getCiTypes(topo.dataModel.getData());
321
+ _context4.next = 3;
322
+ return topoService.networkLink.getCiTypesConnectable(ciTypes);
311
323
 
312
- case 2:
324
+ case 3:
313
325
  ciTypesConnectable = _context4.sent;
314
326
  nodes = getNodes(topo.getDataModel());
315
327
  ciIds = [];
316
328
  ciNodes = [];
329
+
330
+ isWriteable = function isWriteable(node) {
331
+ var _node$a;
332
+
333
+ return ["delete", "write"].indexOf(node.a("operation")) >= 0 || ((_node$a = node.a('permission')) === null || _node$a === void 0 ? void 0 : _node$a.writeable);
334
+ };
335
+
317
336
  nodes.map(function (node) {
318
337
  // rlog.debug("过滤属性", node.a("operation"));
319
- if (ciTypesConnectable[node.a("ciType")] && ["delete", "write"].indexOf(node.a("operation")) >= 0) {
338
+ if (ciTypesConnectable[node.a("ciType")] && isWriteable(node)) {
320
339
  ciIds.push(node.id);
321
340
  ciNodes.push(node);
322
341
  }
@@ -327,7 +346,7 @@ function AddLinkDrawer(props) {
327
346
  setCiIdsConnectable(ciIds);
328
347
  return _context4.abrupt("return", ciNodes);
329
348
 
330
- case 10:
349
+ case 12:
331
350
  case "end":
332
351
  return _context4.stop();
333
352
  }
@@ -368,6 +387,7 @@ function AddLinkDrawer(props) {
368
387
 
369
388
  var attrObject = node._attrObject;
370
389
  return {
390
+ ciData: topo.dataModel.getDataById(attrObject.id),
371
391
  id: attrObject.id,
372
392
  name: attrObject.name,
373
393
  ciId: attrObject.id,
@@ -23,6 +23,13 @@ import styles from "./index.module.scss";
23
23
  function parseValues(values) {
24
24
  return _extends({}, values);
25
25
  }
26
+ /**
27
+ * 两端都有编辑/删除权限才能创建物理和聚合链路。
28
+ * 目的没编辑/删除权限时,在添加链路抽屉中链接方式默认出口,物理/聚合置灰不可选
29
+ * @param {*} props
30
+ * @returns
31
+ */
32
+
26
33
 
27
34
  export default function EditLinkInfo(props) {
28
35
  var _sourceValue$ipAddres2, _sourceValue$portsDoc5, _sourceValue$portsDoc6, _targetValue$portsDoc5, _targetValue$portsDoc6;
@@ -257,8 +264,10 @@ export default function EditLinkInfo(props) {
257
264
  name: "network_link.destination_ipv4",
258
265
  maxLength: 128
259
266
  });
260
- };
267
+ }; // 目的没编辑/删除权限时,在添加链路抽屉中链接方式默认出口,物理/聚合置灰不可选
268
+
261
269
 
270
+ var disableCreatePhyAggLink = target.ciType === "customNode" || !targetValue.ipAddress || targetValue.ports.length === 0 || !lineData.target || isAdd && !(lineData.target.ciData.permission.writeable || lineData.target.ciData.permission.deleteable);
262
271
  return /*#__PURE__*/React.createElement("div", {
263
272
  className: styles.editForm
264
273
  }, /*#__PURE__*/React.createElement(_Form, {
@@ -378,7 +387,7 @@ export default function EditLinkInfo(props) {
378
387
  }, /*#__PURE__*/React.createElement(_Radio, {
379
388
  id: "phy",
380
389
  value: "phy",
381
- disabled: target.ciType === "customNode" || !targetValue.ipAddress || targetValue.ports.length === 0
390
+ disabled: disableCreatePhyAggLink
382
391
  }, "\u7269\u7406/\u805A\u5408"), /*#__PURE__*/React.createElement(_Radio, {
383
392
  id: "exit",
384
393
  value: "exit"
@@ -0,0 +1,24 @@
1
+ import _Radio from "@alifd/next/es/radio";
2
+ import React from 'react';
3
+ import styles from "./LinkTagCommonRidioGroup.module.scss";
4
+ export default function LinkTagCommonRidioGroup(props) {
5
+ var value = props.value,
6
+ dataSource = props.dataSource,
7
+ limit = props.limit,
8
+ onChange = props.onChange;
9
+ return /*#__PURE__*/React.createElement("div", {
10
+ className: styles.contaienr
11
+ }, /*#__PURE__*/React.createElement("div", {
12
+ className: styles.checkboxGroupWrapper
13
+ }, /*#__PURE__*/React.createElement(_Radio.Group, {
14
+ value: typeof value === 'string' ? value : '0',
15
+ itemDirection: "ver",
16
+ onChange: onChange
17
+ }, dataSource.map(function (item) {
18
+ return /*#__PURE__*/React.createElement(_Radio, {
19
+ key: item.value,
20
+ value: item.value
21
+ }, item.label);
22
+ }))));
23
+ }
24
+ ;
@@ -0,0 +1,23 @@
1
+ @import "@alifd/next/variables";
2
+
3
+ .contaienr {
4
+ padding: 16px 12px;
5
+ background: #F2F7FD;
6
+ border-radius: 4px;
7
+
8
+ .checkboxGroupWrapper {
9
+ margin: -8px -8px -8px 0;
10
+
11
+ :global {
12
+ .#{$css-prefix}checkbox-group.next-checkbox-group-hoz {
13
+ display: flex;
14
+ flex-flow: row wrap;
15
+
16
+ .#{$css-prefix}checkbox-wrapper {
17
+ margin-left: 8px;
18
+ margin-right: 8px;
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,87 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import { DEFAULT_LINK_TAG_COMMON_CONFIG } from "../../../../constants/ResourceInfoDisplay";
4
+ import BasicConfig from "../../../../core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig";
5
+ import ResourceDiplayInfoSetting from "../../../../core/components/ResourceViewAttributeSetting/Setting";
6
+ import LinkTagCommonRidioGroup from "./LinkTagCommonRidioGroup"; // 默认中可配置内容包括总速率、带宽利用率、发送速率、发送带宽利用率、接收速率、接收带宽利用率
7
+
8
+ var CommonOptions = [{
9
+ value: '0',
10
+ label: '无'
11
+ }, {
12
+ value: '1',
13
+ label: '总流速、带宽利用率',
14
+ options: {
15
+ data: ['metric:interface_totalbps', 'metric:bandwidth_utilization']
16
+ }
17
+ }, {
18
+ value: '2',
19
+ label: '发送速率、发送带宽利用率',
20
+ options: {
21
+ data: ['metric:out_rate', 'metric:out_bandwidth_utilization']
22
+ }
23
+ }, {
24
+ value: '3',
25
+ label: '接收速率、接收带宽利用率',
26
+ options: {
27
+ data: ['metric:in_rate', 'metric:in_bandwidth_utilization']
28
+ }
29
+ }];
30
+
31
+ var buildConfig = function buildConfig(item) {
32
+ return {
33
+ type: item.split(':')[0],
34
+ code: item.split(':')[1]
35
+ };
36
+ };
37
+ /**
38
+ * 资源标注配置
39
+ * @param {*} props
40
+ * @returns
41
+ */
42
+
43
+
44
+ function LinkTagV2(props, ref) {
45
+ var value = props.value,
46
+ onChange = props.onChange;
47
+
48
+ var handleChange = function handleChange(newValue) {
49
+ // console.error(111, newValue)
50
+ if (!newValue.isCustom) {
51
+ var _CommonOptions$find;
52
+
53
+ var type = newValue.data;
54
+ var config = ((_CommonOptions$find = CommonOptions.find(function (item) {
55
+ return item.value === type;
56
+ })) === null || _CommonOptions$find === void 0 ? void 0 : _CommonOptions$find.options) || {
57
+ data: []
58
+ };
59
+ onChange(_extends({}, newValue, config, {
60
+ data: config.data.map(buildConfig),
61
+ type: type
62
+ }));
63
+ } else {
64
+ onChange(newValue);
65
+ }
66
+ };
67
+
68
+ return /*#__PURE__*/React.createElement(BasicConfig, _extends({
69
+ ref: ref
70
+ }, props, {
71
+ value: value ? _extends({}, value, {
72
+ data: value.type
73
+ }) : value,
74
+ limit: 2,
75
+ elementType: "link",
76
+ showType: "tag",
77
+ commonOptions: CommonOptions,
78
+ defaultCommonConfig: DEFAULT_LINK_TAG_COMMON_CONFIG,
79
+ commonSelectWidget: LinkTagCommonRidioGroup,
80
+ customSettingDrawer: function customSettingDrawer(params) {
81
+ return /*#__PURE__*/React.createElement(ResourceDiplayInfoSetting, params);
82
+ },
83
+ onChange: handleChange
84
+ }));
85
+ }
86
+
87
+ export default /*#__PURE__*/React.forwardRef(LinkTagV2);
@@ -7,7 +7,7 @@ import { queryCisByIds } from "../core/services";
7
7
  import { addTopoDataResourcePermission } from "./utils/resourcePermissionUtil";
8
8
  export function addLinkData(_x, _x2) {
9
9
  return _addLinkData.apply(this, arguments);
10
- }
10
+ } // FIXME 业务拓扑不需要链路相关逻辑
11
11
 
12
12
  function _addLinkData() {
13
13
  _addLinkData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(oldLinks, nodes) {
@@ -16,10 +16,22 @@ function _addLinkData() {
16
16
  while (1) {
17
17
  switch (_context.prev = _context.next) {
18
18
  case 0:
19
- _context.next = 2;
20
- return getLinksDetail(oldLinks, nodes);
19
+ // 过滤掉无两端节点数据的链路
20
+ links = oldLinks.filter(function (link) {
21
+ var sourceNode = nodes.find(function (node) {
22
+ return node.id === link.source;
23
+ });
21
24
 
22
- case 2:
25
+ if (link.source && !sourceNode) {
26
+ return false;
27
+ }
28
+
29
+ return true;
30
+ });
31
+ _context.next = 3;
32
+ return getLinksDetail(links, nodes);
33
+
34
+ case 3:
23
35
  links = _context.sent;
24
36
  return _context.abrupt("return", {
25
37
  links: links.filter(function (link) {
@@ -30,7 +42,7 @@ function _addLinkData() {
30
42
  })
31
43
  });
32
44
 
33
- case 4:
45
+ case 5:
34
46
  case "end":
35
47
  return _context.stop();
36
48
  }
@@ -66,7 +78,7 @@ function _buildData() {
66
78
  return Promise.all([// 查询节点属性
67
79
  queryCisByIds(nodes.map(function (node) {
68
80
  return node.id;
69
- })), addLinkData(data.links, nodes)]);
81
+ })), addLinkData(data.links || [], nodes)]);
70
82
 
71
83
  case 4:
72
84
  _yield$Promise$all = _context2.sent;
@@ -0,0 +1,16 @@
1
+ export default function useGroupSortResources(store, nodes) {
2
+ var _store$useModelState = store.useModelState('topoMod'),
3
+ data = _store$useModelState.data;
4
+
5
+ var resources = [];
6
+ ((data === null || data === void 0 ? void 0 : data.nodes) || []).forEach(function (res) {
7
+ var node = nodes.find(function (item) {
8
+ return item.id === res.id;
9
+ });
10
+
11
+ if (node) {
12
+ resources.push(node);
13
+ }
14
+ });
15
+ return resources;
16
+ }
@@ -0,0 +1,25 @@
1
+ import useHtDataPropertyChangeListener from "../../core/hooks/ht/useHtDataPropertyChangeListener";
2
+ import { updateEdgeExpanded } from "../../core/utils/edgeUtil";
3
+ /**
4
+ * 默认情况下,拓扑图不存在链路的动态效果
5
+ * 未监控的链路,不展示动态效果
6
+ * @param {*} props
7
+ */
8
+
9
+ export default function useEdgeExpand(props) {
10
+ var topo = props.topo;
11
+ useHtDataPropertyChangeListener({
12
+ topo: topo,
13
+ onChange: function onChange(e) {
14
+ var property = e.property,
15
+ data = e.data;
16
+
17
+ if (data instanceof ht.Group && property === 'expanded') {
18
+ updateEdgeExpanded(topo);
19
+ setTimeout(function () {
20
+ updateEdgeExpanded(topo);
21
+ }, 100);
22
+ }
23
+ }
24
+ });
25
+ }
@@ -17,7 +17,7 @@ export default function (props) {
17
17
  var graphLoaded = topoModState.graphLoaded,
18
18
  topoData = topoModState.data;
19
19
  useEffect(function () {
20
- // 拓扑图记载完成时刷新
20
+ // 拓扑图加载完成时刷新
21
21
  if (graphLoaded && topoData) {
22
22
  topo.linkDynamicStyleExecutor.execute();
23
23
  }
@@ -3,6 +3,8 @@ import { isEdge } from "../../utils/htElementUtils";
3
3
  import useDeleteEdges from "./editor/useDeleteEdges";
4
4
  export default (function (props) {
5
5
  var topo = props.topo;
6
+ var functionAuthState = topo.store.useModelState('functionAuth');
7
+ var canAddLink = !!functionAuthState.permissions.addResource;
6
8
  var deleteEdges = useDeleteEdges({
7
9
  topo: topo
8
10
  });
@@ -18,6 +20,7 @@ export default (function (props) {
18
20
  };
19
21
 
20
22
  return {
23
+ canAddLink: canAddLink,
21
24
  onElementsDelete: onElementsDelete
22
25
  };
23
26
  });