@riil-frontend/component-topology 7.0.8 → 8.0.0-a.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 (42) hide show
  1. package/build/index.js +1 -1
  2. package/es/components/BatchAttrMetric/setting.js +0 -2
  3. package/es/core/common/icons/basicIcons.js +57 -0
  4. package/es/core/common/icons/icon.js +4 -6
  5. package/es/core/components/ResourceViewAttributeSetting/Setting.js +5 -11
  6. package/es/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +121 -0
  7. package/es/core/components/TopoView/GraphViewPanel.js +1 -2
  8. package/es/core/components/TopoView/topoView.js +3 -1
  9. package/es/core/hooks/useTopoEdit.js +35 -127
  10. package/es/core/models/AttributeMetricDisplay.js +4 -4
  11. package/es/core/models/TopoApp.js +1 -1
  12. package/es/core/models/tagstips/ElementTagTipConfig.js +17 -9
  13. package/es/core/models/utils/linkUtils.js +30 -36
  14. package/es/core/store/models/topoBizMod.js +1 -11
  15. package/es/core/store/models/topoConfig.js +6 -7
  16. package/es/core/store/models/topoMod.js +74 -50
  17. package/es/networkTopo/getTopoData.js +72 -64
  18. package/es/networkTopo/models/TopoCenter.js +14 -94
  19. package/es/networkTopo/services/topo/basic.js +26 -8
  20. package/es/networkTopo/utils/resourcePermissionUtil.js +2 -2
  21. package/es/utils/topoData.js +4 -169
  22. package/lib/components/BatchAttrMetric/setting.js +0 -4
  23. package/lib/core/common/icons/basicIcons.js +62 -0
  24. package/lib/core/common/icons/icon.js +5 -7
  25. package/lib/core/components/ResourceViewAttributeSetting/Setting.js +6 -11
  26. package/lib/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +127 -0
  27. package/lib/core/components/TopoView/GraphViewPanel.js +1 -2
  28. package/lib/core/components/TopoView/topoView.js +4 -1
  29. package/lib/core/hooks/useTopoEdit.js +35 -129
  30. package/lib/core/models/AttributeMetricDisplay.js +4 -4
  31. package/lib/core/models/TopoApp.js +1 -1
  32. package/lib/core/models/tagstips/ElementTagTipConfig.js +17 -9
  33. package/lib/core/models/utils/linkUtils.js +27 -33
  34. package/lib/core/store/models/topoBizMod.js +1 -11
  35. package/lib/core/store/models/topoConfig.js +5 -6
  36. package/lib/core/store/models/topoMod.js +71 -48
  37. package/lib/networkTopo/getTopoData.js +73 -65
  38. package/lib/networkTopo/models/TopoCenter.js +14 -94
  39. package/lib/networkTopo/services/topo/basic.js +26 -8
  40. package/lib/networkTopo/utils/resourcePermissionUtil.js +2 -2
  41. package/lib/utils/topoData.js +6 -172
  42. package/package.json +2 -2
@@ -9,17 +9,31 @@ exports["default"] = getTopoData;
9
9
 
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
11
 
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
13
 
14
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
+
16
16
  var _linkUtils = require("../core/models/utils/linkUtils");
17
17
 
18
18
  var _resourcePermissionUtil = require("./utils/resourcePermissionUtil");
19
19
 
20
20
  // import "./utils/__tests__/resourcePermissionUtil.test";
21
- function addLinkData(_x, _x2) {
22
- return _addLinkData.apply(this, arguments);
21
+ // 过滤掉无两端节点数据的链路
22
+ function filterLinkNoSourceTarget(data) {
23
+ var links = (data.links || []).filter(function (link) {
24
+ var sourceNode = (data.nodes || []).find(function (node) {
25
+ return node.id === link.source;
26
+ });
27
+
28
+ if (link.source && !sourceNode) {
29
+ return false;
30
+ }
31
+
32
+ return true;
33
+ });
34
+ return (0, _extends2["default"])({}, data, {
35
+ links: links
36
+ });
23
37
  }
24
38
  /**
25
39
  * 修正告警配置。因为:接口返回值没有全局告警配置时,返回null,代表开启
@@ -28,42 +42,65 @@ function addLinkData(_x, _x2) {
28
42
  */
29
43
 
30
44
 
45
+ function fixAlarmConfig(data) {
46
+ var _data$global = data.global,
47
+ alarmSwitch = _data$global.alarmSwitch,
48
+ alarmListDefaultOpen = _data$global.alarmListDefaultOpen;
49
+ return (0, _extends2["default"])({}, data, {
50
+ global: (0, _extends2["default"])({}, data.global, {
51
+ alarmSwitch: alarmSwitch === null ? true : alarmSwitch,
52
+ alarmListDefaultOpen: alarmListDefaultOpen === null ? true : alarmListDefaultOpen
53
+ })
54
+ });
55
+ } // 修正容器找不到时groupId设为空
56
+
57
+
58
+ function fixNodeGroupId(data) {
59
+ var nodes = (data.nodes || [] // 修正容器找不到时groupId设为空
60
+ ).map(function (node) {
61
+ var groupExisted = !!(data.groups || []).filter(function (g) {
62
+ return g.id === node.groupId;
63
+ }).length;
64
+ return (0, _extends2["default"])({}, node, {
65
+ groupId: groupExisted ? node.groupId : null
66
+ });
67
+ });
68
+ return (0, _extends2["default"])({}, data, {
69
+ nodes: nodes
70
+ });
71
+ }
72
+
73
+ function addLinkData(_x) {
74
+ return _addLinkData.apply(this, arguments);
75
+ } // FIXME 业务拓扑不需要链路相关逻辑
76
+
77
+
31
78
  function _addLinkData() {
32
- _addLinkData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(oldLinks, nodes) {
33
- var links, networkLinks, otherLinks;
79
+ _addLinkData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
80
+ var links, nodes, networkLinks, otherLinks;
34
81
  return _regenerator["default"].wrap(function _callee$(_context) {
35
82
  while (1) {
36
83
  switch (_context.prev = _context.next) {
37
84
  case 0:
38
- // 过滤掉无两端节点数据的链路
39
- links = oldLinks.filter(function (link) {
40
- var sourceNode = nodes.find(function (node) {
41
- return node.id === link.source;
42
- });
43
-
44
- if (link.source && !sourceNode) {
45
- return false;
46
- }
47
-
48
- return true;
49
- }); // 如果是网络链路,补充详情信息
85
+ links = data.links || [];
86
+ nodes = data.nodes || []; // 如果是网络链路,补充详情信息
50
87
 
51
- _context.next = 3;
88
+ _context.next = 4;
52
89
  return (0, _linkUtils.getLinksDetail)(links.filter(function (link) {
53
- return !link.ciType;
90
+ return link.ciType === 'network_link';
54
91
  }), nodes);
55
92
 
56
- case 3:
93
+ case 4:
57
94
  networkLinks = _context.sent;
58
95
  otherLinks = links.filter(function (link) {
59
- return !!link.ciType;
96
+ return link.ciType !== 'network_link';
60
97
  });
61
- return _context.abrupt("return", {
98
+ return _context.abrupt("return", (0, _extends2["default"])({}, data, {
62
99
  links: [].concat(networkLinks, otherLinks),
63
100
  linkGroups: []
64
- });
101
+ }));
65
102
 
66
- case 6:
103
+ case 7:
67
104
  case "end":
68
105
  return _context.stop();
69
106
  }
@@ -73,54 +110,25 @@ function _addLinkData() {
73
110
  return _addLinkData.apply(this, arguments);
74
111
  }
75
112
 
76
- function fixAlarmConfig(data) {
77
- var _data$global = data.global,
78
- alarmSwitch = _data$global.alarmSwitch,
79
- alarmListDefaultOpen = _data$global.alarmListDefaultOpen;
80
- return (0, _extends2["default"])({}, data, {
81
- global: (0, _extends2["default"])({}, data.global, {
82
- alarmSwitch: alarmSwitch === null ? true : alarmSwitch,
83
- alarmListDefaultOpen: alarmListDefaultOpen === null ? true : alarmListDefaultOpen
84
- })
85
- });
86
- } // FIXME 业务拓扑不需要链路相关逻辑
87
-
88
-
89
- function buildData(_x3) {
113
+ function buildData(_x2) {
90
114
  return _buildData.apply(this, arguments);
91
115
  }
92
116
 
93
117
  function _buildData() {
94
- _buildData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(data) {
95
- var newData, nodes, _yield$Promise$all, linkData;
96
-
118
+ _buildData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(oldData) {
119
+ var data;
97
120
  return _regenerator["default"].wrap(function _callee2$(_context2) {
98
121
  while (1) {
99
122
  switch (_context2.prev = _context2.next) {
100
123
  case 0:
101
- newData = (0, _extends2["default"])({}, data);
102
- nodes = (data.nodes || [] // 修正容器找不到时groupId设为空
103
- ).map(function (node) {
104
- var groupExisted = !!(data.groups || []).filter(function (g) {
105
- return g.id === node.groupId;
106
- }).length;
107
- return (0, _extends2["default"])({}, node, {
108
- groupId: groupExisted ? node.groupId : null
109
- });
110
- });
111
- _context2.next = 4;
112
- return Promise.all([addLinkData(data.links || [], nodes)]);
124
+ data = oldData;
125
+ data = fixNodeGroupId(data);
126
+ data = filterLinkNoSourceTarget(data); // data = await addLinkData(data)
113
127
 
114
- case 4:
115
- _yield$Promise$all = _context2.sent;
116
- linkData = _yield$Promise$all[0];
117
- newData = (0, _extends2["default"])({}, newData, {
118
- nodes: nodes
119
- }, linkData);
120
- newData = (0, _resourcePermissionUtil.addTopoDataResourcePermission)(newData);
121
- return _context2.abrupt("return", newData);
122
-
123
- case 9:
128
+ data = (0, _resourcePermissionUtil.addTopoDataResourcePermission)(data);
129
+ return _context2.abrupt("return", data);
130
+
131
+ case 5:
124
132
  case "end":
125
133
  return _context2.stop();
126
134
  }
@@ -130,7 +138,7 @@ function _buildData() {
130
138
  return _buildData.apply(this, arguments);
131
139
  }
132
140
 
133
- function getTopoData(_x4, _x5) {
141
+ function getTopoData(_x3, _x4) {
134
142
  return _getTopoData.apply(this, arguments);
135
143
  }
136
144
 
@@ -48,87 +48,7 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
48
48
  return _ResourceInfoDisplay.DEFAULT_TIP_COMMON_CONFIG;
49
49
  } // ExtElementTagTipBuilder: LinkTagsTipsBuilder,
50
50
 
51
- },
52
- onSwitchToEditModeBegin: function () {
53
- var _onSwitchToEditModeBegin = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(topo) {
54
- var topoDispatchers;
55
- return _regenerator["default"].wrap(function _callee$(_context) {
56
- while (1) {
57
- switch (_context.prev = _context.next) {
58
- case 0:
59
- topoDispatchers = topo.store.getModelDispatchers('topoMod'); // topoDispatchers.update({ topoData: null });
60
-
61
- _context.next = 3;
62
- return topoDispatchers.refreshTopo();
63
-
64
- case 3:
65
- case "end":
66
- return _context.stop();
67
- }
68
- }
69
- }, _callee);
70
- }));
71
-
72
- function onSwitchToEditModeBegin(_x) {
73
- return _onSwitchToEditModeBegin.apply(this, arguments);
74
- }
75
-
76
- return onSwitchToEditModeBegin;
77
- }(),
78
- onSwitchToEditMode: function () {
79
- var _onSwitchToEditMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(topo) {
80
- return _regenerator["default"].wrap(function _callee2$(_context2) {
81
- while (1) {
82
- switch (_context2.prev = _context2.next) {
83
- case 0:
84
- _context2.next = 2;
85
- return topo.resourceConfig.loadConfig();
86
-
87
- case 2:
88
- case "end":
89
- return _context2.stop();
90
- }
91
- }
92
- }, _callee2);
93
- }));
94
-
95
- function onSwitchToEditMode(_x2) {
96
- return _onSwitchToEditMode.apply(this, arguments);
97
- }
98
-
99
- return onSwitchToEditMode;
100
- }(),
101
- onSwitchToViewMode: function () {
102
- var _onSwitchToViewMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(topo) {
103
- var topoModDispatchers;
104
- return _regenerator["default"].wrap(function _callee3$(_context3) {
105
- while (1) {
106
- switch (_context3.prev = _context3.next) {
107
- case 0:
108
- topoModDispatchers = topo.store.getModelDispatchers('topoMod');
109
- _context3.next = 3;
110
- return topoModDispatchers.openTopoPage({
111
- id: topo.id
112
- });
113
-
114
- case 3:
115
- _context3.next = 5;
116
- return topoModDispatchers.refreshTopoTree();
117
-
118
- case 5:
119
- case "end":
120
- return _context3.stop();
121
- }
122
- }
123
- }, _callee3);
124
- }));
125
-
126
- function onSwitchToViewMode(_x3) {
127
- return _onSwitchToViewMode.apply(this, arguments);
128
- }
129
-
130
- return onSwitchToViewMode;
131
- }()
51
+ }
132
52
  })) || this;
133
53
  _this.resourceConfig = null;
134
54
  var menuCommands = (0, _createMenuCommands["default"])((0, _assertThisInitialized2["default"])(_this));
@@ -149,25 +69,25 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
149
69
  _proto.initData =
150
70
  /*#__PURE__*/
151
71
  function () {
152
- var _initData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(params) {
72
+ var _initData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(params) {
153
73
  var topoDispatchers;
154
- return _regenerator["default"].wrap(function _callee4$(_context4) {
74
+ return _regenerator["default"].wrap(function _callee$(_context) {
155
75
  while (1) {
156
- switch (_context4.prev = _context4.next) {
76
+ switch (_context.prev = _context.next) {
157
77
  case 0:
158
78
  topoDispatchers = this.store.getModelDispatchers('topoCenter');
159
- _context4.next = 3;
79
+ _context.next = 3;
160
80
  return topoDispatchers.initData(params);
161
81
 
162
82
  case 3:
163
83
  case "end":
164
- return _context4.stop();
84
+ return _context.stop();
165
85
  }
166
86
  }
167
- }, _callee4, this);
87
+ }, _callee, this);
168
88
  }));
169
89
 
170
- function initData(_x4) {
90
+ function initData(_x) {
171
91
  return _initData.apply(this, arguments);
172
92
  }
173
93
 
@@ -186,22 +106,22 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
186
106
  _proto.exit =
187
107
  /*#__PURE__*/
188
108
  function () {
189
- var _exit = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
109
+ var _exit = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
190
110
  var topoDispatchers;
191
- return _regenerator["default"].wrap(function _callee5$(_context5) {
111
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
192
112
  while (1) {
193
- switch (_context5.prev = _context5.next) {
113
+ switch (_context2.prev = _context2.next) {
194
114
  case 0:
195
115
  topoDispatchers = this.store.getModelDispatchers('topoCenter');
196
- _context5.next = 3;
116
+ _context2.next = 3;
197
117
  return topoDispatchers.exit();
198
118
 
199
119
  case 3:
200
120
  case "end":
201
- return _context5.stop();
121
+ return _context2.stop();
202
122
  }
203
123
  }
204
- }, _callee5, this);
124
+ }, _callee2, this);
205
125
  }));
206
126
 
207
127
  function exit() {
@@ -420,6 +420,8 @@ var _default = (0, _extends2["default"])({
420
420
  */
421
421
  getTopoData: function getTopoData(id) {
422
422
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
423
+ var _result$links, result;
424
+
423
425
  return _regenerator["default"].wrap(function _callee12$(_context12) {
424
426
  while (1) {
425
427
  switch (_context12.prev = _context12.next) {
@@ -429,22 +431,29 @@ var _default = (0, _extends2["default"])({
429
431
  return _componentTopologyUtils.request.get(API_ROOT + "/structure/both/" + id);
430
432
 
431
433
  case 3:
432
- return _context12.abrupt("return", _context12.sent);
434
+ result = _context12.sent;
435
+ return _context12.abrupt("return", (0, _extends2["default"])({}, result, {
436
+ links: ((_result$links = result.links) !== null && _result$links !== void 0 ? _result$links : []).map(function (item) {
437
+ return (0, _extends2["default"])({}, item, {
438
+ ciType: 'network_link'
439
+ });
440
+ })
441
+ }));
433
442
 
434
- case 6:
435
- _context12.prev = 6;
443
+ case 7:
444
+ _context12.prev = 7;
436
445
  _context12.t0 = _context12["catch"](0);
437
446
 
438
447
  _rlog["default"].debug('getTopoData-error', _context12.t0);
439
448
 
440
449
  return _context12.abrupt("return", null);
441
450
 
442
- case 10:
451
+ case 11:
443
452
  case "end":
444
453
  return _context12.stop();
445
454
  }
446
455
  }
447
- }, _callee12, null, [[0, 6]]);
456
+ }, _callee12, null, [[0, 7]]);
448
457
  }))();
449
458
  },
450
459
 
@@ -457,7 +466,9 @@ var _default = (0, _extends2["default"])({
457
466
  */
458
467
  getTopoDataByResource: function getTopoDataByResource(id, resources, groups, exportLinkIdList) {
459
468
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
460
- var data, obj;
469
+ var _result$links2;
470
+
471
+ var data, obj, result;
461
472
  return _regenerator["default"].wrap(function _callee13$(_context13) {
462
473
  while (1) {
463
474
  switch (_context13.prev = _context13.next) {
@@ -479,9 +490,16 @@ var _default = (0, _extends2["default"])({
479
490
  }));
480
491
 
481
492
  case 5:
482
- return _context13.abrupt("return", _context13.sent);
493
+ result = _context13.sent;
494
+ return _context13.abrupt("return", (0, _extends2["default"])({}, result, {
495
+ links: ((_result$links2 = result.links) !== null && _result$links2 !== void 0 ? _result$links2 : []).map(function (item) {
496
+ return (0, _extends2["default"])({}, item, {
497
+ ciType: 'network_link'
498
+ });
499
+ })
500
+ }));
483
501
 
484
- case 6:
502
+ case 7:
485
503
  case "end":
486
504
  return _context13.stop();
487
505
  }
@@ -105,7 +105,7 @@ function addTopoDataResourcePermission(data) {
105
105
  permission: getNodePermission(node)
106
106
  });
107
107
  }),
108
- links: addLinksPermission(links),
109
- linkGroups: addLinksPermission(linkGroups)
108
+ links: addLinksPermission(links || []),
109
+ linkGroups: addLinksPermission(linkGroups || [])
110
110
  });
111
111
  }
@@ -9,7 +9,6 @@ exports.findGroupChildren = findGroupChildren;
9
9
  exports.findItemIndex = exports.findItem = void 0;
10
10
  exports.formatGroup = formatGroup;
11
11
  exports.formatGroups = formatGroups;
12
- exports.getCiModSet = getCiModSet;
13
12
  exports.getCiTypes = getCiTypes;
14
13
  exports.getCiTypesFromCiElements = getCiTypesFromCiElements;
15
14
  exports.getLinksBetweenTwoNodes = getLinksBetweenTwoNodes;
@@ -25,8 +24,6 @@ var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-ut
25
24
 
26
25
  var _lodash = _interopRequireDefault(require("lodash"));
27
26
 
28
- var _topoPermissionUtil = _interopRequireDefault(require("./topoPermissionUtil"));
29
-
30
27
  var _buildContextmenu = _interopRequireDefault(require("../core/viewer/contextmenu/buildContextmenu"));
31
28
 
32
29
  var _buildContextmenu2 = _interopRequireDefault(require("../core/editor/contextmenu/buildContextmenu"));
@@ -107,7 +104,7 @@ function updateNodeInfo(topoEngine, topoData) {
107
104
  nodes: topoData.nodes.map(function (node) {
108
105
  var attributes = node.attributes;
109
106
  return (0, _extends2["default"])({}, node, {
110
- ipAddress: node.ipAddress || (attributes === null || attributes === void 0 ? void 0 : attributes.ipAddress) || (attributes === null || attributes === void 0 ? void 0 : attributes.ipv4_address) || null,
107
+ ipAddress: node.ipAddress || (attributes === null || attributes === void 0 ? void 0 : attributes.ipv4_address) || null,
111
108
  isShowName: topoEngine.attributeMetricDisplay.getNodeNameVisible(node)
112
109
  });
113
110
  })
@@ -137,88 +134,6 @@ function getCiTypes(topoData) {
137
134
  var allCi = [].concat(topoData.nodes, topoData.links, topoData.linkGroups);
138
135
  return getCiTypesFromCiElements(allCi);
139
136
  }
140
- /**
141
- * 过滤ci元数据中的属性和指标,用于属性和指标显示设置
142
- * @param {} ciTypeObj
143
- * @returns
144
- */
145
-
146
-
147
- var ciModfilter = function ciModfilter(ciTypeObj, globalSetting, type, code) {
148
- var tips = globalSetting[type + "Tip"];
149
- var tags = globalSetting[type + "Tag"];
150
- var tipArr = [];
151
- var tagArr = [];
152
-
153
- if (tips !== null && tips !== void 0 && tips.isCustom) {
154
- var _tips$data$code;
155
-
156
- (_tips$data$code = tips.data[code]) === null || _tips$data$code === void 0 ? void 0 : _tips$data$code.map(function (item) {
157
- tipArr.push(item.code + "-" + item.type);
158
- });
159
- }
160
-
161
- if (tags !== null && tags !== void 0 && tags.isCustom) {
162
- var _tags$data$code;
163
-
164
- (_tags$data$code = tags.data[code]) === null || _tags$data$code === void 0 ? void 0 : _tags$data$code.map(function (item) {
165
- tagArr.push(item.code + "-" + item.type);
166
- });
167
- } // rlog.debug(
168
- // "过滤ci元数据中的属性和指标,用于属性和指标显示设置",
169
- // globalSetting,
170
- // tipArr,
171
- // tagArr
172
- // );
173
-
174
-
175
- var custom = [];
176
-
177
- if (type === "node") {
178
- custom.push({
179
- id: "name-graph",
180
- code: "name",
181
- name: "图片名称",
182
- type: "custom",
183
- tag: tagArr.indexOf("name-graph") >= 0,
184
- tip: tipArr.indexOf("name-graph") >= 0
185
- });
186
- custom.push({
187
- id: "display_name-ciType",
188
- code: "ciType",
189
- name: "资源类型",
190
- type: "custom",
191
- tag: tagArr.indexOf("display_name-ciType") >= 0,
192
- tip: tipArr.indexOf("display_name-ciType") >= 0
193
- });
194
- }
195
-
196
- var attributes = ciTypeObj.attributes.filter(function (attr) {
197
- return !!attr.userVisible;
198
- }).map(function (item) {
199
- var aid = item.code + "-attribute";
200
- return {
201
- id: aid,
202
- code: item.code,
203
- name: item.name,
204
- type: "attribute",
205
- tag: tagArr.indexOf(aid) >= 0,
206
- tip: tipArr.indexOf(aid) >= 0
207
- };
208
- });
209
- var metrics = ciTypeObj.metrics.map(function (item) {
210
- var mid = item.code + "-metric";
211
- return {
212
- id: mid,
213
- code: item.code,
214
- name: item.name,
215
- type: "metric",
216
- tag: tagArr.indexOf(mid) >= 0,
217
- tip: tipArr.indexOf(mid) >= 0
218
- };
219
- });
220
- return [].concat(custom, attributes, metrics);
221
- };
222
137
  /**
223
138
  * 格式化拓扑数据
224
139
  *
@@ -253,7 +168,6 @@ function buildGlobal(_ref2) {
253
168
  var _result$config, _engine$viewProps, _result$global2, _result$customGlobal, _result$customGlobal2, _engine$options$viewe, _engine$options$edito, _engine$options$edito2;
254
169
 
255
170
  var result = _ref2.data,
256
- permission = _ref2.permission,
257
171
  linkTo = _ref2.linkTo,
258
172
  globalConfig = _ref2.globalConfig,
259
173
  engine = _ref2.engine;
@@ -281,7 +195,7 @@ function buildGlobal(_ref2) {
281
195
  // 背景图
282
196
  backgroundImgUrl: (_engine$viewProps = engine.viewProps) !== null && _engine$viewProps !== void 0 && _engine$viewProps.hideBackground ? null : (0, _backgroundUtil.getBackgroundImageUrl)(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.background),
283
197
  control: (0, _extends2["default"])({
284
- editable: _topoPermissionUtil["default"].isEditable(permission),
198
+ editable: true,
285
199
  // 是否可编辑----控制[编辑]按钮
286
200
  moveable: true,
287
201
  // 节点是否可移动
@@ -368,10 +282,8 @@ var combTopoData = function combTopoData(_ref3) {
368
282
  var _result$groups;
369
283
 
370
284
  var data = _ref3.data,
371
- permission = _ref3.permission,
372
285
  linkTo = _ref3.linkTo,
373
286
  globalConfig = _ref3.globalConfig,
374
- ciTypeMap = _ref3.ciTypeMap,
375
287
  engine = _ref3.engine;
376
288
  var result = (0, _clusterUtil.processCluster)(updateNodeInfo(engine, data)); // rlog.debug("combTopoData-接收到数据", result, engine, globalConfig);
377
289
 
@@ -381,7 +293,6 @@ var combTopoData = function combTopoData(_ref3) {
381
293
 
382
294
  var global = buildGlobal({
383
295
  data: result,
384
- permission: permission,
385
296
  linkTo: linkTo,
386
297
  globalConfig: globalConfig,
387
298
  engine: engine
@@ -412,17 +323,11 @@ var combTopoData = function combTopoData(_ref3) {
412
323
  }; // 所有资源
413
324
 
414
325
  var allCis = [].concat(data.nodes, data.links, data.linkGroups);
415
- var resAndMetrics = (0, _extends2["default"])({
326
+ var resAndMetrics = {
416
327
  // topo所有ci的id集合
417
328
  resIdsList: allCis.map(function (item) {
418
329
  return item.id;
419
330
  }),
420
- ciTypes: getCiTypes(data),
421
- // ci类型集合
422
- ciTypeMap: ciTypeMap,
423
- // ci类型模型map
424
- metrics: [],
425
- // 所有指标
426
331
  nodeIdsList: data.nodes.map(function (item) {
427
332
  return {
428
333
  ciId: item.id,
@@ -435,86 +340,13 @@ var combTopoData = function combTopoData(_ref3) {
435
340
  operation: linkObj.operation
436
341
  };
437
342
  })
438
- }, getCiModSet({
439
- engine: engine,
440
- data: data,
441
- allCis: allCis,
442
- ciTypeMap: ciTypeMap,
443
- globalConfig: globalConfig
444
- })); // rlog.debug("combTopoData-格式化后数据", topoData, resAndMetrics);
343
+ }; // rlog.debug("combTopoData-格式化后数据", topoData, resAndMetrics);
445
344
 
446
345
  return {
447
346
  topoData: topoData,
448
347
  resAndMetrics: resAndMetrics
449
348
  };
450
349
  };
451
-
452
- exports.combTopoData = combTopoData;
453
-
454
- function getCiModSet(params) {
455
- var data = params.data,
456
- engine = params.engine,
457
- allCis = params.allCis,
458
- ciTypeMap = params.ciTypeMap,
459
- globalConfig = params.globalConfig; // 当前拓扑资源字典
460
-
461
- var ciDoc = {};
462
- var ciTypesDoc = {};
463
- var allCiModSet = getNodeModSet();
464
-
465
- function getNodeModSet() {
466
- var ciTypes = getCiTypesFromCiElements(data.nodes);
467
- return getModSet(ciTypes);
468
- }
469
- /**
470
- *
471
- * @param {array} ciTypeCodes
472
- * @returns
473
- */
474
-
475
-
476
- function getModSet(ciTypeCodes) {
477
- var modSet = {};
478
- Object.keys(ciTypeMap).filter(function (item) {
479
- return ciTypeCodes.includes(item);
480
- }).forEach(function (key) {
481
- var ciTypeObj = ciTypeMap[key];
482
- modSet[key] = {
483
- name: ciTypeObj.displayName,
484
- code: ciTypeObj.code,
485
- icon: ciTypeObj.icon,
486
- list: ciModfilter(ciTypeObj, globalConfig, "node", ciTypeObj.code)
487
- };
488
- }); // console.log("modSet--------------------", modSet);
489
-
490
- return modSet;
491
- }
492
-
493
- if (allCis.length > 0) {
494
- allCis.forEach(function (element, index) {
495
- var ciType = element.ciType;
496
- ciDoc[element.id] = {
497
- code: element.ciType,
498
- name: element.name,
499
- tag: [],
500
- tip: []
501
- };
502
- ciTypesDoc[ciType] = ciTypesDoc[ciType] || [];
503
- ciTypesDoc[element.ciType].push({
504
- ciId: element.id
505
- });
506
- });
507
- }
508
-
509
- return {
510
- ciDoc: ciDoc,
511
- // ci信息集合
512
- ciTypesDoc: ciTypesDoc,
513
- // 每种ci含有的ci
514
- allCiModSet: allCiModSet // 资源类型含有属性和指标集合
515
-
516
- };
517
- }
518
350
  /**
519
351
  * 获得两个节点间的连线列表
520
352
  * @param {*} links
@@ -524,6 +356,8 @@ function getCiModSet(params) {
524
356
  */
525
357
 
526
358
 
359
+ exports.combTopoData = combTopoData;
360
+
527
361
  function getLinksBetweenTwoNodes(links, id1, id2) {
528
362
  return links.filter(function (link) {
529
363
  return link.source === id1 && link.target === id2 || link.target === id1 && link.source === id2;