@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
@@ -18,6 +18,8 @@ import useManageStatus from "../../../hooks/useManageStatus";
18
18
  import useAlarm from "../../../hooks/useAlarm";
19
19
  import styles from "./TopoView.module.scss";
20
20
  import useRouterAdapter from "../../hooks/useRouterAdapter";
21
+ import { fixLink } from "../../utils/graphLinkUtil";
22
+ import { handleClusterNoPermission } from "../../../utils/clusterUtil";
21
23
 
22
24
  var Topology = function Topology(props) {
23
25
  var _classnames, _graphViewProps$creat;
@@ -27,8 +29,9 @@ var Topology = function Topology(props) {
27
29
  titleBar = props.titleBar,
28
30
  buildLoadOptions = props.buildLoadOptions,
29
31
  onReady = props.onReady,
30
- onDestroy = props.onDestroy,
31
32
  onLoaded = props.onLoaded,
33
+ onLoad = props.onLoad,
34
+ onDestroy = props.onDestroy,
32
35
  onRefreshTopo = props.onRefresh,
33
36
  onEnterEdit = props.onEnterEdit,
34
37
  onSave = props.onSave,
@@ -123,8 +126,23 @@ var Topology = function Topology(props) {
123
126
  onReady();
124
127
  }
125
128
  }, []);
129
+ var handleGraphDataLoaded = useCallback(function () {
130
+ rlog.info("TopoView.handleGraphDataLoaded", topoData, topo.getDataModel().getDatas().toArray());
131
+ fixLink(topo);
132
+ handleClusterNoPermission(topo);
133
+ updateEdgeExpanded(topo);
134
+ topoDispatchers.update({
135
+ graphLoaded2: true
136
+ });
137
+
138
+ if (onLoad) {
139
+ onLoad();
140
+ }
141
+ }, [topoData]);
126
142
  var handleGraphLoaded = useCallback(function () {
127
143
  rlog.info("TopoView.handleGraphLoaded", topoData, topo.getDataModel().getDatas().toArray());
144
+ fixLink(topo);
145
+ handleClusterNoPermission(topo);
128
146
  updateEdgeExpanded(topo);
129
147
  topoDispatchers.update({
130
148
  graphLoaded: true
@@ -133,6 +151,10 @@ var Topology = function Topology(props) {
133
151
  if (onLoaded) {
134
152
  onLoaded(topoData);
135
153
  }
154
+
155
+ if (onLoad) {
156
+ onLoad();
157
+ }
136
158
  }, [topoData]); // TODO 之后把事件方法都转移出去
137
159
 
138
160
  var rightEventHandle = function rightEventHandle(event) {
@@ -236,6 +258,7 @@ var Topology = function Topology(props) {
236
258
  renderBackgroundView: renderBackgroundView,
237
259
  onCreate: onGraphCreated,
238
260
  onLoaded: handleGraphLoaded,
261
+ onDataLoaded: handleGraphDataLoaded,
239
262
  onDestroy: onDestroy,
240
263
  onEvent: handleEvent,
241
264
  style: {
@@ -275,6 +298,7 @@ Topology.propTypes = {
275
298
  onNodeDelete: PropTypes.func,
276
299
  onLineDelete: PropTypes.func,
277
300
  onLoaded: PropTypes.func,
301
+ onLoad: PropTypes.func,
278
302
 
279
303
  /**
280
304
  * @deprecated 工具栏
@@ -5,10 +5,12 @@ export default function GroupNodeList(props) {
5
5
  var topo = props.topo,
6
6
  group = props.group,
7
7
  _props$showRemove = props.showRemove,
8
- showRemove = _props$showRemove === void 0 ? true : _props$showRemove;
8
+ showRemove = _props$showRemove === void 0 ? true : _props$showRemove,
9
+ useGroupSortResources = props.useGroupSortResources;
9
10
  var dataSource = useGroupRelateResource({
10
11
  group: group,
11
- topo: topo
12
+ topo: topo,
13
+ useGroupSortResources: useGroupSortResources
12
14
  });
13
15
  /**
14
16
  * 从区域移出节点,放到左上角
@@ -1,17 +1,10 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import GroupRelateData from "./GroupRelateData/GroupRelateData";
3
- import ClusterGroupRelateData from "./ClusterGroupRelateData/ClusterGroupRelateData";
4
3
  export default function GroupRelateDataContainer(props) {
5
4
  var topo = props.topo,
6
5
  topoEditApi = props.topoEditApi,
7
6
  group = props.group,
8
7
  values = props.values,
9
8
  editorProps = props.editorProps;
10
- var elementTemplate = group.a('elementTemplate');
11
-
12
- if (elementTemplate === 'cluster') {
13
- return /*#__PURE__*/React.createElement(ClusterGroupRelateData, props);
14
- }
15
-
16
9
  return /*#__PURE__*/React.createElement(GroupRelateData, props);
17
10
  }
@@ -1,9 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import { useState } from "react";
3
- import rlog from "@riil-frontend/component-topology-utils/es/rlog";
4
2
  import { iconFactory } from "@riil-frontend/component-topology-graph";
5
3
  import sortBy from "lodash/sortBy";
6
- import { getGroupChildrenNodes, getNodeData } from "../../../../../../../../utils/htElementUtils";
4
+ import { getGroupChildrenResourceElements } from "../../../../../../../../utils/htElementDataUtil";
5
+ import { getNodeData } from "../../../../../../../../utils/htElementUtils";
7
6
 
8
7
  function sortResourcesByName(resources) {
9
8
  return sortBy(resources, "name");
@@ -13,20 +12,22 @@ export default function useGroupRelateResource(props) {
13
12
  var _topo$options$editor;
14
13
 
15
14
  var group = props.group,
16
- topo = props.topo; // const [resources, setResources] = useState([]);
15
+ topo = props.topo,
16
+ _props$useGroupSortRe = props.useGroupSortResources,
17
+ useGroupSortResources = _props$useGroupSortRe === void 0 ? function (nodes) {
18
+ return nodes;
19
+ } : _props$useGroupSortRe; // const [resources, setResources] = useState([]);
20
+ // 过滤出资源
17
21
 
18
- var nodes = getGroupChildrenNodes(group); // 过滤出资源
22
+ var resourceNodes = getGroupChildrenResourceElements(group); // 资源按名称排序
19
23
 
20
- var resourceNodes = nodes.filter(function (node) {
21
- return !!node.getTag();
22
- }); // 资源按名称排序
23
-
24
- var sortResources = ((_topo$options$editor = topo.options.editor) === null || _topo$options$editor === void 0 ? void 0 : _topo$options$editor.sortResources) || sortResourcesByName;
25
- var data = sortResources(resourceNodes.map(function (node) {
24
+ var useSortNodes = useGroupSortResources || ((_topo$options$editor = topo.options.editor) === null || _topo$options$editor === void 0 ? void 0 : _topo$options$editor.sortResources) || sortResourcesByName;
25
+ var data = useSortNodes(resourceNodes.map(function (node) {
26
26
  return _extends({}, getNodeData(node), {
27
27
  node: node
28
28
  });
29
- })).map(function (item) {
29
+ }));
30
+ data = data.map(function (item) {
30
31
  return {
31
32
  title: item.name,
32
33
  img: iconFactory.getIconImageUrl(item.image),
@@ -6,6 +6,7 @@ import styles from "./GroupPropertyView.module.scss";
6
6
  import useGroup from "./hooks/useGroup";
7
7
  import GroupSetting from "./SettingTab/Setting";
8
8
  import GroupRelateData from "./DataTab/RelateData";
9
+ import ClusterGroupRelateData from "./cluster/ClusterGroupRelateData";
9
10
  export default function GroupPropertyView(props) {
10
11
  var topo = props.topo,
11
12
  topoEdit = props.topoEdit,
@@ -17,10 +18,12 @@ export default function GroupPropertyView(props) {
17
18
  topo: topo,
18
19
  id: values.id
19
20
  });
21
+ var isCluster = group.a('cluster');
22
+ var DataTabContent = isCluster ? ClusterGroupRelateData : GroupRelateData;
20
23
  return /*#__PURE__*/React.createElement(TabView, null, /*#__PURE__*/React.createElement(_Tab.Item, {
21
24
  title: "\u6570\u636E",
22
25
  key: "1"
23
- }, /*#__PURE__*/React.createElement(GroupRelateData, _extends({
26
+ }, /*#__PURE__*/React.createElement(DataTabContent, _extends({
24
27
  group: group
25
28
  }, props))), /*#__PURE__*/React.createElement(_Tab.Item, {
26
29
  title: "\u8BBE\u7F6E",
@@ -1,28 +1,37 @@
1
1
  import _Collapse from "@alifd/next/es/collapse";
2
2
  import _Form from "@alifd/next/es/form";
3
3
  import React, { useEffect } from 'react';
4
- import GroupNodeList from "../GroupNodeList";
5
- import CollapsePanel from "../../../../../../../../components/collapse/Panel";
6
- import NodeRelateResourceButton from "../../../node/data/NodeRelateResourceButton";
7
- import CollapseFullheightStyles from "../../../../common/GroupNodeList/CollapseFullheight.module.scss";
8
- import textStyles from "../../../../../../../common/text.module.scss";
4
+ import GroupNodeList from "../DataTab/GroupNodeList";
5
+ import CollapsePanel from "../../../../../../../components/collapse/Panel";
6
+ import NodeRelateResourceButton from "../../node/data/NodeRelateResourceButton";
7
+ import NoDataPage from '@riil-frontend/component-no-data-page';
8
+ import CollapseFullheightStyles from "../../../common/GroupNodeList/CollapseFullheight.module.scss";
9
+ import textStyles from "../../../../../../common/text.module.scss";
9
10
  export default function ClusterGroupRelateData(props) {
10
11
  var topo = props.topo,
11
12
  topoEditApi = props.topoEditApi,
12
13
  group = props.group,
13
14
  values = props.values,
14
15
  editorProps = props.editorProps;
16
+ var useGroupSortResources = editorProps.useGroupSortResources;
15
17
 
16
18
  var renderMemberPanel = function renderMemberPanel() {
17
19
  return /*#__PURE__*/React.createElement(CollapsePanel, {
18
20
  key: "\u96C6\u7FA4\u6210\u5458",
19
21
  title: "\u96C6\u7FA4\u6210\u5458",
20
22
  className: CollapseFullheightStyles.panelFullHeight
21
- }, /*#__PURE__*/React.createElement(GroupNodeList, {
23
+ }, group.a('operation') ? /*#__PURE__*/React.createElement(GroupNodeList, {
22
24
  topo: topo,
23
25
  group: group,
24
- showRemove: false
25
- }));
26
+ showRemove: false,
27
+ useGroupSortResources: useGroupSortResources
28
+ }) : /*#__PURE__*/React.createElement("div", {
29
+ style: {
30
+ height: 180
31
+ }
32
+ }, /*#__PURE__*/React.createElement(NoDataPage, {
33
+ statusCode: "\u6CA1\u6709\u67E5\u770B\u6743\u9650"
34
+ })));
26
35
  };
27
36
 
28
37
  return /*#__PURE__*/React.createElement(_Collapse, {
@@ -53,5 +62,9 @@ export default function ClusterGroupRelateData(props) {
53
62
  color: '#4D6277'
54
63
  },
55
64
  title: values.tag ? values.name : null
56
- }, values.tag ? values.name : '—'))))), renderMemberPanel());
65
+ }, values.tag ? values.name : '—'), /*#__PURE__*/React.createElement(NodeRelateResourceButton, {
66
+ node: values,
67
+ topo: topo,
68
+ topoEditApi: topoEditApi
69
+ }))))), renderMemberPanel());
57
70
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { iconFactory } from '@riil-frontend/component-topology-graph';
3
3
  import ResourceList from "../../../common/GroupNodeList/ResourceList";
4
- import { getLayerChildrenNodes } from "../../../../../../../utils/htElementUtils";
4
+ import { getLayerChildrenResourceElements } from "../../../../../../../utils/htElementDataUtil";
5
5
  /**
6
6
  * 分层关联资源列表
7
7
  */
@@ -9,10 +9,7 @@ import { getLayerChildrenNodes } from "../../../../../../../utils/htElementUtils
9
9
  export default function LayerResourceList(props) {
10
10
  var topo = props.topo,
11
11
  layer = props.layer;
12
- var nodes = getLayerChildrenNodes(layer);
13
- var relateDataNodes = nodes.filter(function (node) {
14
- return !!node.getTag();
15
- });
12
+ var relateDataNodes = getLayerChildrenResourceElements(layer);
16
13
  var data = relateDataNodes.map(function (node) {
17
14
  return {
18
15
  title: node.a('name'),
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { isGroup, isNode } from "../../../../../../utils/htElementUtils";
3
+ import NodeIconSelect from "../node/NodeIconSelect";
4
+ export default function BatchSetNodeIcon(props) {
5
+ var topo = props.topo;
6
+
7
+ var setNodeIcon = function setNodeIcon(iconId) {
8
+ var selection = topo.getSelectionModel().getSelection().toArray();
9
+ var nodes = selection.filter(function (element) {
10
+ return isNode(element) && !isGroup(element);
11
+ });
12
+ nodes.forEach(function (node) {
13
+ node.setImage(iconId);
14
+ });
15
+ };
16
+
17
+ return /*#__PURE__*/React.createElement(NodeIconSelect, {
18
+ topo: topo,
19
+ onChange: setNodeIcon
20
+ });
21
+ }
@@ -7,6 +7,7 @@ import BatchSetNodeSize from "./BatchSetNodeSize/BatchSetNodeSize";
7
7
  import { TPL_TREE } from "../../../../../../utils/template";
8
8
  import ViewPropertyView from "../view/ViewPropertyView";
9
9
  import MultipleElementLineType from "./MultipleElementLineType";
10
+ import BatchSetNodeIcon from "./BatchSetNodeIcon";
10
11
  var CollapsePanel = _Collapse.Panel;
11
12
  /**
12
13
  * 多选元素属性面板
@@ -60,6 +61,10 @@ export default function MultipleElementPropertyView(props) {
60
61
  key: "\u56FE\u7247",
61
62
  title: "\u56FE\u7247"
62
63
  }, /*#__PURE__*/React.createElement(_Form.Item, {
64
+ label: "\u663E\u793A\u56FE\u7247"
65
+ }, /*#__PURE__*/React.createElement(BatchSetNodeIcon, {
66
+ topo: topo
67
+ })), /*#__PURE__*/React.createElement(_Form.Item, {
63
68
  label: "\u56FE\u7247\u5C3A\u5BF8",
64
69
  style: {
65
70
  marginBottom: 0
@@ -21,7 +21,9 @@ export default function NodePropertyView(props) {
21
21
  });
22
22
 
23
23
  var renderData = function renderData() {
24
- return /*#__PURE__*/React.createElement(Data, props);
24
+ return /*#__PURE__*/React.createElement(Data, _extends({}, props, {
25
+ node: node
26
+ }));
25
27
  };
26
28
 
27
29
  var renderSetting = function renderSetting() {
@@ -0,0 +1,36 @@
1
+ import _Input from "@alifd/next/es/input";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import React, { useEffect, useState } from 'react';
4
+ var NameInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
5
+ var onChange = props.onChange;
6
+
7
+ var _useState = useState(props.value),
8
+ value = _useState[0],
9
+ setValue = _useState[1];
10
+
11
+ useEffect(function () {
12
+ setValue(props.value);
13
+ }, [props.value]);
14
+
15
+ var handleChange = function handleChange(v) {
16
+ setValue(v);
17
+
18
+ if (v) {
19
+ onChange(v);
20
+ }
21
+ };
22
+
23
+ var handleBlur = function handleBlur() {
24
+ if (!value) {
25
+ onChange('');
26
+ }
27
+ };
28
+
29
+ return /*#__PURE__*/React.createElement(_Input, _extends({}, props, {
30
+ ref: ref,
31
+ value: value,
32
+ onChange: handleChange,
33
+ onBlur: handleBlur
34
+ }));
35
+ });
36
+ export default NameInput;
@@ -1,11 +1,11 @@
1
1
  import _Form from "@alifd/next/es/form";
2
- import _Input from "@alifd/next/es/input";
3
2
  import _Field from "@alifd/next/es/field";
4
3
  import _extends from "@babel/runtime/helpers/extends";
5
4
  import _Collapse from "@alifd/next/es/collapse";
6
5
  import React, { useEffect } from 'react';
7
6
  import NodeSizeInput from "../../../common/NodeSizeInput/NodeSizeInput";
8
7
  import NodeIconSelect from "../NodeIconSelect";
8
+ import NameInput from "./NameInput";
9
9
  var CollapsePanel = _Collapse.Panel;
10
10
 
11
11
  function parseValues(values) {
@@ -51,7 +51,7 @@ export default function Setting(props) {
51
51
  title: "\u663E\u793A\u8BBE\u7F6E"
52
52
  }, /*#__PURE__*/React.createElement(_Form.Item, {
53
53
  label: "\u56FE\u7247\u540D\u79F0"
54
- }, /*#__PURE__*/React.createElement(_Input, {
54
+ }, /*#__PURE__*/React.createElement(NameInput, {
55
55
  name: "attrObject.customName"
56
56
  })), showImageSetting && /*#__PURE__*/React.createElement(_Form.Item, {
57
57
  label: "\u663E\u793A\u56FE\u7247"
@@ -31,16 +31,13 @@ function getBindType(values) {
31
31
  }
32
32
 
33
33
  export default function Data(props) {
34
- var topo = props.topo,
34
+ var node = props.node,
35
+ topo = props.topo,
35
36
  topoEditApi = props.topoEditApi,
36
37
  values = props.values,
37
38
  _onChange = props.onChange,
38
39
  editorProps = props.editorProps;
39
40
  var bindType = getBindType(values);
40
- var node = useHtElement({
41
- topo: topo,
42
- id: values.id
43
- });
44
41
 
45
42
  var field = _Field.useField({
46
43
  autoUnmount: false,
@@ -113,6 +110,7 @@ export default function Data(props) {
113
110
  },
114
111
  title: values.tag ? values.name : null
115
112
  }, values.tag ? values.name : "—"), /*#__PURE__*/React.createElement(NodeRelateResourceButton, {
113
+ nodeElement: node,
116
114
  node: values,
117
115
  topo: topo,
118
116
  topoEditApi: topoEditApi
@@ -2,6 +2,7 @@ import _Button from "@alifd/next/es/button";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import React, { useState } from 'react';
4
4
  import BindResourceDrawer from "./BindResourceDrawer";
5
+ import { isClusterMemberHtElement } from "../../../../../../../utils/clusterUtil";
5
6
  /**
6
7
  * @return {React.ReactNode | null}
7
8
  */
@@ -9,10 +10,11 @@ import BindResourceDrawer from "./BindResourceDrawer";
9
10
  export default function NodeRelateResourceButton(props) {
10
11
  var _node$attrObject$data;
11
12
 
12
- var topo = props.topo,
13
+ var nodeElement = props.nodeElement,
14
+ topo = props.topo,
13
15
  topoEditApi = props.topoEditApi,
14
16
  node = props.node;
15
- var hide = ((_node$attrObject$data = node.attrObject.data) === null || _node$attrObject$data === void 0 ? void 0 : _node$attrObject$data.relateResource) === false;
17
+ var hide = isClusterMemberHtElement(nodeElement) || ((_node$attrObject$data = node.attrObject.data) === null || _node$attrObject$data === void 0 ? void 0 : _node$attrObject$data.relateResource) === false;
16
18
  var currentResId = node.tag;
17
19
 
18
20
  var _useState = useState(false),
@@ -0,0 +1,28 @@
1
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
2
+ import { useEffect } from 'react';
3
+ export default function useHtDataPropertyChangeListener(props) {
4
+ var topo = props.topo,
5
+ onChange = props.onChange;
6
+
7
+ var _topo$store$useModel = topo.store.useModel('topoMod'),
8
+ topoState = _topo$store$useModel[0],
9
+ topoDispatchers = _topo$store$useModel[1];
10
+
11
+ var graphLoaded = topoState.graphLoaded,
12
+ graphLoaded2 = topoState.graphLoaded2;
13
+ useEffect(function () {
14
+ var dm = topo.getDataModel();
15
+ var inited = false;
16
+
17
+ if (graphLoaded || graphLoaded2) {
18
+ dm.addDataPropertyChangeListener(onChange);
19
+ inited = true;
20
+ }
21
+
22
+ return function () {
23
+ if (inited) {
24
+ dm.removeDataPropertyChangeListener(onChange);
25
+ }
26
+ };
27
+ }, [graphLoaded, graphLoaded2, onChange]);
28
+ }
@@ -114,10 +114,6 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
114
114
  return _extends({}, link, {
115
115
  type: 'edge'
116
116
  });
117
- }), linkGroups.map(function (link) {
118
- return _extends({}, link, {
119
- type: 'edgeGroup'
120
- });
121
117
  }));
122
118
  };
123
119
 
@@ -241,8 +237,14 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
241
237
  var tagTipOptions = this.topo.options.tagTip;
242
238
  var defaultLinkTagConfig = tagTipOptions !== null && tagTipOptions !== void 0 && tagTipOptions.getDefaultLinkTagConfig ? tagTipOptions === null || tagTipOptions === void 0 ? void 0 : tagTipOptions.getDefaultLinkTagConfig(link) : null;
243
239
  var defaultLinkTipConfig = tagTipOptions !== null && tagTipOptions !== void 0 && tagTipOptions.getDefaultLinkTipConfig ? tagTipOptions === null || tagTipOptions === void 0 ? void 0 : tagTipOptions.getDefaultLinkTipConfig(link) : null;
240
+ var linkTagConfig = linkTag || defaultLinkTagConfig;
244
241
  return {
245
- tags: getItems(linkTag || defaultLinkTagConfig),
242
+ tags: getItems(linkTagConfig),
243
+ tagLinkArrow: {
244
+ 1: 'both',
245
+ 2: 'from',
246
+ 3: 'to'
247
+ }[linkTagConfig === null || linkTagConfig === void 0 ? void 0 : linkTagConfig.type] || undefined,
246
248
  tips: getItems(linkTip || defaultLinkTipConfig)
247
249
  };
248
250
  };
@@ -255,13 +257,14 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
255
257
 
256
258
  var tagTipConfig = _this2.getLinkTagTipConfig(link);
257
259
 
258
- return {
260
+ return _extends({
259
261
  type: link.type,
260
262
  id: link.id,
261
- ciType: ciType,
263
+ ciType: ciType
264
+ }, tagTipConfig, {
262
265
  tags: filterByPermission(link, tagTipConfig.tags),
263
266
  tips: filterByPermission(link, tagTipConfig.tips)
264
- };
267
+ });
265
268
  });
266
269
  }
267
270
  /**
@@ -338,6 +341,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
338
341
  ;
339
342
 
340
343
  _proto.getNodeNameVisible = function getNodeNameVisible(node) {
344
+ if (!this.topo.isViewMode()) {
345
+ return true;
346
+ }
347
+
341
348
  var _this$getConfig3 = this.getConfig(),
342
349
  nodeTag = _this$getConfig3.nodeTag;
343
350
 
@@ -700,9 +707,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
700
707
  ;
701
708
 
702
709
  _proto.buildTagsTips = function buildTagsTips() {
710
+ var _this6 = this;
711
+
703
712
  var data = this.getData(); // 获取标注、悬浮框配置
704
713
 
705
- var formatter = new AttributeFormatter(this.topo);
706
714
  var ciConfigs = this.getResourceTagTipConfig();
707
715
  var ciTagsAndTips = ciConfigs.map(function (ciConfig) {
708
716
  var ciDataItem = findItem(data, 'id', ciConfig.id);
@@ -720,10 +728,20 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
720
728
  ciType: ciConfig.ciType
721
729
  });
722
730
 
731
+ var formatter = new AttributeFormatter(_this6.topo);
732
+ var tags = formatter.formatAttrs(ciConfig.tags, ciData); // 链路标注箭头
733
+
734
+ if (ciConfig.type === 'edge') {
735
+ tags = {
736
+ data: tags,
737
+ linkArrow: ciConfig.tagLinkArrow
738
+ };
739
+ }
740
+
723
741
  return {
724
742
  type: ciConfig.type,
725
743
  id: ciConfig.id,
726
- tags: formatter.formatAttrs(ciConfig.tags, ciData),
744
+ tags: tags,
727
745
  tips: formatter.formatAttrs(ciConfig.tips, ciData)
728
746
  };
729
747
  });
@@ -4,12 +4,12 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import topoService from '@riil-frontend/component-topology-common/es/services/topo';
5
5
  import { setRequest } from '@riil-frontend/component-topology-utils';
6
6
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
7
- import CiTyeCache from "./cache/CiTyeCache";
7
+ import CiTypeCache from "./cache/CiTypeCache";
8
8
  import Alarm from "./Alarm";
9
9
  import TopoGraphView from "./TopoGraphView";
10
10
  import createStore from "../store/createStore";
11
11
  import buildProvider from "../components/buildProvider";
12
- import { getEdgeDatas, getGroupDatas, getNodeDatas } from "../../utils/htElementUtils";
12
+ import { getEdgeDatas, getGroupDatas, getNodeData, getNodeDatas, getNodes as _getNodes } from "../../utils/htElementUtils";
13
13
  import Test from "../test/Test";
14
14
  import { formatGroups } from "../../utils/topoData";
15
15
  import DictCache from "./cache/DictCache";
@@ -18,9 +18,10 @@ import DataModel from "./DataModel";
18
18
  import GraphDataModel from "./GraphDataModel";
19
19
  import { updateEdgeExpanded } from "../utils/edgeUtil";
20
20
  import PluginManager from "./PluginManager";
21
- import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
21
+ import topoFactory from "./topoFactory";
22
+ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig"; // eslint-disable-next-line no-undef
22
23
 
23
- var version = typeof "4.0.0-beta.9" === 'string' ? "4.0.0-beta.9" : null;
24
+ var version = typeof "4.0.2" === 'string' ? "4.0.2" : null;
24
25
  console.info("\u62D3\u6251\u7248\u672C: " + version);
25
26
  /**
26
27
  * 拓扑显示和编辑
@@ -37,8 +38,10 @@ var Topo = /*#__PURE__*/function () {
37
38
  this.alarm = new Alarm();
38
39
  this.store = void 0;
39
40
  this.serverApi = topoService;
40
- this.ciTyeCache = CiTyeCache;
41
+ this.CiTypeCache = CiTypeCache;
42
+ this.ciTyeCache = CiTypeCache;
41
43
  this.dictCache = DictCache;
44
+ this.elementTagTipConfig = new ElementTagTipConfig(this);
42
45
  this.test = void 0;
43
46
  this.uid = void 0;
44
47
  this.version = version;
@@ -202,9 +205,11 @@ var Topo = /*#__PURE__*/function () {
202
205
  };
203
206
 
204
207
  _proto.getNodes = function getNodes() {
205
- return getNodeDatas(this.getDataModel()).filter(function (node) {
206
- return !!node.id;
208
+ var nodes = _getNodes(this.getDataModel()).filter(function (node) {
209
+ return !!node.getTag();
207
210
  });
211
+
212
+ return nodes.map(getNodeData);
208
213
  };
209
214
 
210
215
  _proto.getLines = function getLines() {
@@ -27,7 +27,9 @@ var TopoGraphView = /*#__PURE__*/function () {
27
27
  };
28
28
 
29
29
  _proto.getHtDataModel = function getHtDataModel() {
30
- return this.topoClient.getDataModel();
30
+ var _this$topoClient;
31
+
32
+ return (_this$topoClient = this.topoClient) === null || _this$topoClient === void 0 ? void 0 : _this$topoClient.getDataModel();
31
33
  }
32
34
  /**
33
35
  * 缩放平移整个拓扑以展示所有的图元
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
3
2
  import { metricValueFormat } from '@riil-frontend/utils';
4
3
  import { findItem } from "../../../utils/topoData";
@@ -25,33 +24,10 @@ export function formatMetric(val, metricInfo) {
25
24
  return "" + val;
26
25
  }
27
26
  }
28
-
29
- function addLinkMetricUnderlineArrow(metricCode) {
30
- var map = {
31
- // 总流速和总带宽利用率:双向箭头
32
- 'interface_totalbps': 'both',
33
- 'bandwidth_utilization': 'both',
34
- // 发送速率和发送带宽利用率:背向取值端口的箭头 指向目的
35
- 'out_rate': 'to',
36
- 'out_bandwidth_utilization': 'to',
37
- // 接收速率和接收带宽利用率:指向取值端口的箭头 指向源
38
- 'in_rate': 'from',
39
- 'in_bandwidth_utilization': 'from'
40
- };
41
-
42
- if (map[metricCode]) {
43
- return {
44
- underlineArrow: map[metricCode]
45
- };
46
- }
47
-
48
- return {};
49
- }
50
27
  /**
51
28
  * 标注值格式化
52
29
  */
53
30
 
54
-
55
31
  var AttributeFormatter = /*#__PURE__*/function () {
56
32
  function AttributeFormatter(topo) {
57
33
  this.topo = topo;
@@ -88,7 +64,7 @@ var AttributeFormatter = /*#__PURE__*/function () {
88
64
  fieldValue = ciData[attrType + "Map"][fieldCode + "_object"].displayName;
89
65
  }
90
66
 
91
- return _extends({
67
+ return {
92
68
  type: item.type,
93
69
  code: item.code,
94
70
  // 属性code
@@ -97,7 +73,7 @@ var AttributeFormatter = /*#__PURE__*/function () {
97
73
  value: formatMetric(fieldValue, fieldMeta),
98
74
  // 属性值
99
75
  originValue: fieldValue
100
- }, addLinkMetricUnderlineArrow(fieldCode));
76
+ };
101
77
  };
102
78
 
103
79
  _proto.attributeTransform = function attributeTransform(item, ciData) {