@riil-frontend/component-topology 2.15.19 → 2.15.20

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.
@@ -23,7 +23,10 @@ function ResourceSelectList(props, ref) {
23
23
  limitTypes: limitTypes || RESOURCE_LIMIT_TYPES,
24
24
  defaultCondition: excludeIds.length ? "!id('" + excludeIds.join('\',\'') + "')" : undefined,
25
25
  request: getRequest(),
26
- tableProps: tableProps
26
+ tableProps: tableProps,
27
+ paginationProps: {
28
+ type: 'simple'
29
+ }
27
30
  });
28
31
  }
29
32
 
@@ -122,6 +122,7 @@ var TopoView = function TopoView(props) {
122
122
  useEffect(function () {
123
123
  return function () {
124
124
  topoDispatchers.reset();
125
+ clearSelection();
125
126
  };
126
127
  }, []);
127
128
  var onGraphCreated = useCallback(function (topoClient) {
@@ -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 "2.15.19" === 'string' ? "2.15.19" : null;
23
+ var version = typeof "2.15.20" === 'string' ? "2.15.20" : null;
24
24
  console.info("\u62D3\u6251\u7248\u672C: " + version);
25
25
  /**
26
26
  * 拓扑显示和编辑
@@ -20,12 +20,13 @@ import { queryCisByIds } from "../../../../../../services";
20
20
  import styles from "./index.module.scss"; // 基本信息
21
21
 
22
22
  function BaseInfoRender(type, data) {
23
+ var _itemCols$type;
24
+
23
25
  var itemCols = {
24
26
  node: [{
25
27
  label: '资源名称:',
26
28
  objKey: 'resource',
27
29
  render: function render(valueData, key) {
28
- console.log('资源名称:', valueData, key);
29
30
  var display_name = valueData.display_name,
30
31
  link = valueData.link;
31
32
  return /*#__PURE__*/React.createElement("div", {
@@ -80,7 +81,7 @@ function BaseInfoRender(type, data) {
80
81
  };
81
82
  return /*#__PURE__*/React.createElement("div", {
82
83
  className: styles['base-info']
83
- }, itemCols[type].map(function (_ref, key) {
84
+ }, (_itemCols$type = itemCols[type]) === null || _itemCols$type === void 0 ? void 0 : _itemCols$type.map(function (_ref, key) {
84
85
  var label = _ref.label,
85
86
  objKey = _ref.objKey,
86
87
  style = _ref.style,
@@ -100,8 +100,11 @@ function BaseInfo(props) {
100
100
  userId = _useState4[0],
101
101
  setUserId = _useState4[1];
102
102
 
103
+ var _useState5 = useState(null),
104
+ paramData = _useState5[0],
105
+ setParamData = _useState5[1];
106
+
103
107
  useEffect(function () {
104
- getUser();
105
108
  var notifier = topo.view.topoClient.notifier;
106
109
  notifier.on(TopoEvent.EVENT_DOUBLE_CLICK, openOverview);
107
110
  notifier.on('topo_element_click', changeOverview);
@@ -117,12 +120,51 @@ function BaseInfo(props) {
117
120
  }, []); // 解决切换拓扑图隐藏概览
118
121
 
119
122
  useEffect(function () {
120
- setVisible(false); // TODO 其他数据重置
123
+ setVisible(false);
124
+ setParamData(null); // TODO 其他数据重置
121
125
  }, [topoId]);
122
126
 
123
127
  function getUser() {
124
128
  return _getUser.apply(this, arguments);
125
- }
129
+ } // function changeOverview (node) {
130
+ // const data = node.getAttrObject()
131
+ // console.log('单击切换基本信息', data);
132
+ // setVisible(prev => {
133
+ // prev && openOverview(data)
134
+ // return prev
135
+ // })
136
+ // }
137
+ // function openOverview (data) {
138
+ // console.log('双击打开基本信息', data);
139
+ // const {
140
+ // id,
141
+ // name,
142
+ // type,
143
+ // ciType,
144
+ // ciName,
145
+ // operation,
146
+ // } = data
147
+ // // 仅展示资源和链路的概览
148
+ // if (!['node', 'link', 'linkGroup'].includes(type)) return
149
+ // // 应用拓扑中没有链路详情
150
+ // if (topo.options.resourceOverviewDrawer?.getData && type === 'link') return
151
+ // // 没有权限不显示
152
+ // if (!operation) return
153
+ // setActiveData({
154
+ // id,
155
+ // name,
156
+ // type: type === 'linkGroup' ? 'link' : type,
157
+ // ciType,
158
+ // ciName
159
+ // })
160
+ // const { metrics } = topo.ciTyeCache.getCiType(ciType)
161
+ // topoDispatchers.update({
162
+ // id,
163
+ // metricCodes: metrics.slice(0, 6).map(item => item.code), // 需要展示的关键指标 code
164
+ // })
165
+ // setVisible(true)
166
+ // }
167
+
126
168
 
127
169
  function _getUser() {
128
170
  _getUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
@@ -148,25 +190,41 @@ function BaseInfo(props) {
148
190
  return _getUser.apply(this, arguments);
149
191
  }
150
192
 
193
+ function onChangeActive(activeNode) {
194
+ console.log('切换基本信息资源', activeNode);
195
+ activeNode && openOverview(_extends({}, activeNode, {
196
+ type: 'node'
197
+ }));
198
+ }
199
+
200
+ useEffect(function () {
201
+ (visible || (paramData === null || paramData === void 0 ? void 0 : paramData.isVisible)) && paramData && init(paramData);
202
+ }, [paramData, visible]);
203
+
151
204
  function changeOverview(node) {
152
205
  var data = node.getAttrObject();
153
206
  console.log('单击切换基本信息', data);
154
- setVisible(function (prev) {
155
- prev && openOverview(data);
156
- return prev;
157
- });
207
+ setParamData(data);
158
208
  }
159
209
 
160
210
  function openOverview(data) {
211
+ console.log('双击打开基本信息', data);
212
+ setParamData(_extends({}, data, {
213
+ isVisible: true
214
+ }));
215
+ }
216
+
217
+ function init(data) {
161
218
  var _topo$options$resourc;
162
219
 
163
- console.log('双击打开基本信息', data);
220
+ console.log('初始化基本信息', data);
164
221
  var id = data.id,
165
222
  name = data.name,
166
223
  type = data.type,
167
224
  ciType = data.ciType,
168
225
  ciName = data.ciName,
169
- operation = data.operation; // 仅展示资源和链路的概览
226
+ operation = data.operation,
227
+ isVisible = data.isVisible; // 仅展示资源和链路的概览
170
228
 
171
229
  if (!['node', 'link', 'linkGroup'].includes(type)) return; // 应用拓扑中没有链路详情
172
230
 
@@ -190,15 +248,11 @@ function BaseInfo(props) {
190
248
  return item.code;
191
249
  }) // 需要展示的关键指标 code
192
250
 
193
- });
194
- setVisible(true);
195
- }
251
+ }); // 显示隐藏
196
252
 
197
- function onChangeActive(activeNode) {
198
- console.log('切换基本信息资源', activeNode);
199
- activeNode && openOverview(_extends({}, activeNode, {
200
- type: 'node'
201
- }));
253
+ isVisible && setVisible(true); // userId
254
+
255
+ userId || getUser();
202
256
  }
203
257
 
204
258
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Drawer, {
@@ -37,7 +37,10 @@ function ResourceSelectList(props, ref) {
37
37
  limitTypes: limitTypes || _ResourceTypeLimit.RESOURCE_LIMIT_TYPES,
38
38
  defaultCondition: excludeIds.length ? "!id('" + excludeIds.join('\',\'') + "')" : undefined,
39
39
  request: (0, _componentTopologyCommon.getRequest)(),
40
- tableProps: tableProps
40
+ tableProps: tableProps,
41
+ paginationProps: {
42
+ type: 'simple'
43
+ }
41
44
  });
42
45
  }
43
46
 
@@ -151,6 +151,7 @@ var TopoView = function TopoView(props) {
151
151
  (0, _react.useEffect)(function () {
152
152
  return function () {
153
153
  topoDispatchers.reset();
154
+ clearSelection();
154
155
  };
155
156
  }, []);
156
157
  var onGraphCreated = (0, _react.useCallback)(function (topoClient) {
@@ -48,7 +48,7 @@ var _PluginManager = _interopRequireDefault(require("./PluginManager"));
48
48
  var _topoFactory = _interopRequireDefault(require("./topoFactory"));
49
49
 
50
50
  // eslint-disable-next-line no-undef
51
- var version = typeof "2.15.19" === 'string' ? "2.15.19" : null;
51
+ var version = typeof "2.15.20" === 'string' ? "2.15.20" : null;
52
52
  console.info("\u62D3\u6251\u7248\u672C: " + version);
53
53
  /**
54
54
  * 拓扑显示和编辑
@@ -51,12 +51,13 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
51
51
 
52
52
  // 基本信息
53
53
  function BaseInfoRender(type, data) {
54
+ var _itemCols$type;
55
+
54
56
  var itemCols = {
55
57
  node: [{
56
58
  label: '资源名称:',
57
59
  objKey: 'resource',
58
60
  render: function render(valueData, key) {
59
- console.log('资源名称:', valueData, key);
60
61
  var display_name = valueData.display_name,
61
62
  link = valueData.link;
62
63
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -111,7 +112,7 @@ function BaseInfoRender(type, data) {
111
112
  };
112
113
  return /*#__PURE__*/_react["default"].createElement("div", {
113
114
  className: _indexModule["default"]['base-info']
114
- }, itemCols[type].map(function (_ref, key) {
115
+ }, (_itemCols$type = itemCols[type]) === null || _itemCols$type === void 0 ? void 0 : _itemCols$type.map(function (_ref, key) {
115
116
  var label = _ref.label,
116
117
  objKey = _ref.objKey,
117
118
  style = _ref.style,
@@ -123,8 +123,11 @@ function BaseInfo(props) {
123
123
  userId = _useState4[0],
124
124
  setUserId = _useState4[1];
125
125
 
126
+ var _useState5 = (0, _react.useState)(null),
127
+ paramData = _useState5[0],
128
+ setParamData = _useState5[1];
129
+
126
130
  (0, _react.useEffect)(function () {
127
- getUser();
128
131
  var notifier = topo.view.topoClient.notifier;
129
132
  notifier.on(_componentTopologyGraph.TopoEvent.EVENT_DOUBLE_CLICK, openOverview);
130
133
  notifier.on('topo_element_click', changeOverview);
@@ -140,12 +143,51 @@ function BaseInfo(props) {
140
143
  }, []); // 解决切换拓扑图隐藏概览
141
144
 
142
145
  (0, _react.useEffect)(function () {
143
- setVisible(false); // TODO 其他数据重置
146
+ setVisible(false);
147
+ setParamData(null); // TODO 其他数据重置
144
148
  }, [topoId]);
145
149
 
146
150
  function getUser() {
147
151
  return _getUser.apply(this, arguments);
148
- }
152
+ } // function changeOverview (node) {
153
+ // const data = node.getAttrObject()
154
+ // console.log('单击切换基本信息', data);
155
+ // setVisible(prev => {
156
+ // prev && openOverview(data)
157
+ // return prev
158
+ // })
159
+ // }
160
+ // function openOverview (data) {
161
+ // console.log('双击打开基本信息', data);
162
+ // const {
163
+ // id,
164
+ // name,
165
+ // type,
166
+ // ciType,
167
+ // ciName,
168
+ // operation,
169
+ // } = data
170
+ // // 仅展示资源和链路的概览
171
+ // if (!['node', 'link', 'linkGroup'].includes(type)) return
172
+ // // 应用拓扑中没有链路详情
173
+ // if (topo.options.resourceOverviewDrawer?.getData && type === 'link') return
174
+ // // 没有权限不显示
175
+ // if (!operation) return
176
+ // setActiveData({
177
+ // id,
178
+ // name,
179
+ // type: type === 'linkGroup' ? 'link' : type,
180
+ // ciType,
181
+ // ciName
182
+ // })
183
+ // const { metrics } = topo.ciTyeCache.getCiType(ciType)
184
+ // topoDispatchers.update({
185
+ // id,
186
+ // metricCodes: metrics.slice(0, 6).map(item => item.code), // 需要展示的关键指标 code
187
+ // })
188
+ // setVisible(true)
189
+ // }
190
+
149
191
 
150
192
  function _getUser() {
151
193
  _getUser = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
@@ -171,25 +213,41 @@ function BaseInfo(props) {
171
213
  return _getUser.apply(this, arguments);
172
214
  }
173
215
 
216
+ function onChangeActive(activeNode) {
217
+ console.log('切换基本信息资源', activeNode);
218
+ activeNode && openOverview((0, _extends2["default"])({}, activeNode, {
219
+ type: 'node'
220
+ }));
221
+ }
222
+
223
+ (0, _react.useEffect)(function () {
224
+ (visible || (paramData === null || paramData === void 0 ? void 0 : paramData.isVisible)) && paramData && init(paramData);
225
+ }, [paramData, visible]);
226
+
174
227
  function changeOverview(node) {
175
228
  var data = node.getAttrObject();
176
229
  console.log('单击切换基本信息', data);
177
- setVisible(function (prev) {
178
- prev && openOverview(data);
179
- return prev;
180
- });
230
+ setParamData(data);
181
231
  }
182
232
 
183
233
  function openOverview(data) {
234
+ console.log('双击打开基本信息', data);
235
+ setParamData((0, _extends2["default"])({}, data, {
236
+ isVisible: true
237
+ }));
238
+ }
239
+
240
+ function init(data) {
184
241
  var _topo$options$resourc;
185
242
 
186
- console.log('双击打开基本信息', data);
243
+ console.log('初始化基本信息', data);
187
244
  var id = data.id,
188
245
  name = data.name,
189
246
  type = data.type,
190
247
  ciType = data.ciType,
191
248
  ciName = data.ciName,
192
- operation = data.operation; // 仅展示资源和链路的概览
249
+ operation = data.operation,
250
+ isVisible = data.isVisible; // 仅展示资源和链路的概览
193
251
 
194
252
  if (!['node', 'link', 'linkGroup'].includes(type)) return; // 应用拓扑中没有链路详情
195
253
 
@@ -213,15 +271,11 @@ function BaseInfo(props) {
213
271
  return item.code;
214
272
  }) // 需要展示的关键指标 code
215
273
 
216
- });
217
- setVisible(true);
218
- }
274
+ }); // 显示隐藏
219
275
 
220
- function onChangeActive(activeNode) {
221
- console.log('切换基本信息资源', activeNode);
222
- activeNode && openOverview((0, _extends2["default"])({}, activeNode, {
223
- type: 'node'
224
- }));
276
+ isVisible && setVisible(true); // userId
277
+
278
+ userId || getUser();
225
279
  }
226
280
 
227
281
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_drawer["default"], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "2.15.19",
3
+ "version": "2.15.20",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -110,6 +110,6 @@
110
110
  "access": "public"
111
111
  },
112
112
  "license": "MIT",
113
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@2.15.19/build/index.html",
113
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@2.15.20/build/index.html",
114
114
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
115
115
  }