@riil-frontend/component-topology 2.15.24 → 2.15.25

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.
@@ -24,7 +24,12 @@ function filterUnExistedFields(fields, ciTypeMeta) {
24
24
  return fields.filter(function (item) {
25
25
  return isFieldExisted(item, ciTypeMeta);
26
26
  });
27
- }
27
+ } // 无权限不显示标注、悬浮框
28
+
29
+
30
+ var filterByPermission = function filterByPermission(resource, items) {
31
+ return resource.operation ? items : [];
32
+ };
28
33
  /**
29
34
  * 资源标注、悬浮框数据
30
35
  */
@@ -152,6 +157,31 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
152
157
  tips: []
153
158
  };
154
159
  }
160
+ /**
161
+ * 查询需要查询数据的连线
162
+ * @param {*} data
163
+ * @returns
164
+ */
165
+ ;
166
+
167
+ _proto.getEdges = function getEdges(data) {
168
+ // 获得图上业务节点、业务连线
169
+ var _ref2 = data || this.topo.dataModel.getData(),
170
+ links = _ref2.links,
171
+ linkGroups = _ref2.linkGroups;
172
+
173
+ return [].concat(links.map(function (link) {
174
+ return _extends({}, link, {
175
+ type: 'edge'
176
+ });
177
+ }), linkGroups.map(function (link) {
178
+ return _extends({}, link, {
179
+ type: 'edgeGroup'
180
+ });
181
+ })).filter(function (link) {
182
+ return link.ciType === 'network_link';
183
+ });
184
+ }
155
185
  /**
156
186
  * 获取资源的标注、悬浮框配置,只包含属性和指标字段。无权限的资源无配置
157
187
  *
@@ -165,15 +195,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
165
195
  var _this = this;
166
196
 
167
197
  // 获得图上业务节点、业务连线
168
- var _ref2 = data || this.topo.store.getModelState('topoMod').data,
169
- nodes = _ref2.nodes,
170
- links = _ref2.links,
171
- linkGroups = _ref2.linkGroups; // 无权限不显示标注、悬浮框
172
-
173
-
174
- var filterByPermission = function filterByPermission(resource, items) {
175
- return resource.operation ? items : [];
176
- };
198
+ var _ref3 = data || this.topo.dataModel.getData(),
199
+ nodes = _ref3.nodes;
177
200
 
178
201
  return [].concat(nodes.filter(function (node) {
179
202
  return !!node.ciType;
@@ -189,29 +212,13 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
189
212
  tags: filterByPermission(node, ciTypeConfig.tags),
190
213
  tips: filterByPermission(node, ciTypeConfig.tips)
191
214
  };
192
- }), links.filter(function (link) {
193
- return link.ciType === 'network_link';
194
- }).map(function (link) {
195
- var ciType = link.ciType;
196
-
197
- var ciTypeConfig = _this.getNetworkLinkConfig(link, config);
198
-
199
- return {
200
- type: 'edge',
201
- id: link.id,
202
- ciType: ciType,
203
- tags: filterByPermission(link, ciTypeConfig.tags),
204
- tips: filterByPermission(link, ciTypeConfig.tips)
205
- };
206
- }), linkGroups.filter(function (link) {
207
- return link.ciType === 'network_link';
208
- }).map(function (link) {
215
+ }), this.getEdges().map(function (link) {
209
216
  var ciType = link.ciType;
210
217
 
211
218
  var ciTypeConfig = _this.getNetworkLinkConfig(link, config);
212
219
 
213
220
  return {
214
- type: 'edgeGroup',
221
+ type: link.type,
215
222
  id: link.id,
216
223
  ciType: ciType,
217
224
  tags: filterByPermission(link, ciTypeConfig.tags),
@@ -226,6 +233,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
226
233
 
227
234
  return this.getResourceTagTipConfig().map(function (ciConfig) {
228
235
  var fields = {
236
+ ciType: ciConfig.ciType,
237
+ type: ciConfig.type,
229
238
  id: ciConfig.id,
230
239
  attributes: [],
231
240
  metrics: []
@@ -314,9 +323,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
314
323
 
315
324
  _proto.updateNodesNameVisible = function updateNodesNameVisible() {
316
325
  var dm = this.topo.getDataModel();
317
- this.getNodesNameVisible().forEach(function (_ref3) {
318
- var id = _ref3.id,
319
- visible = _ref3.visible;
326
+ this.getNodesNameVisible().forEach(function (_ref4) {
327
+ var id = _ref4.id,
328
+ visible = _ref4.visible;
320
329
  dm.getDataByTag(id).a('isShowName', visible);
321
330
  });
322
331
  }
@@ -333,14 +342,14 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
333
342
  var _fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
334
343
  var _this4 = this;
335
344
 
336
- var _this$topo$store$getS, resIdsList, nodeIdsList, linkIdsList, _this$topo$store$getM, links, linkGroups, codes, param, linkAdapter, result;
345
+ var topo, _topo$store$getState$, resIdsList, nodeIdsList, codes, param, linkAdapter, result;
337
346
 
338
347
  return _regeneratorRuntime.wrap(function _callee$(_context) {
339
348
  while (1) {
340
349
  switch (_context.prev = _context.next) {
341
350
  case 0:
342
351
  linkAdapter = function _linkAdapter(data) {
343
- var link = findItem([].concat(links, linkGroups), 'id', data.id);
352
+ var link = topo.dataModel.getDataById(data.id);
344
353
 
345
354
  if (!link) {
346
355
  return data;
@@ -353,9 +362,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
353
362
  });
354
363
  };
355
364
 
356
- _this$topo$store$getS = this.topo.store.getState().topoBizMod.resAndMetrics, resIdsList = _this$topo$store$getS.resIdsList, nodeIdsList = _this$topo$store$getS.nodeIdsList, linkIdsList = _this$topo$store$getS.linkIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
357
-
358
- _this$topo$store$getM = this.topo.store.getModelState('topoMod').data, links = _this$topo$store$getM.links, linkGroups = _this$topo$store$getM.linkGroups; // 无资源,不查询
365
+ topo = this.topo;
366
+ _topo$store$getState$ = topo.store.getState().topoBizMod.resAndMetrics, resIdsList = _topo$store$getState$.resIdsList, nodeIdsList = _topo$store$getState$.nodeIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
367
+ // 无资源,不查询
359
368
 
360
369
  if (resIdsList.length) {
361
370
  _context.next = 5;
@@ -370,14 +379,17 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
370
379
 
371
380
  case 7:
372
381
  // 需要查询的指标列表
373
- codes = this.getResourceMetricCodes(); // if (!codes.length) {
374
- // return [];
375
- // }
376
-
382
+ codes = this.getResourceMetricCodes();
377
383
  param = {
378
384
  ciId: nodeIdsList,
379
385
  codes: codes,
380
- relationId: linkIdsList
386
+ // 过滤掉不需要查询的
387
+ relationId: this.getEdges().map(function (edge) {
388
+ return {
389
+ ciId: edge.id,
390
+ operation: edge.operation
391
+ };
392
+ })
381
393
  };
382
394
  /**
383
395
  * 链路属性适配
@@ -668,9 +680,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
668
680
  var _this6 = this;
669
681
 
670
682
  // 查询没有关联链路的连线组及对应子链路列表
671
- var _this$topo$store$getM2 = this.topo.store.getModelState('topoMod').data,
672
- links = _this$topo$store$getM2.links,
673
- linkGroups = _this$topo$store$getM2.linkGroups;
683
+ var _this$topo$store$getM = this.topo.store.getModelState('topoMod').data,
684
+ links = _this$topo$store$getM.links,
685
+ linkGroups = _this$topo$store$getM.linkGroups;
674
686
 
675
687
  var getLinkUId = function getLinkUId(link) {
676
688
  return [link.source, link.target].sort().join('-');
@@ -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.24" === 'string' ? "2.15.24" : null;
23
+ var version = typeof "2.15.25" === 'string' ? "2.15.25" : null;
24
24
  console.info("\u62D3\u6251\u7248\u672C: " + version);
25
25
  /**
26
26
  * 拓扑显示和编辑
@@ -43,7 +43,12 @@ function filterUnExistedFields(fields, ciTypeMeta) {
43
43
  return fields.filter(function (item) {
44
44
  return isFieldExisted(item, ciTypeMeta);
45
45
  });
46
- }
46
+ } // 无权限不显示标注、悬浮框
47
+
48
+
49
+ var filterByPermission = function filterByPermission(resource, items) {
50
+ return resource.operation ? items : [];
51
+ };
47
52
  /**
48
53
  * 资源标注、悬浮框数据
49
54
  */
@@ -171,6 +176,31 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
171
176
  tips: []
172
177
  };
173
178
  }
179
+ /**
180
+ * 查询需要查询数据的连线
181
+ * @param {*} data
182
+ * @returns
183
+ */
184
+ ;
185
+
186
+ _proto.getEdges = function getEdges(data) {
187
+ // 获得图上业务节点、业务连线
188
+ var _ref2 = data || this.topo.dataModel.getData(),
189
+ links = _ref2.links,
190
+ linkGroups = _ref2.linkGroups;
191
+
192
+ return [].concat(links.map(function (link) {
193
+ return (0, _extends2["default"])({}, link, {
194
+ type: 'edge'
195
+ });
196
+ }), linkGroups.map(function (link) {
197
+ return (0, _extends2["default"])({}, link, {
198
+ type: 'edgeGroup'
199
+ });
200
+ })).filter(function (link) {
201
+ return link.ciType === 'network_link';
202
+ });
203
+ }
174
204
  /**
175
205
  * 获取资源的标注、悬浮框配置,只包含属性和指标字段。无权限的资源无配置
176
206
  *
@@ -184,15 +214,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
184
214
  var _this = this;
185
215
 
186
216
  // 获得图上业务节点、业务连线
187
- var _ref2 = data || this.topo.store.getModelState('topoMod').data,
188
- nodes = _ref2.nodes,
189
- links = _ref2.links,
190
- linkGroups = _ref2.linkGroups; // 无权限不显示标注、悬浮框
191
-
192
-
193
- var filterByPermission = function filterByPermission(resource, items) {
194
- return resource.operation ? items : [];
195
- };
217
+ var _ref3 = data || this.topo.dataModel.getData(),
218
+ nodes = _ref3.nodes;
196
219
 
197
220
  return [].concat(nodes.filter(function (node) {
198
221
  return !!node.ciType;
@@ -208,29 +231,13 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
208
231
  tags: filterByPermission(node, ciTypeConfig.tags),
209
232
  tips: filterByPermission(node, ciTypeConfig.tips)
210
233
  };
211
- }), links.filter(function (link) {
212
- return link.ciType === 'network_link';
213
- }).map(function (link) {
214
- var ciType = link.ciType;
215
-
216
- var ciTypeConfig = _this.getNetworkLinkConfig(link, config);
217
-
218
- return {
219
- type: 'edge',
220
- id: link.id,
221
- ciType: ciType,
222
- tags: filterByPermission(link, ciTypeConfig.tags),
223
- tips: filterByPermission(link, ciTypeConfig.tips)
224
- };
225
- }), linkGroups.filter(function (link) {
226
- return link.ciType === 'network_link';
227
- }).map(function (link) {
234
+ }), this.getEdges().map(function (link) {
228
235
  var ciType = link.ciType;
229
236
 
230
237
  var ciTypeConfig = _this.getNetworkLinkConfig(link, config);
231
238
 
232
239
  return {
233
- type: 'edgeGroup',
240
+ type: link.type,
234
241
  id: link.id,
235
242
  ciType: ciType,
236
243
  tags: filterByPermission(link, ciTypeConfig.tags),
@@ -245,6 +252,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
245
252
 
246
253
  return this.getResourceTagTipConfig().map(function (ciConfig) {
247
254
  var fields = {
255
+ ciType: ciConfig.ciType,
256
+ type: ciConfig.type,
248
257
  id: ciConfig.id,
249
258
  attributes: [],
250
259
  metrics: []
@@ -333,9 +342,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
333
342
 
334
343
  _proto.updateNodesNameVisible = function updateNodesNameVisible() {
335
344
  var dm = this.topo.getDataModel();
336
- this.getNodesNameVisible().forEach(function (_ref3) {
337
- var id = _ref3.id,
338
- visible = _ref3.visible;
345
+ this.getNodesNameVisible().forEach(function (_ref4) {
346
+ var id = _ref4.id,
347
+ visible = _ref4.visible;
339
348
  dm.getDataByTag(id).a('isShowName', visible);
340
349
  });
341
350
  }
@@ -352,14 +361,14 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
352
361
  var _fetchData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
353
362
  var _this4 = this;
354
363
 
355
- var _this$topo$store$getS, resIdsList, nodeIdsList, linkIdsList, _this$topo$store$getM, links, linkGroups, codes, param, linkAdapter, result;
364
+ var topo, _topo$store$getState$, resIdsList, nodeIdsList, codes, param, linkAdapter, result;
356
365
 
357
366
  return _regenerator["default"].wrap(function _callee$(_context) {
358
367
  while (1) {
359
368
  switch (_context.prev = _context.next) {
360
369
  case 0:
361
370
  linkAdapter = function _linkAdapter(data) {
362
- var link = (0, _topoData.findItem)([].concat(links, linkGroups), 'id', data.id);
371
+ var link = topo.dataModel.getDataById(data.id);
363
372
 
364
373
  if (!link) {
365
374
  return data;
@@ -372,9 +381,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
372
381
  });
373
382
  };
374
383
 
375
- _this$topo$store$getS = this.topo.store.getState().topoBizMod.resAndMetrics, resIdsList = _this$topo$store$getS.resIdsList, nodeIdsList = _this$topo$store$getS.nodeIdsList, linkIdsList = _this$topo$store$getS.linkIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
376
-
377
- _this$topo$store$getM = this.topo.store.getModelState('topoMod').data, links = _this$topo$store$getM.links, linkGroups = _this$topo$store$getM.linkGroups; // 无资源,不查询
384
+ topo = this.topo;
385
+ _topo$store$getState$ = topo.store.getState().topoBizMod.resAndMetrics, resIdsList = _topo$store$getState$.resIdsList, nodeIdsList = _topo$store$getState$.nodeIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
386
+ // 无资源,不查询
378
387
 
379
388
  if (resIdsList.length) {
380
389
  _context.next = 5;
@@ -389,14 +398,17 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
389
398
 
390
399
  case 7:
391
400
  // 需要查询的指标列表
392
- codes = this.getResourceMetricCodes(); // if (!codes.length) {
393
- // return [];
394
- // }
395
-
401
+ codes = this.getResourceMetricCodes();
396
402
  param = {
397
403
  ciId: nodeIdsList,
398
404
  codes: codes,
399
- relationId: linkIdsList
405
+ // 过滤掉不需要查询的
406
+ relationId: this.getEdges().map(function (edge) {
407
+ return {
408
+ ciId: edge.id,
409
+ operation: edge.operation
410
+ };
411
+ })
400
412
  };
401
413
  /**
402
414
  * 链路属性适配
@@ -688,9 +700,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
688
700
  var _this6 = this;
689
701
 
690
702
  // 查询没有关联链路的连线组及对应子链路列表
691
- var _this$topo$store$getM2 = this.topo.store.getModelState('topoMod').data,
692
- links = _this$topo$store$getM2.links,
693
- linkGroups = _this$topo$store$getM2.linkGroups;
703
+ var _this$topo$store$getM = this.topo.store.getModelState('topoMod').data,
704
+ links = _this$topo$store$getM.links,
705
+ linkGroups = _this$topo$store$getM.linkGroups;
694
706
 
695
707
  var getLinkUId = function getLinkUId(link) {
696
708
  return [link.source, link.target].sort().join('-');
@@ -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.24" === 'string' ? "2.15.24" : null;
51
+ var version = typeof "2.15.25" === 'string' ? "2.15.25" : null;
52
52
  console.info("\u62D3\u6251\u7248\u672C: " + version);
53
53
  /**
54
54
  * 拓扑显示和编辑
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "2.15.24",
3
+ "version": "2.15.25",
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.24/build/index.html",
113
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@2.15.25/build/index.html",
114
114
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
115
115
  }