@riil-frontend/component-topology 3.1.6 → 3.1.9

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 (76) hide show
  1. package/CHANGELOG.md +8 -15
  2. package/build/1.js +1 -1
  3. package/build/index.css +1 -1
  4. package/build/index.js +11 -11
  5. package/demo/1/345/237/272/346/234/254//345/256/232/345/210/266/345/214/226/350/265/204/346/272/220/346/246/202/350/247/210.md +11 -0
  6. package/demo/1/345/237/272/346/234/254//350/207/252/345/256/232/344/271/211/346/240/207/346/263/250/345/222/214/346/202/254/346/265/256/346/241/206.md +11 -0
  7. package/demo/2/347/274/226/350/276/221/346/250/241/345/274/217//345/261/236/346/200/247/351/235/242/346/235/277.md +11 -0
  8. package/demo//346/240/207/346/263/250/345/222/214/346/202/254/346/265/256/346/241/206//350/207/252/345/256/232/344/271/211/345/261/236/346/200/247/345/222/214/346/214/207/346/240/207.md +2 -2
  9. package/demo-mock/basic/topo/v1/api/attributes/once +152 -0
  10. package/demo-mock/basic/topo/v1/api/attributes/once.json +152 -0
  11. package/es/core/components/DisplaySettingDrawer/DisplaySetting.js +4 -5
  12. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +2 -2
  13. package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +3 -5
  14. package/es/core/editor/components/settings/propertyViews/group/DataTab/RelateData.js +19 -6
  15. package/es/core/editor/components/settings/propertyViews/node/NodePropertyView.js +25 -160
  16. package/es/core/editor/components/settings/propertyViews/node/Setting/Setting.js +76 -0
  17. package/es/core/editor/components/settings/propertyViews/node/Setting/index.js +2 -0
  18. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +125 -0
  19. package/es/core/models/AttributeMetricDisplay.js +9 -5
  20. package/es/core/models/TopoApp.js +1 -1
  21. package/es/core/viewer/components/plugins/{BaseInfo/index.js → ResourceDetail/ResourceDetail.js} +23 -11
  22. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +11 -0
  23. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +131 -0
  24. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +31 -0
  25. package/es/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/BlockBox.js +0 -0
  26. package/es/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/BlockBox.module.scss +0 -0
  27. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +46 -0
  28. package/es/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/SingleResourceStrategyLink.js +4 -2
  29. package/es/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/index.js +70 -180
  30. package/es/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/index.module.scss +0 -0
  31. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/useCiAttrAndMetricData.js +12 -0
  32. package/es/core/viewer/components/plugins/ResourceDetail/index.js +2 -0
  33. package/es/core/viewer/components/plugins/ResourceDetail/index.module.scss +39 -30
  34. package/es/core/viewer/components/plugins/ViewerPlugin.js +2 -2
  35. package/es/core/viewer/components/titlebar/BasicTools.js +1 -1
  36. package/es/core/viewer/components/titlebar/widgets/SettingButton.js +3 -4
  37. package/es/core/viewer/components/titlebar/widgets/SettingButtonWidget.js +19 -0
  38. package/es/topoCenter/components/TopoView.js +3 -4
  39. package/es/topoCenter/models/TopoCenter.js +9 -5
  40. package/lib/core/components/DisplaySettingDrawer/DisplaySetting.js +4 -5
  41. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +2 -2
  42. package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +3 -5
  43. package/lib/core/editor/components/settings/propertyViews/group/DataTab/RelateData.js +20 -7
  44. package/lib/core/editor/components/settings/propertyViews/node/NodePropertyView.js +25 -171
  45. package/lib/core/editor/components/settings/propertyViews/node/Setting/Setting.js +95 -0
  46. package/lib/core/editor/components/settings/propertyViews/node/Setting/index.js +11 -0
  47. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +145 -0
  48. package/lib/core/models/AttributeMetricDisplay.js +8 -4
  49. package/lib/core/models/TopoApp.js +1 -1
  50. package/lib/core/viewer/components/plugins/{BaseInfo/index.js → ResourceDetail/ResourceDetail.js} +25 -12
  51. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +21 -0
  52. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +141 -0
  53. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +42 -0
  54. package/lib/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/BlockBox.js +0 -0
  55. package/lib/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/BlockBox.module.scss +0 -0
  56. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +56 -0
  57. package/lib/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/SingleResourceStrategyLink.js +4 -2
  58. package/lib/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/index.js +73 -182
  59. package/lib/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/index.module.scss +0 -0
  60. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/useCiAttrAndMetricData.js +17 -0
  61. package/lib/core/viewer/components/plugins/ResourceDetail/index.js +11 -0
  62. package/lib/core/viewer/components/plugins/ResourceDetail/index.module.scss +39 -30
  63. package/lib/core/viewer/components/plugins/ViewerPlugin.js +2 -2
  64. package/lib/core/viewer/components/titlebar/BasicTools.js +2 -2
  65. package/lib/core/viewer/components/titlebar/widgets/SettingButton.js +2 -3
  66. package/lib/core/viewer/components/titlebar/widgets/SettingButtonWidget.js +28 -0
  67. package/lib/topoCenter/components/TopoView.js +3 -4
  68. package/lib/topoCenter/models/TopoCenter.js +9 -5
  69. package/package.json +2 -2
  70. package/demo/1/345/237/272/346/234/254//350/207/252/345/256/232/344/271/211/345/261/236/346/200/247/345/222/214/346/214/207/346/240/207.md +0 -11
  71. package/es/core/viewer/components/plugins/BaseInfo/index.module.scss +0 -49
  72. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawerPlugin.js +0 -37
  73. package/es/core/viewer/components/plugins/ResourceDetail/topoDrawer.js +0 -147
  74. package/lib/core/viewer/components/plugins/BaseInfo/index.module.scss +0 -49
  75. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawerPlugin.js +0 -50
  76. package/lib/core/viewer/components/plugins/ResourceDetail/topoDrawer.js +0 -167
@@ -1,186 +1,51 @@
1
1
  import _Tab from "@alifd/next/es/tab";
2
- import _Input from "@alifd/next/es/input";
3
- import _Form from "@alifd/next/es/form";
4
- import _Field from "@alifd/next/es/field";
5
2
  import _extends from "@babel/runtime/helpers/extends";
6
- import _Collapse from "@alifd/next/es/collapse";
7
- import _Select from "@alifd/next/es/select";
8
- import React, { useEffect } from 'react';
9
- import NodeSizeInput from "../../common/NodeSizeInput/NodeSizeInput";
10
- import textStyles from "../../../../../common/text.module.scss";
11
- import NodeIconSelect from "./NodeIconSelect";
12
- import NodeRelateResourceButton from "./data/NodeRelateResourceButton";
13
- import styles from "./NodePropertyView.module.scss";
14
- import TabView from "../../common/tab/TabView";
3
+ import React from 'react';
15
4
  import useHtElement from "../../../../../common/hooks/useHtElement";
16
- var Option = _Select.Option;
17
- var CollapsePanel = _Collapse.Panel;
18
-
19
- function parseValues(values) {
20
- return _extends({}, values, {
21
- 'attrObject.customName': values['attrObject.customName'] || values['attrObject.name'],
22
- 'attrObject.bindTopo': values['attrObject.bindTopo'] || '' // 解决切换节点时关联拓扑选项未重置
23
-
24
- });
25
- }
26
-
27
- function getBindType(values) {
28
- if (values.tag) {
29
- return 'resource';
30
- }
31
-
32
- if (values.attrObject.bindType) {
33
- return values.attrObject.bindType;
34
- }
35
-
36
- return 'none';
37
- }
38
-
5
+ import TabView from "../../common/tab/TabView";
6
+ import Data from "./data/Data";
7
+ import styles from "./NodePropertyView.module.scss";
8
+ import Setting from "./Setting";
39
9
  export default function NodePropertyView(props) {
40
10
  var _topo$options$editor;
41
11
 
42
12
  var topo = props.topo,
43
13
  topoEditApi = props.topoEditApi,
44
14
  values = props.values,
45
- _onChange = props.onChange,
15
+ onChange = props.onChange,
46
16
  editorProps = props.editorProps,
47
17
  settingRuntimeState = props.settingRuntimeState;
48
- var bindType = getBindType(values);
49
18
  var node = useHtElement({
50
19
  topo: topo,
51
20
  id: values.id
52
21
  });
53
22
 
54
- var field = _Field.useField({
55
- autoUnmount: false,
56
- values: parseValues(values),
57
- onChange: function onChange(name, value) {
58
- var newValues = field.getValues();
59
-
60
- _onChange(name, value, newValues);
61
- }
62
- });
63
-
64
- useEffect(function () {
65
- field.setValues(parseValues(values));
66
- }, [values]);
67
-
68
- var setBindType = function setBindType(newBindType) {
69
- _onChange('attrObject.bindType', newBindType);
70
-
71
- if (newBindType === 'topo') {//
72
- }
73
- };
74
-
75
- var handleBindTopoChange = function handleBindTopoChange(value, data) {
76
- // 设置名称为拓扑名称,清空自定义名称
77
- node.a('name', data.label);
78
- node.a('customName', null);
79
- };
80
-
81
23
  var renderData = function renderData() {
82
- var RelateTopoTree = editorProps === null || editorProps === void 0 ? void 0 : editorProps.relateTopoTree;
83
- return /*#__PURE__*/React.createElement(_Collapse, {
84
- defaultExpandedKeys: ['相关资源'],
85
- style: {
86
- border: 'none'
87
- }
88
- }, /*#__PURE__*/React.createElement(CollapsePanel, {
89
- key: "\u76F8\u5173\u8D44\u6E90",
90
- title: "\u76F8\u5173\u8D44\u6E90"
91
- }, /*#__PURE__*/React.createElement(_Form, {
92
- field: field,
93
- labelAlign: "top"
94
- }, !values.tag && /*#__PURE__*/React.createElement(_Form.Item, {
95
- label: "\u5173\u8054\u7C7B\u578B"
96
- }, /*#__PURE__*/React.createElement(_Select, {
97
- name: "bindType",
98
- value: bindType,
99
- style: {
100
- width: '100%',
101
- marginRight: 8
102
- },
103
- onChange: setBindType
104
- }, /*#__PURE__*/React.createElement(Option, {
105
- value: "none"
106
- }, "\u672A\u5173\u8054"), /*#__PURE__*/React.createElement(Option, {
107
- value: "resource"
108
- }, "\u5173\u8054\u8D44\u6E90"), RelateTopoTree && /*#__PURE__*/React.createElement(Option, {
109
- value: "topo"
110
- }, "\u5173\u8054\u62D3\u6251"))), bindType === 'resource' && /*#__PURE__*/React.createElement(_Form.Item, {
111
- label: "\u5173\u8054\u8D44\u6E90"
112
- }, /*#__PURE__*/React.createElement("div", {
113
- style: {
114
- display: 'flex'
115
- }
116
- }, /*#__PURE__*/React.createElement("div", {
117
- className: textStyles.textEllipsis,
118
- style: {
119
- flex: 1,
120
- paddingRight: 16,
121
- color: '#4D6277'
122
- },
123
- title: values.tag ? values.name : null
124
- }, values.tag ? values.name : '—'), /*#__PURE__*/React.createElement(NodeRelateResourceButton, {
125
- node: values,
126
- topo: topo,
127
- topoEditApi: topoEditApi
128
- }))), bindType === 'topo' && RelateTopoTree && /*#__PURE__*/React.createElement(_Form.Item, {
129
- label: "\u5173\u8054\u62D3\u6251"
130
- }, /*#__PURE__*/React.createElement(RelateTopoTree, {
131
- name: "attrObject.bindTopo",
132
- topo: topo,
133
- onChange: handleBindTopoChange
134
- })))));
24
+ return /*#__PURE__*/React.createElement(Data, props);
135
25
  };
136
26
 
137
- var renderViewSetting = function renderViewSetting() {
138
- return /*#__PURE__*/React.createElement(_Form, {
139
- field: field,
140
- labelAlign: "top"
141
- }, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Collapse, {
142
- defaultExpandedKeys: ['显示设置'],
143
- style: {
144
- border: 'none'
145
- }
146
- }, /*#__PURE__*/React.createElement(CollapsePanel, {
147
- key: "\u663E\u793A\u8BBE\u7F6E",
148
- title: "\u663E\u793A\u8BBE\u7F6E"
149
- }, /*#__PURE__*/React.createElement(_Form.Item, {
150
- label: "\u56FE\u7247\u540D\u79F0"
151
- }, /*#__PURE__*/React.createElement(_Input, {
152
- name: "attrObject.customName"
153
- })), /*#__PURE__*/React.createElement(_Form.Item, {
154
- label: "\u663E\u793A\u56FE\u7247"
155
- }, /*#__PURE__*/React.createElement(NodeIconSelect, {
156
- name: "image",
157
- topo: topo
158
- })), /*#__PURE__*/React.createElement(_Form.Item, {
159
- label: "\u56FE\u7247\u5C3A\u5BF8"
160
- }, /*#__PURE__*/React.createElement(NodeSizeInput, {
161
- node: values.id,
162
- value: {
163
- width: values.width,
164
- height: values.height
165
- },
166
- onChange: function onChange(size) {
167
- _onChange('width', size.width);
168
-
169
- _onChange('height', size.height);
170
- },
171
- settingRuntimeState: settingRuntimeState
172
- }))))));
27
+ var renderSetting = function renderSetting() {
28
+ var nodeSettingViewProps = editorProps.nodeSettingViewProps;
29
+ return /*#__PURE__*/React.createElement(Setting, _extends({}, props, nodeSettingViewProps));
173
30
  }; // 未绑定资源的节点,根据参数控制是否可关联资源
174
31
 
175
32
 
176
33
  var showRelateResource = !!values.tag || !values.tag && ((_topo$options$editor = topo.options.editor) === null || _topo$options$editor === void 0 ? void 0 : _topo$options$editor.enableRelateResource) !== false;
34
+ var content;
35
+
36
+ if (showRelateResource) {
37
+ content = /*#__PURE__*/React.createElement(TabView, null, /*#__PURE__*/React.createElement(_Tab.Item, {
38
+ title: "\u6570\u636E",
39
+ key: "1"
40
+ }, renderData()), /*#__PURE__*/React.createElement(_Tab.Item, {
41
+ title: "\u8BBE\u7F6E",
42
+ key: "2"
43
+ }, renderSetting()));
44
+ } else {
45
+ content = renderSetting();
46
+ }
47
+
177
48
  return /*#__PURE__*/React.createElement("div", {
178
49
  className: styles.NodePropertyView
179
- }, showRelateResource ? /*#__PURE__*/React.createElement(TabView, null, /*#__PURE__*/React.createElement(_Tab.Item, {
180
- title: "\u6570\u636E",
181
- key: "1"
182
- }, renderData()), /*#__PURE__*/React.createElement(_Tab.Item, {
183
- title: "\u8BBE\u7F6E",
184
- key: "2"
185
- }, renderViewSetting())) : renderViewSetting());
50
+ }, content);
186
51
  }
@@ -0,0 +1,76 @@
1
+ import _Form from "@alifd/next/es/form";
2
+ import _Input from "@alifd/next/es/input";
3
+ import _Field from "@alifd/next/es/field";
4
+ import _extends from "@babel/runtime/helpers/extends";
5
+ import _Collapse from "@alifd/next/es/collapse";
6
+ import React, { useEffect } from 'react';
7
+ import NodeSizeInput from "../../../common/NodeSizeInput/NodeSizeInput";
8
+ import NodeIconSelect from "../NodeIconSelect";
9
+ var CollapsePanel = _Collapse.Panel;
10
+
11
+ function parseValues(values) {
12
+ return _extends({}, values, {
13
+ 'attrObject.customName': values['attrObject.customName'] || values['attrObject.name'],
14
+ 'attrObject.bindTopo': values['attrObject.bindTopo'] || '' // 解决切换节点时关联拓扑选项未重置
15
+
16
+ });
17
+ }
18
+
19
+ export default function Setting(props) {
20
+ var topo = props.topo,
21
+ values = props.values,
22
+ _onChange = props.onChange,
23
+ editorProps = props.editorProps,
24
+ settingRuntimeState = props.settingRuntimeState,
25
+ _props$showImageSetti = props.showImageSetting,
26
+ showImageSetting = _props$showImageSetti === void 0 ? true : _props$showImageSetti;
27
+
28
+ var field = _Field.useField({
29
+ autoUnmount: false,
30
+ values: parseValues(values),
31
+ onChange: function onChange(name, value) {
32
+ var newValues = field.getValues();
33
+
34
+ _onChange(name, value, newValues);
35
+ }
36
+ });
37
+
38
+ useEffect(function () {
39
+ field.setValues(parseValues(values));
40
+ }, [values]);
41
+ return /*#__PURE__*/React.createElement(_Form, {
42
+ field: field,
43
+ labelAlign: "top"
44
+ }, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Collapse, {
45
+ defaultExpandedKeys: ['显示设置'],
46
+ style: {
47
+ border: 'none'
48
+ }
49
+ }, /*#__PURE__*/React.createElement(CollapsePanel, {
50
+ key: "\u663E\u793A\u8BBE\u7F6E",
51
+ title: "\u663E\u793A\u8BBE\u7F6E"
52
+ }, /*#__PURE__*/React.createElement(_Form.Item, {
53
+ label: "\u56FE\u7247\u540D\u79F01"
54
+ }, /*#__PURE__*/React.createElement(_Input, {
55
+ name: "attrObject.customName"
56
+ })), showImageSetting && /*#__PURE__*/React.createElement(_Form.Item, {
57
+ label: "\u663E\u793A\u56FE\u7247"
58
+ }, /*#__PURE__*/React.createElement(NodeIconSelect, {
59
+ name: "image",
60
+ topo: topo
61
+ })), /*#__PURE__*/React.createElement(_Form.Item, {
62
+ label: "\u56FE\u7247\u5C3A\u5BF8"
63
+ }, /*#__PURE__*/React.createElement(NodeSizeInput, {
64
+ node: values.id,
65
+ value: {
66
+ width: values.width,
67
+ height: values.height
68
+ },
69
+ onChange: function onChange(size) {
70
+ _onChange('width', size.width);
71
+
72
+ _onChange('height', size.height);
73
+ },
74
+ settingRuntimeState: settingRuntimeState
75
+ }))))));
76
+ }
@@ -0,0 +1,2 @@
1
+ import Setting from "./Setting";
2
+ export default Setting;
@@ -0,0 +1,125 @@
1
+ import _Form from "@alifd/next/es/form";
2
+ import _Field from "@alifd/next/es/field";
3
+ import _extends from "@babel/runtime/helpers/extends";
4
+ import _Collapse from "@alifd/next/es/collapse";
5
+ import _Select from "@alifd/next/es/select";
6
+ import React, { useEffect } from 'react';
7
+ import useHtElement from "../../../../../../common/hooks/useHtElement";
8
+ import textStyles from "../../../../../../common/text.module.scss";
9
+ import NodeRelateResourceButton from "./NodeRelateResourceButton";
10
+ var Option = _Select.Option;
11
+ var CollapsePanel = _Collapse.Panel;
12
+
13
+ function parseValues(values) {
14
+ return _extends({}, values, {
15
+ 'attrObject.customName': values['attrObject.customName'] || values['attrObject.name'],
16
+ 'attrObject.bindTopo': values['attrObject.bindTopo'] || '' // 解决切换节点时关联拓扑选项未重置
17
+
18
+ });
19
+ }
20
+
21
+ function getBindType(values) {
22
+ if (values.tag) {
23
+ return 'resource';
24
+ }
25
+
26
+ if (values.attrObject.bindType) {
27
+ return values.attrObject.bindType;
28
+ }
29
+
30
+ return 'none';
31
+ }
32
+
33
+ export default function Data(props) {
34
+ var topo = props.topo,
35
+ topoEditApi = props.topoEditApi,
36
+ values = props.values,
37
+ _onChange = props.onChange,
38
+ editorProps = props.editorProps;
39
+ var bindType = getBindType(values);
40
+ var node = useHtElement({
41
+ topo: topo,
42
+ id: values.id
43
+ });
44
+
45
+ var field = _Field.useField({
46
+ autoUnmount: false,
47
+ values: parseValues(values),
48
+ onChange: function onChange(name, value) {
49
+ var newValues = field.getValues();
50
+
51
+ _onChange(name, value, newValues);
52
+ }
53
+ });
54
+
55
+ useEffect(function () {
56
+ field.setValues(parseValues(values));
57
+ }, [values]);
58
+
59
+ var setBindType = function setBindType(newBindType) {
60
+ _onChange('attrObject.bindType', newBindType);
61
+
62
+ if (newBindType === 'topo') {//
63
+ }
64
+ };
65
+
66
+ var handleBindTopoChange = function handleBindTopoChange(value, data) {
67
+ // 设置名称为拓扑名称,清空自定义名称
68
+ node.a('name', data.label);
69
+ node.a('customName', null);
70
+ };
71
+
72
+ var RelateTopoTree = editorProps === null || editorProps === void 0 ? void 0 : editorProps.relateTopoTree;
73
+ return /*#__PURE__*/React.createElement(_Collapse, {
74
+ defaultExpandedKeys: ['相关资源'],
75
+ style: {
76
+ border: 'none'
77
+ }
78
+ }, /*#__PURE__*/React.createElement(CollapsePanel, {
79
+ key: "\u76F8\u5173\u8D44\u6E90",
80
+ title: "\u76F8\u5173\u8D44\u6E90"
81
+ }, /*#__PURE__*/React.createElement(_Form, {
82
+ field: field,
83
+ labelAlign: "top"
84
+ }, !values.tag && /*#__PURE__*/React.createElement(_Form.Item, {
85
+ label: "\u5173\u8054\u7C7B\u578B"
86
+ }, /*#__PURE__*/React.createElement(_Select, {
87
+ name: "bindType",
88
+ value: bindType,
89
+ style: {
90
+ width: '100%',
91
+ marginRight: 8
92
+ },
93
+ onChange: setBindType
94
+ }, /*#__PURE__*/React.createElement(Option, {
95
+ value: "none"
96
+ }, "\u672A\u5173\u8054"), /*#__PURE__*/React.createElement(Option, {
97
+ value: "resource"
98
+ }, "\u5173\u8054\u8D44\u6E90"), RelateTopoTree && /*#__PURE__*/React.createElement(Option, {
99
+ value: "topo"
100
+ }, "\u5173\u8054\u62D3\u6251"))), bindType === 'resource' && /*#__PURE__*/React.createElement(_Form.Item, {
101
+ label: "\u5173\u8054\u8D44\u6E90"
102
+ }, /*#__PURE__*/React.createElement("div", {
103
+ style: {
104
+ display: 'flex'
105
+ }
106
+ }, /*#__PURE__*/React.createElement("div", {
107
+ className: textStyles.textEllipsis,
108
+ style: {
109
+ flex: 1,
110
+ paddingRight: 16,
111
+ color: '#4D6277'
112
+ },
113
+ title: values.tag ? values.name : null
114
+ }, values.tag ? values.name : '—'), /*#__PURE__*/React.createElement(NodeRelateResourceButton, {
115
+ node: values,
116
+ topo: topo,
117
+ topoEditApi: topoEditApi
118
+ }))), bindType === 'topo' && RelateTopoTree && /*#__PURE__*/React.createElement(_Form.Item, {
119
+ label: "\u5173\u8054\u62D3\u6251"
120
+ }, /*#__PURE__*/React.createElement(RelateTopoTree, {
121
+ name: "attrObject.bindTopo",
122
+ topo: topo,
123
+ onChange: handleBindTopoChange
124
+ })))));
125
+ }
@@ -4,7 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import topoServer from '@riil-frontend/component-topology-common/es/services/topo';
5
5
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
6
6
  import { keyBy } from 'lodash';
7
- import { DEFAULT_LINK_TAG_COMMON_CONFIG, DEFAULT_NODE_TAG_COMMON_CONFIG, DEFAULT_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
7
+ import { DEFAULT_NODE_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
8
8
  import { findItem } from "../../utils/topoData";
9
9
  import { queryCisByIds } from "../services";
10
10
  import AttributeFormatter from "./attributeFormatter";
@@ -35,8 +35,10 @@ var filterByPermission = function filterByPermission(resource, items) {
35
35
 
36
36
  var AttributeMetricDisplay = /*#__PURE__*/function () {
37
37
  function AttributeMetricDisplay(topo) {
38
+ var _this$topo$options$ta;
39
+
38
40
  this.topo = topo;
39
- var ExtElementTagTipBuilder = this.topo.options.ExtElementTagTipBuilder;
41
+ var ExtElementTagTipBuilder = (_this$topo$options$ta = this.topo.options.tagTip) === null || _this$topo$options$ta === void 0 ? void 0 : _this$topo$options$ta.ExtElementTagTipBuilder;
40
42
 
41
43
  if (ExtElementTagTipBuilder) {
42
44
  this.extElementTagTipBuilder = new ExtElementTagTipBuilder(this);
@@ -236,10 +238,12 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
236
238
  return filterUnExistedFields(items, ciTypeMeta);
237
239
  }
238
240
 
239
- var defaultLinkTagTipConfig = this.topo.options.defaultLinkTagTipConfig;
241
+ var tagTipOptions = this.topo.options.tagTip;
242
+ var defaultLinkTagConfig = tagTipOptions !== null && tagTipOptions !== void 0 && tagTipOptions.getDefaultLinkTagConfig ? tagTipOptions === null || tagTipOptions === void 0 ? void 0 : tagTipOptions.getDefaultLinkTagConfig(link) : null;
243
+ var defaultLinkTipConfig = tagTipOptions !== null && tagTipOptions !== void 0 && tagTipOptions.getDefaultLinkTipConfig ? tagTipOptions === null || tagTipOptions === void 0 ? void 0 : tagTipOptions.getDefaultLinkTipConfig(link) : null;
240
244
  return {
241
- tags: getItems(linkTag || (defaultLinkTagTipConfig === null || defaultLinkTagTipConfig === void 0 ? void 0 : defaultLinkTagTipConfig.tag)),
242
- tips: getItems(linkTip || (defaultLinkTagTipConfig === null || defaultLinkTagTipConfig === void 0 ? void 0 : defaultLinkTagTipConfig.tip))
245
+ tags: getItems(linkTag || defaultLinkTagConfig),
246
+ tips: getItems(linkTip || defaultLinkTipConfig)
243
247
  };
244
248
  };
245
249
 
@@ -20,7 +20,7 @@ import { updateEdgeExpanded } from "../utils/edgeUtil";
20
20
  import PluginManager from "./PluginManager";
21
21
  import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
22
22
 
23
- var version = typeof "3.1.6" === 'string' ? "3.1.6" : null;
23
+ var version = typeof "3.1.9" === 'string' ? "3.1.9" : null;
24
24
  console.info("\u62D3\u6251\u7248\u672C: " + version);
25
25
  /**
26
26
  * 拓扑显示和编辑
@@ -5,12 +5,13 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
5
  import _MenuButton from "@alifd/next/es/menu-button";
6
6
  import _Search from "@alifd/next/es/search";
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
- import React, { useState, useEffect, useRef, useCallback } from 'react';
9
- import { isAvailableArray, dataSearch } from '@riil-frontend/utils';
10
8
  import { TopoEvent } from '@riil-frontend/component-topology-graph';
9
+ import { dataSearch, isAvailableArray } from '@riil-frontend/utils';
10
+ import React, { useEffect, useState } from 'react';
11
+ import PropTypes from 'prop-types';
11
12
  import service from "../../../../services/overview";
12
- import styles from "./index.module.scss";
13
13
  import ResourceOverview from "./components/ResourceOverview";
14
+ import styles from "./index.module.scss";
14
15
 
15
16
  function Title(_ref) {
16
17
  var id = _ref.id,
@@ -72,8 +73,9 @@ function Title(_ref) {
72
73
  } // 基本信息
73
74
 
74
75
 
75
- function BaseInfo(props) {
76
- var topo = props.topo;
76
+ function ResourceDetail(props) {
77
+ var topo = props.topo,
78
+ canShow = props.canShow;
77
79
 
78
80
  var _topo$store$useModel = topo.store.useModel('topoBaseInfoOverview'),
79
81
  topoState = _topo$store$useModel[0],
@@ -189,8 +191,6 @@ function BaseInfo(props) {
189
191
  }
190
192
 
191
193
  function init(data, targetType) {
192
- var _topo$options$resourc;
193
-
194
194
  console.log('初始化基本信息', data, targetType);
195
195
  var id = data.id,
196
196
  name = data.name,
@@ -199,11 +199,15 @@ function BaseInfo(props) {
199
199
  ciName = data.ciName,
200
200
  operation = data.operation; // 仅展示资源和链路的概览
201
201
 
202
- if (!['node', 'link', 'linkGroup'].includes(type)) return; // 应用拓扑中没有链路详情
203
-
204
- if ((_topo$options$resourc = topo.options.resourceOverviewDrawer) !== null && _topo$options$resourc !== void 0 && _topo$options$resourc.getData && type === 'link') return; // 没有权限不显示
202
+ if (!['node', 'link', 'linkGroup'].includes(type)) return; // 没有权限不显示
205
203
 
206
204
  if (!operation) return;
205
+ var htElement = topo.getDataModel().getDataByTag(id);
206
+
207
+ if (!canShow(htElement)) {
208
+ return;
209
+ }
210
+
207
211
  setActiveData({
208
212
  id: id,
209
213
  name: name,
@@ -273,4 +277,12 @@ function BaseInfo(props) {
273
277
  }))))));
274
278
  }
275
279
 
276
- export default BaseInfo;
280
+ ResourceDetail.propTypes = {
281
+ canShow: PropTypes.func
282
+ };
283
+ ResourceDetail.defaultProps = {
284
+ canShow: function canShow(htElement) {
285
+ return true;
286
+ }
287
+ };
288
+ export default ResourceDetail;
@@ -0,0 +1,11 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import ResourceDetail from "./ResourceDetail";
4
+
5
+ function ResourceDetailPlugin(props) {
6
+ var viewerProps = props.viewerProps;
7
+ var resourceDetailProps = viewerProps === null || viewerProps === void 0 ? void 0 : viewerProps.resourceDetailProps;
8
+ return /*#__PURE__*/React.createElement(ResourceDetail, _extends({}, props, resourceDetailProps));
9
+ }
10
+
11
+ export default ResourceDetailPlugin;
@@ -0,0 +1,131 @@
1
+ import React from 'react';
2
+ import { Link } from 'react-router-dom';
3
+ import styles from "./index.module.scss"; // url 处理,UICBB 的地址需截取前缀
4
+
5
+ function formatUrl(url) {
6
+ var _window, _window$location;
7
+
8
+ var prefix = '/default/pagecenter';
9
+
10
+ if (((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname.indexOf(prefix)) === 0 && (url === null || url === void 0 ? void 0 : url.indexOf(prefix)) === 0) {
11
+ return url.split(prefix)[1];
12
+ } else {
13
+ return url;
14
+ }
15
+ }
16
+
17
+ function AttributeItem(props) {
18
+ var style = props.style,
19
+ key = props.key,
20
+ label = props.label,
21
+ contentTitle = props.contentTitle,
22
+ children = props.children;
23
+ return /*#__PURE__*/React.createElement("div", {
24
+ className: styles.item,
25
+ style: style || {},
26
+ key: key
27
+ }, /*#__PURE__*/React.createElement("span", {
28
+ className: styles.label
29
+ }, label), /*#__PURE__*/React.createElement("span", {
30
+ className: styles.content,
31
+ title: contentTitle
32
+ }, children));
33
+ }
34
+
35
+ function BaseInfoContent(props) {
36
+ var _itemCols$type;
37
+
38
+ var topo = props.topo,
39
+ type = props.type,
40
+ data = props.data;
41
+ var itemCols = {
42
+ node: [{
43
+ label: '资源名称:',
44
+ objKey: 'resource',
45
+ render: function render(valueData, key) {
46
+ var display_name = valueData.display_name,
47
+ link = valueData.link;
48
+ return /*#__PURE__*/React.createElement(AttributeItem, {
49
+ key: key,
50
+ label: "\u8D44\u6E90\u540D\u79F0\uFF1A",
51
+ contentTitle: display_name
52
+ }, valueData ? /*#__PURE__*/React.createElement(Link, {
53
+ className: styles.link,
54
+ to: formatUrl(link)
55
+ }, display_name || '-') : '-');
56
+ }
57
+ }, {
58
+ label: 'IP地址:',
59
+ objKey: 'ipv4_address'
60
+ }, {
61
+ label: '资产编号:',
62
+ objKey: 'asset_number'
63
+ }, {
64
+ label: '资源类型:',
65
+ objKey: 'ciName'
66
+ }, {
67
+ label: '资源位置:',
68
+ objKey: 'res_address'
69
+ } // {
70
+ // label: '负责人:',
71
+ // objKey: 'principal'
72
+ // },
73
+ ],
74
+ link: [{
75
+ label: '链路带宽:',
76
+ objKey: 'rated_bandwidth',
77
+ style: {
78
+ width: '100%'
79
+ }
80
+ }, {
81
+ label: '源IP地址:',
82
+ objKey: 'source_ipv4'
83
+ }, {
84
+ label: '目的IP地址:',
85
+ objKey: 'destination_ipv4'
86
+ }, {
87
+ label: '源端口:',
88
+ objKey: 'source_Interface'
89
+ }, {
90
+ label: '目的端口:',
91
+ objKey: 'destination_Interface'
92
+ }]
93
+ };
94
+ return /*#__PURE__*/React.createElement(React.Fragment, null, (_itemCols$type = itemCols[type]) === null || _itemCols$type === void 0 ? void 0 : _itemCols$type.map(function (_ref, key) {
95
+ var label = _ref.label,
96
+ objKey = _ref.objKey,
97
+ style = _ref.style,
98
+ render = _ref.render;
99
+ return data[objKey] === false ? '' : render ? render(data[objKey], key) : /*#__PURE__*/React.createElement(AttributeItem, {
100
+ key: key,
101
+ label: label,
102
+ style: style || {},
103
+ contentTitle: data[objKey]
104
+ }, data[objKey] || '-');
105
+ }));
106
+ } // 基本信息
107
+
108
+
109
+ export default function BaseInfo(props) {
110
+ var topo = props.topo,
111
+ type = props.type,
112
+ data = props.data,
113
+ baseInfo = props.baseInfo,
114
+ renderContent = props.renderContent;
115
+ var content = renderContent ? renderContent({
116
+ type: type,
117
+ data: data,
118
+ AttributeItem: AttributeItem
119
+ }) : null;
120
+
121
+ if (!content) {
122
+ content = /*#__PURE__*/React.createElement(BaseInfoContent, {
123
+ type: type,
124
+ data: baseInfo
125
+ });
126
+ }
127
+
128
+ return /*#__PURE__*/React.createElement("div", {
129
+ className: styles['base-info']
130
+ }, content);
131
+ }