@riil-frontend/component-topology 9.0.0-a.3 → 9.0.0-a.31

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 (103) hide show
  1. package/build/1.js +1 -1
  2. package/build/index.css +1 -1
  3. package/build/index.js +12 -12
  4. package/es/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
  5. package/es/core/components/TopoView/GraphViewPanel.js +17 -4
  6. package/es/core/components/TopoView/TopoView.module.scss +17 -3
  7. package/es/core/editor/components/BackgroundView/index.module.scss +3 -0
  8. package/es/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
  9. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
  10. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
  11. package/es/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
  12. package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
  13. package/es/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
  14. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +21 -5
  15. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +5 -1
  16. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +31 -12
  17. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +12 -2
  18. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +6 -0
  19. package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +1 -1
  20. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +1 -1
  21. package/es/core/editor/components/settings/core/updateElementProperty.js +6 -1
  22. package/es/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +4 -3
  23. package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +95 -0
  24. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +46 -14
  25. package/es/core/editor/config/themes.js +53 -2
  26. package/es/core/event/topoEventListener.js +22 -0
  27. package/es/core/hooks/useAlarm.js +18 -12
  28. package/es/core/hooks/useCanvasTheme.js +12 -4
  29. package/es/core/hooks/useResourceConfig.js +2 -1
  30. package/es/core/hooks/useTopoEdit.js +113 -19
  31. package/es/core/hooks/useTopoEventListener.js +4 -18
  32. package/es/core/hooks/useTopoFullscreen.js +32 -0
  33. package/es/core/models/Alarm.js +4 -13
  34. package/es/core/models/TopoApp.js +1 -1
  35. package/es/core/models/topoData.js +16 -9
  36. package/es/core/models/utils/linkUtils.js +52 -27
  37. package/es/core/store/models/topoConfig.js +51 -20
  38. package/es/core/test/Test.js +52 -0
  39. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +11 -35
  40. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +14 -0
  41. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +8 -6
  42. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +28 -56
  43. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +57 -1
  44. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +13 -52
  45. package/es/networkTopo/getTopoData.js +2 -1
  46. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +5 -5
  47. package/es/networkTopo/services/link.js +1 -1
  48. package/es/networkTopo/services/topo/basic.js +27 -26
  49. package/es/networkTopo/services/topo/networkLink.js +45 -3
  50. package/es/networkTopo/utils/exitLinkUtil.js +262 -0
  51. package/es/utils/ResourceConfigUtil.js +5 -4
  52. package/es/utils/htElementDataUtil.js +1 -7
  53. package/es/utils/htElementUtils.js +21 -21
  54. package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +11 -5
  55. package/lib/core/components/TopoView/GraphViewPanel.js +18 -3
  56. package/lib/core/components/TopoView/TopoView.module.scss +17 -3
  57. package/lib/core/editor/components/BackgroundView/index.module.scss +3 -0
  58. package/lib/core/editor/components/Sidebar/Sidebar.module.scss +7 -7
  59. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
  60. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +1 -0
  61. package/lib/core/editor/components/Sidebar/views/ComponentPanel.js +1 -1
  62. package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +2 -1
  63. package/lib/core/editor/components/Sidebar/views/LinkPanel.js +1 -1
  64. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +21 -4
  65. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +5 -1
  66. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +31 -12
  67. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +12 -2
  68. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +6 -0
  69. package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +1 -1
  70. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +1 -1
  71. package/lib/core/editor/components/settings/core/updateElementProperty.js +6 -1
  72. package/lib/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +3 -3
  73. package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +111 -0
  74. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +48 -14
  75. package/lib/core/editor/config/themes.js +53 -2
  76. package/lib/core/event/topoEventListener.js +27 -0
  77. package/lib/core/hooks/useAlarm.js +19 -12
  78. package/lib/core/hooks/useCanvasTheme.js +12 -4
  79. package/lib/core/hooks/useResourceConfig.js +2 -1
  80. package/lib/core/hooks/useTopoEdit.js +114 -18
  81. package/lib/core/hooks/useTopoEventListener.js +3 -17
  82. package/lib/core/hooks/useTopoFullscreen.js +42 -0
  83. package/lib/core/models/Alarm.js +5 -16
  84. package/lib/core/models/TopoApp.js +1 -1
  85. package/lib/core/models/topoData.js +16 -9
  86. package/lib/core/models/utils/linkUtils.js +53 -26
  87. package/lib/core/store/models/topoConfig.js +56 -19
  88. package/lib/core/test/Test.js +52 -0
  89. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +10 -35
  90. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +14 -0
  91. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +8 -6
  92. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +28 -55
  93. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +58 -1
  94. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +13 -53
  95. package/lib/networkTopo/getTopoData.js +2 -1
  96. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +5 -5
  97. package/lib/networkTopo/services/topo/basic.js +28 -28
  98. package/lib/networkTopo/services/topo/networkLink.js +45 -3
  99. package/lib/networkTopo/utils/exitLinkUtil.js +274 -0
  100. package/lib/utils/ResourceConfigUtil.js +4 -4
  101. package/lib/utils/htElementDataUtil.js +0 -10
  102. package/lib/utils/htElementUtils.js +21 -21
  103. package/package.json +3 -3
@@ -3,8 +3,8 @@
3
3
 
4
4
  .tabs {
5
5
  height: 100%;
6
-
7
- }
6
+ display: flex;
7
+ }
8
8
 
9
9
  // 导航
10
10
  .nav {
@@ -49,17 +49,23 @@
49
49
 
50
50
  // 标签页内容区
51
51
  .content {
52
- width: 260px;
52
+ // width: 260px;
53
53
  height: 100%;
54
54
  border-left: none !important;
55
- border-right: 1px solid var(--tab-wrapped-border-line-color);
56
55
  transition: width .1s linear;
56
+ overflow: initial !important;
57
57
 
58
58
  :global {
59
59
  .#{$css-prefix}tabs-tabpane {
60
- width: 100%;
60
+ position: absolute;
61
+ left: 0;
62
+ top: 0;
63
+ z-index: 1;
64
+ // width: 250px;
61
65
  height: 100%;
62
66
  overflow: auto;
67
+ background: #FFF;
68
+ border-right: 1px solid var(--tab-wrapped-border-line-color);
63
69
  }
64
70
  }
65
71
 
@@ -1,7 +1,11 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
+ import classNames from 'classnames';
2
3
  import useCanvasTheme from "../../hooks/useCanvasTheme";
4
+ import useTopoFullscreen from "../../hooks/useTopoFullscreen";
3
5
  import styles from "./TopoView.module.scss";
4
6
  export default function GraphViewPanel(props) {
7
+ var _classNames;
8
+
5
9
  var topo = props.topo,
6
10
  hideBackgroundColor = props.hideBackgroundColor;
7
11
  var displayConfig = topo.store.useModelState('displayConfig');
@@ -12,8 +16,14 @@ export default function GraphViewPanel(props) {
12
16
  themeName: themeName,
13
17
  hideBackgroundColor: hideBackgroundColor
14
18
  }),
15
- canvasColor = _useCanvasTheme.canvasColor;
19
+ canvasColor = _useCanvasTheme.canvasColor,
20
+ canvasbackgroundImage = _useCanvasTheme.canvasbackgroundImage;
16
21
 
22
+ var panelRef = useRef();
23
+ useTopoFullscreen({
24
+ topo: topo,
25
+ panelRef: panelRef
26
+ });
17
27
  useEffect(function () {
18
28
  // eslint-disable-next-line no-underscore-dangle
19
29
  window._debugtopo = topo; // eslint-disable-next-line no-underscore-dangle
@@ -29,9 +39,12 @@ export default function GraphViewPanel(props) {
29
39
  };
30
40
 
31
41
  return /*#__PURE__*/React.createElement("div", {
32
- className: styles.viewPanel,
33
- style: {
42
+ ref: panelRef,
43
+ className: classNames(styles.viewPanel, (_classNames = {}, _classNames[styles.backgroundImg] = !!canvasbackgroundImage, _classNames)),
44
+ style: canvasColor ? {
34
45
  background: canvasColor
46
+ } : {
47
+ backgroundImage: "url(" + canvasbackgroundImage + ")"
35
48
  },
36
49
  onFocus: onFocus
37
50
  }, props.children);
@@ -10,14 +10,28 @@
10
10
  flex: 1;
11
11
  overflow: hidden;
12
12
  position: relative;
13
+
14
+ &.backgroundImg {
15
+ /* 背景图垂直、水平均居中 */
16
+ background-position: center center;
17
+ /* 背景图不平铺 */
18
+ background-repeat: no-repeat;
19
+ /* 当内容高度大于图片高度时,背景图像的位置相对于viewport固定 */
20
+ background-attachment: fixed;
21
+ /* 让背景图基于容器大小伸缩 */
22
+ background-size: cover;
23
+ /* 设置背景颜色,背景图加载过程中会显示背景色 */
24
+ // background-color: #464646;
25
+ }
13
26
  }
14
27
 
15
28
  // 解决拓扑图容器绝对定位z-index>0时浮层和右键菜单不显示问题
16
29
  :global {
17
- body > .ht-ui-view {
30
+ body>.ht-ui-view {
18
31
  z-index: 10000;
19
32
  }
20
- body > div[ht="ht-view ht.ui.ContextMenu"] {
33
+
34
+ body>div[ht="ht-view ht.ui.ContextMenu"] {
21
35
  z-index: 1000;
22
36
  }
23
- }
37
+ }
@@ -1,8 +1,11 @@
1
1
  @import "~@alifd/next/variables.scss";
2
2
 
3
3
  .background-view {
4
+ width: 260px;
4
5
  padding: 16px;
5
6
  background: #fff;
7
+ height: 100%;
8
+ overflow: auto;
6
9
  .option {
7
10
  text-align: right;
8
11
  button {
@@ -1,19 +1,19 @@
1
1
  .sidebar {
2
2
  // border-right: 1px solid #E6E7EB;
3
3
  position: relative;
4
- width: 60px;
4
+ // width: 60px;
5
5
 
6
6
  .tabsContainer {
7
- position: absolute;
8
- width: 60px;
7
+ // position: absolute;
8
+ // left: 0;
9
+ // top: 0;
10
+ // z-index: 1;
11
+ // width: 60px;
9
12
  height: 100%;
10
- left: 0;
11
- top: 0;
12
- z-index: 1;
13
13
  background: #FFF;
14
14
 
15
15
  &.expanded {
16
- width: 320px;
16
+ // width: 320px;
17
17
  }
18
18
  }
19
19
  }
@@ -21,7 +21,7 @@ export default function CanvasPanel(props) {
21
21
  }, /*#__PURE__*/React.createElement(_Tag.Selectable, {
22
22
  className: styles.tag,
23
23
  style: {
24
- background: item.color
24
+ background: item.color || "url(" + item.backgroundImageThumbnail + ")"
25
25
  },
26
26
  checked: item.name === canvasThemeName,
27
27
  onChange: function onChange(checked) {
@@ -1,6 +1,7 @@
1
1
  @import "~@alifd/next/variables.scss";
2
2
 
3
3
  .canvasToggle {
4
+ width: 260px;
4
5
  display: flex;
5
6
  flex-wrap: wrap;
6
7
  .canvas {
@@ -34,7 +34,7 @@ export default function ComponentPanel(props) {
34
34
  return /*#__PURE__*/React.createElement("div", {
35
35
  ref: divRef,
36
36
  style: {
37
- width: '100%',
37
+ width: '260px',
38
38
  height: '100%'
39
39
  }
40
40
  });
@@ -24,7 +24,8 @@ export default function ImagePanel(props) {
24
24
  accordion: true,
25
25
  defaultExpandedKeys: ['资源图片'],
26
26
  style: {
27
- border: 'none'
27
+ border: 'none',
28
+ minWidth: '300px'
28
29
  },
29
30
  fullheight: true,
30
31
  noContentPadding: true
@@ -34,7 +34,7 @@ function LinkPanel(props) {
34
34
  return /*#__PURE__*/React.createElement("div", {
35
35
  ref: divRef,
36
36
  style: {
37
- width: '100%',
37
+ width: '260px',
38
38
  height: '100%'
39
39
  }
40
40
  });
@@ -1,7 +1,8 @@
1
+ import _Checkbox from "@alifd/next/es/checkbox";
1
2
  import _Field from "@alifd/next/es/field";
2
3
  import _Select from "@alifd/next/es/select";
3
4
  import _Form from "@alifd/next/es/form";
4
- import React, { useEffect } from 'react';
5
+ import React, { useEffect, useState } from 'react';
5
6
  import { getEdgesBySelection, loopEdgesAndChildren } from "../../../../utils/edgeTypeStyleUtil";
6
7
  import styles from "./EdgeType.module.scss";
7
8
  import LineType from "./LineType";
@@ -76,10 +77,12 @@ function getValuesByEdges(topo) {
76
77
  })[0] || 'nil';
77
78
  }
78
79
 
79
- function getEdgesValues(edges) {
80
+ function getEdgesValues(edges, topo) {
80
81
  var edgeValues = [];
82
+ var htTopo = topo.getHtTopo();
81
83
  edges.forEach(function (edge) {
82
84
  edgeValues.push({
85
+ baseAgreement: htTopo.getEdgeMultarc(edges),
83
86
  lineButton: edge.s('edge.type'),
84
87
  startPoint: getStartPoint(edge),
85
88
  endPoint: getEndPoint(edge),
@@ -90,8 +93,9 @@ function getValuesByEdges(topo) {
90
93
  }
91
94
 
92
95
  var selectionEdges = getEdgesBySelection(topo);
93
- var edgeValues = getEdgesValues(selectionEdges);
96
+ var edgeValues = getEdgesValues(selectionEdges, topo);
94
97
  var values = {
98
+ baseAgreement: false,
95
99
  lineButton: undefined,
96
100
  startPoint: undefined,
97
101
  endPoint: undefined,
@@ -117,10 +121,18 @@ function EdgeType(props) {
117
121
  selection = props.selection,
118
122
  _onChange = props.onChange;
119
123
 
124
+ var _useState = useState(false),
125
+ disable = _useState[0],
126
+ setDisabel = _useState[1];
127
+
120
128
  var field = _Field.useField({
121
129
  autoUnmount: false,
122
130
  values: getValuesByEdges(topo),
123
131
  onChange: function onChange(name, value) {
132
+ if (name == 'baseAgreement') {
133
+ setDisabel(value);
134
+ }
135
+
124
136
  if (['startPoint', 'endPoint'].includes(name) && value === 'nil') {
125
137
  _onChange(name, null);
126
138
  } else {
@@ -139,8 +151,12 @@ function EdgeType(props) {
139
151
  inline: true,
140
152
  labelAlign: "top"
141
153
  }, /*#__PURE__*/React.createElement(FormItem, null, /*#__PURE__*/React.createElement(LineType, {
142
- name: "lineButton"
143
- })), /*#__PURE__*/React.createElement(FormItem, {
154
+ name: "lineButton",
155
+ disable: disable
156
+ })), /*#__PURE__*/React.createElement(FormItem, null, /*#__PURE__*/React.createElement(_Checkbox, {
157
+ name: "baseAgreement",
158
+ onChange: _onChange
159
+ }, "\u81EA\u52A8\u8C03\u6574")), /*#__PURE__*/React.createElement(FormItem, {
144
160
  label: "\u8D77\u70B9"
145
161
  }, /*#__PURE__*/React.createElement(_Select, {
146
162
  name: "startPoint",
@@ -5,7 +5,6 @@
5
5
  background: #FFFFFF;
6
6
  border-radius: 4px;
7
7
  margin-bottom: -7px;
8
-
9
8
  :global {
10
9
  .#{$css-prefix}form-item:first-child{
11
10
  margin-top: 0;
@@ -15,6 +14,11 @@
15
14
  margin-top: 7px;
16
15
  margin-bottom: 7px;
17
16
  }
17
+ .#{$css-prefix}form-item:nth-child(2){
18
+ display: block !important;
19
+ margin-top: 7px;
20
+ margin-bottom: 0px;
21
+ }
18
22
  .#{$css-prefix}form.#{$css-prefix}inline .#{$css-prefix}form-item:not(:last-child) {
19
23
  margin-right: 8px;
20
24
  .#{$css-prefix}select-trigger {
@@ -20,28 +20,47 @@ var LINE_TYPE_OPTIONS = [{
20
20
  value: 'ortho',
21
21
  label: '双折线',
22
22
  icon: 'topo_linear_icon_bilinear'
23
+ }, {
24
+ value: 'arc',
25
+ label: '单弧线',
26
+ icon: 'topo_linear_icon_arc_line'
23
27
  }, {
24
28
  value: 'doublearc',
25
29
  label: '双弧线',
26
30
  icon: 'topo_linear_icon_arcline'
31
+ }, {
32
+ value: 'points',
33
+ label: '自由线形',
34
+ icon: 'topo_linear_icon_pointsline'
27
35
  }];
28
36
  var LineType = /*#__PURE__*/React.forwardRef(function (props, ref) {
29
37
  var value = props.value,
30
- onChange = props.onChange;
38
+ onChange = props.onChange,
39
+ disable = props.disable;
31
40
 
32
41
  function lineButton(item) {
33
- var _classNames;
42
+ if (disable) {
43
+ return /*#__PURE__*/React.createElement(_Button, {
44
+ className: styles.redioBtnDisable
45
+ }, /*#__PURE__*/React.createElement("img", {
46
+ src: "/img/topo/editor/lineType/" + item.icon + "_disable.svg",
47
+ alt: "",
48
+ className: styles.iconImg
49
+ }));
50
+ } else {
51
+ var _classNames;
34
52
 
35
- return /*#__PURE__*/React.createElement(_Button, {
36
- className: classNames(styles.redioBtn, (_classNames = {}, _classNames[styles.selected] = value === item.value, _classNames)),
37
- onClick: function onClick() {
38
- onChange(item.value);
39
- }
40
- }, /*#__PURE__*/React.createElement("img", {
41
- src: "/img/topo/editor/lineType/" + item.icon + ".svg",
42
- alt: "",
43
- className: styles.iconImg
44
- }));
53
+ return /*#__PURE__*/React.createElement(_Button, {
54
+ className: classNames(styles.redioBtn, (_classNames = {}, _classNames[styles.selected] = value === item.value, _classNames)),
55
+ onClick: function onClick() {
56
+ onChange(item.value);
57
+ }
58
+ }, /*#__PURE__*/React.createElement("img", {
59
+ src: "/img/topo/editor/lineType/" + item.icon + ".svg",
60
+ alt: "",
61
+ className: styles.iconImg
62
+ }));
63
+ }
45
64
  }
46
65
 
47
66
  return /*#__PURE__*/React.createElement("div", {
@@ -1,5 +1,15 @@
1
1
  .lineType{
2
2
  display:flex;
3
+ .redioBtnDisable {
4
+ width: 24px;
5
+ height: 24px;
6
+ border-radius: 4px;
7
+ border: none !important;
8
+ color: #4D6277;
9
+ padding: 0;
10
+ margin-right: 10px;
11
+ text-align: center;
12
+ }
3
13
  .redioBtn {
4
14
  width: 24px;
5
15
  height: 24px;
@@ -7,9 +17,9 @@
7
17
  border: none !important;
8
18
  color: #4D6277;
9
19
  padding: 0;
10
- margin-right: 16px;
20
+ margin-right: 10px;
11
21
  text-align: center;
12
-
22
+
13
23
  .iconImg {
14
24
  vertical-align: middle;
15
25
  }
@@ -49,6 +49,12 @@ function EdgeTypeButton(props) {
49
49
  return;
50
50
  }
51
51
 
52
+ if (name == 'baseAgreement') {
53
+ /** TODO: 自动调整api调用*/
54
+ htTopo.setEdgeMultarc(edges, value);
55
+ return;
56
+ }
57
+
52
58
  setEdgesAndChildren(topo, edges, function (edge) {
53
59
  if (name === 'startPoint') {
54
60
  // 删除设置
@@ -15,7 +15,7 @@ function FontSizeSelect(props) {
15
15
  style: {
16
16
  width: 18
17
17
  }
18
- }, val || 12);
18
+ }, val || 20);
19
19
  },
20
20
  disabled: disabled,
21
21
  onSelect: function onSelect(val) {
@@ -15,7 +15,7 @@ export function getTextStyle(element) {
15
15
  color: parseColor(element.s('group.title.color')),
16
16
  underline: underline
17
17
  }, fontStyleUtil.toMap(element.s('group.title.font')), {
18
- fontSize: font.fontSize || 12,
18
+ fontSize: font.fontSize || (isClusterHtElement(element) ? 20 : 24),
19
19
  fontFamily: font.fontFamily || '微软雅黑'
20
20
  }, parseBackground(element.s('group.title.background')));
21
21
  }
@@ -1,6 +1,11 @@
1
1
  export default function updateElementProperty(topo, name, value) {
2
2
  // const element = topo.getDataModel().getDataById(selection[0].id);
3
- var element = topo.getSelectionModel().getFirstData(); // console.info("updateElementProperty",topo.getSelectionModel().getSelection(), { selection, element, name, value });
3
+ var element = topo.getSelectionModel().getFirstData();
4
+ console.info("updateElementProperty", topo.getSelectionModel().getSelection(), {
5
+ element: element,
6
+ name: name,
7
+ value: value
8
+ });
4
9
 
5
10
  if (name.startsWith('attrObject.')) {
6
11
  element.setAttr(name.replace('attrObject.', ''), value);
@@ -1,8 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import { iconFactory } from "@riil-frontend/component-topology-graph";
3
3
  import sortBy from "lodash/sortBy";
4
- import { getGroupChildrenResourceElements } from "../../../../../../../../utils/htElementDataUtil";
5
- import { getNodeData } from "../../../../../../../../utils/htElementUtils";
4
+ import { getGroupChildren, getNodeData } from "../../../../../../../../utils/htElementUtils";
6
5
 
7
6
  function sortResourcesByName(resources) {
8
7
  return sortBy(resources, "name");
@@ -19,7 +18,9 @@ export default function useGroupRelateResource(props) {
19
18
  } : _props$useGroupSortRe; // const [resources, setResources] = useState([]);
20
19
  // 过滤出资源
21
20
 
22
- var resourceNodes = getGroupChildrenResourceElements(group); // 资源按名称排序
21
+ var resourceNodes = getGroupChildren(group).filter(function (item) {
22
+ return !!item.getTag();
23
+ }); // 资源按名称排序
23
24
 
24
25
  var useSortNodes = useGroupSortResources || ((_topo$options$editor = topo.options.editor) === null || _topo$options$editor === void 0 ? void 0 : _topo$options$editor.sortResources) || sortResourcesByName;
25
26
  var data = useSortNodes(resourceNodes.map(function (node) {
@@ -0,0 +1,95 @@
1
+ import _Button from "@alifd/next/es/button";
2
+ import _Input from "@alifd/next/es/input";
3
+ import _Form from "@alifd/next/es/form";
4
+ import React, { useState, useEffect } from "react";
5
+ import { isUniqueIp } from "../../../../../../../networkTopo/utils/exitLinkUtil";
6
+ var FormItem = _Form.Item;
7
+ /**
8
+ * @return {React.ReactNode | null}
9
+ */
10
+
11
+ export default function BindIpInput(props) {
12
+ var _values$attrObjectBi;
13
+
14
+ var nodeElement = props.nodeElement,
15
+ topo = props.topo,
16
+ topoEditApi = props.topoEditApi,
17
+ values = props.values,
18
+ onChange = props.onChange,
19
+ fieldItem = props.fieldItem; // const currentResId = node.tag;
20
+ // console.log(
21
+ // "nodeElement, topo, topoEditApi, node",
22
+ // nodeElement,
23
+ // topo,
24
+ // topoEditApi,
25
+ // values
26
+ // );
27
+
28
+ var _useState = useState(""),
29
+ error = _useState[0],
30
+ setError = _useState[1];
31
+
32
+ var _useState2 = useState((_values$attrObjectBi = values["attrObject.bindIp"]) !== null && _values$attrObjectBi !== void 0 ? _values$attrObjectBi : ""),
33
+ txtValue = _useState2[0],
34
+ setTxtValue = _useState2[1];
35
+
36
+ var saveIp = function saveIp(v) {
37
+ fieldItem.validate(function (errors, vals) {
38
+ if (errors) {
39
+ console.error("saveIp-error", errors, vals);
40
+ } else {
41
+ setError("");
42
+ onChange(txtValue);
43
+ topoEditApi.relateNodeIp(txtValue, nodeElement);
44
+ }
45
+ });
46
+ };
47
+
48
+ useEffect(function () {
49
+ fieldItem.reset();
50
+ setTxtValue(values["attrObject.bindIp"]);
51
+ }, [values]);
52
+
53
+ var inputChange = function inputChange(v) {
54
+ setTxtValue(v); // onChange(v);
55
+ }; // 图片节点验证ip唯一性
56
+
57
+
58
+ var checkIp = function checkIp(rule, value, callback) {
59
+ var dm = topo.getDataModel();
60
+ var isUnique = isUniqueIp(dm, value, nodeElement); // console.log("checkIp", isUnique);
61
+
62
+ if (!isUnique) {
63
+ return callback("ip不能重复");
64
+ } else {
65
+ return callback();
66
+ }
67
+ };
68
+
69
+ return /*#__PURE__*/React.createElement("div", {
70
+ style: {
71
+ display: "flex"
72
+ }
73
+ }, /*#__PURE__*/React.createElement(FormItem, {
74
+ label: "\u5173\u8054IP",
75
+ pattern: /^((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))$/,
76
+ patternTrigger: "onBlur",
77
+ patternMessage: "IP\u5730\u5740\u683C\u5F0F\u4E0D\u6B63\u786E",
78
+ validator: checkIp
79
+ }, /*#__PURE__*/React.createElement(_Input, {
80
+ placeholder: "\u8BF7\u8F93\u5165Ip\u5730\u5740",
81
+ name: "attrObject.bindIp",
82
+ state: error,
83
+ value: txtValue,
84
+ maxLength: 128,
85
+ onChange: inputChange
86
+ })), /*#__PURE__*/React.createElement(_Button, {
87
+ type: "primary",
88
+ text: true,
89
+ onClick: saveIp,
90
+ style: {
91
+ marginLeft: 10,
92
+ marginTop: 27
93
+ }
94
+ }, "\u4FDD\u5B58"));
95
+ }
@@ -9,26 +9,29 @@ import React, { useEffect } from "react";
9
9
  import textStyles from "../../../../../../common/text.module.scss";
10
10
  import NodeRelateResourceButton from "./NodeRelateResourceButton";
11
11
  import PlatformDisplay from "./PlatformDisplay";
12
+ import BindIpInput from "./BindIpInput";
13
+ import { isUniqueIp } from "../../../../../../../networkTopo/utils/exitLinkUtil";
12
14
  var Option = _Select.Option;
13
15
  var CollapsePanel = _Collapse.Panel;
14
16
 
15
17
  function parseValues(values) {
16
18
  return _extends({}, values, {
17
19
  "attrObject.customName": values["attrObject.customName"] || values["attrObject.name"],
18
- "attrObject.bindTopo": values["attrObject.bindTopo"] || "" // 解决切换节点时关联拓扑选项未重置
19
-
20
+ "attrObject.bindTopo": values["attrObject.bindTopo"] || "",
21
+ // 解决切换节点时关联拓扑选项未重置
22
+ "attrObject.bindIp": values["attrObject.bindIp"] || ""
20
23
  });
21
24
  }
22
25
 
23
26
  function getBindType(values) {
24
- if (values.tag) {
25
- return "resource";
26
- }
27
-
28
27
  if (values.attrObject.bindType) {
29
28
  return values.attrObject.bindType;
30
29
  }
31
30
 
31
+ if (values.tag && !values.tag.startsWith("ip:")) {
32
+ return "resource";
33
+ }
34
+
32
35
  return "none";
33
36
  }
34
37
 
@@ -39,15 +42,20 @@ export default function Data(props) {
39
42
  values = props.values,
40
43
  _onChange = props.onChange,
41
44
  editorProps = props.editorProps;
42
- var bindType = getBindType(values);
45
+ var bindType = getBindType(values); // console.log("node, values", node, values);
43
46
 
44
47
  var field = _Field.useField({
45
48
  autoUnmount: false,
46
49
  values: parseValues(values),
47
50
  onChange: function onChange(name, value) {
48
- var newValues = field.getValues();
51
+ field.validate(function (errors, vals) {
52
+ if (errors) {// console.error("field-Data", errors, vals);
53
+ } else {
54
+ var newValues = field.getValues();
49
55
 
50
- _onChange(name, value, newValues);
56
+ _onChange(name, value, newValues);
57
+ }
58
+ });
51
59
  }
52
60
  });
53
61
 
@@ -107,7 +115,7 @@ export default function Data(props) {
107
115
  }, /*#__PURE__*/React.createElement(_Form, {
108
116
  field: field,
109
117
  labelAlign: "top"
110
- }, !values.tag && /*#__PURE__*/React.createElement(_Form.Item, {
118
+ }, (!values.tag || bindType === "ip") && /*#__PURE__*/React.createElement(_Form.Item, {
111
119
  label: "\u5173\u8054\u7C7B\u578B"
112
120
  }, /*#__PURE__*/React.createElement(_Select, {
113
121
  name: "bindType",
@@ -121,7 +129,9 @@ export default function Data(props) {
121
129
  value: "none"
122
130
  }, "\u672A\u5173\u8054"), /*#__PURE__*/React.createElement(Option, {
123
131
  value: "resource"
124
- }, "\u5173\u8054\u8D44\u6E90"), RelateTopoTree && /*#__PURE__*/React.createElement(Option, {
132
+ }, "\u5173\u8054\u8D44\u6E90"), /*#__PURE__*/React.createElement(Option, {
133
+ value: "ip"
134
+ }, "\u5173\u8054IP"), RelateTopoTree && /*#__PURE__*/React.createElement(Option, {
125
135
  value: "topo"
126
136
  }, "\u5173\u8054\u62D3\u6251"))), bindType === "resource" && /*#__PURE__*/React.createElement(_Form.Item, {
127
137
  label: "\u5173\u8054\u8D44\u6E90"
@@ -135,7 +145,7 @@ export default function Data(props) {
135
145
  flex: 1,
136
146
  paddingRight: 16,
137
147
  color: "#4D6277",
138
- lineHeight: '20px'
148
+ lineHeight: "20px"
139
149
  },
140
150
  title: values.tag ? values.name : null
141
151
  }, values.tag ? values.name : "—"), /*#__PURE__*/React.createElement(NodeRelateResourceButton, {
@@ -144,13 +154,35 @@ export default function Data(props) {
144
154
  topo: topo,
145
155
  topoEditApi: topoEditApi,
146
156
  nodeBindResourceDrawerComponent: editorProps.nodeBindResourceDrawerComponent
147
- }))), bindType === "topo" && RelateTopoTree && /*#__PURE__*/React.createElement(_Form.Item, {
157
+ }))), bindType === "ip" &&
158
+ /*#__PURE__*/
159
+ // <Form.Item
160
+ // label="关联IP"
161
+ // // style={{ display: "flex" }}
162
+ // pattern={
163
+ // /^((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))$/
164
+ // }
165
+ // patternTrigger="onBlur"
166
+ // patternMessage="IP地址格式不正确"
167
+ // >
168
+ React.createElement(BindIpInput, {
169
+ nodeElement: node,
170
+ values: values,
171
+ topo: topo,
172
+ fieldItem: field,
173
+ topoEditApi: topoEditApi,
174
+ placeholder: "\u8BF7\u8F93\u5165",
175
+ name: "attrObject.bindIp",
176
+ onChange: _onChange,
177
+ maxLength: 128
178
+ }) // </Form.Item>
179
+ , bindType === "topo" && RelateTopoTree && /*#__PURE__*/React.createElement(_Form.Item, {
148
180
  label: "\u5173\u8054\u62D3\u6251"
149
181
  }, /*#__PURE__*/React.createElement(RelateTopoTree, {
150
182
  name: "attrObject.bindTopo",
151
183
  topo: topo,
152
184
  onChange: handleBindTopoChange
153
- })), (editorProps === null || editorProps === void 0 ? void 0 : editorProps.topoType) === 'cmpTopo' && node.getTag() && /*#__PURE__*/React.createElement(_Form.Item, {
185
+ })), (editorProps === null || editorProps === void 0 ? void 0 : editorProps.topoType) === "cmpTopo" && node.getTag() && /*#__PURE__*/React.createElement(_Form.Item, {
154
186
  label: "\u6240\u5C5E\u5E73\u53F0"
155
187
  }, /*#__PURE__*/React.createElement(PlatformDisplay, props)))));
156
188
  }