@riil-frontend/component-topology 3.5.0-a.9 → 3.5.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 (106) 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/index.module.scss +3 -114
  5. package/es/core/components/AlarmListPanel/index.js +7 -12
  6. package/es/core/components/DisplaySettingDrawer/DisplaySetting.js +8 -5
  7. package/es/core/components/DisplaySettingDrawer/NodeTag.js +10 -5
  8. package/es/core/components/DisplaySettingDrawer/NodeTip.js +10 -5
  9. package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +3 -21
  10. package/es/core/components/TopoView/topoView.js +1 -0
  11. package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -140
  12. package/es/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +1 -1
  13. package/es/core/editor/components/settings/propertyViews/node/Setting/Setting.js +1 -1
  14. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +18 -17
  15. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +62 -18
  16. package/es/core/models/Alarm.js +206 -120
  17. package/es/core/models/DataModel.js +15 -1
  18. package/es/core/models/TopoApp.js +4 -6
  19. package/es/core/models/cache/CiTyeCache.js +4 -0
  20. package/es/core/models/utils/linkUtils.js +87 -42
  21. package/es/core/services/index.js +28 -0
  22. package/es/core/utils/saveSerialize.js +34 -0
  23. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +0 -37
  24. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +31 -28
  25. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +44 -43
  26. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +39 -26
  27. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useCiData.js +0 -0
  28. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +143 -0
  29. package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +37 -0
  30. package/es/core/viewer/components/titlebar/BasicTools.js +11 -1
  31. package/es/core/viewer/components/titlebar/widgets/AlarmListShowButton.js +21 -13
  32. package/es/hooks/useGraphAlarmDisplay.js +3 -4
  33. package/es/hooks/useManageStatus.js +1 -1
  34. package/es/hooks/useTopoEdit.js +200 -144
  35. package/es/hooks/useTopoEventListener.js +13 -6
  36. package/es/index.js +3 -2
  37. package/es/models/topoConfig.js +0 -1
  38. package/es/models/topoMod.js +15 -10
  39. package/es/topoCenter/components/Topo404.js +3 -1
  40. package/es/topoCenter/components/TopoNoPermission.js +3 -1
  41. package/es/topoCenter/components/TopoView.js +77 -32
  42. package/es/topoCenter/components/Topology.js +2 -0
  43. package/es/topoCenter/components/editor/propertyViews/edge/EdgePropertyView.js +10 -0
  44. package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +5 -20
  45. package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +12 -6
  46. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +84 -43
  47. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +60 -34
  48. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +9 -0
  49. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/server.js +62 -19
  50. package/es/topoCenter/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +157 -0
  51. package/es/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +1 -2
  52. package/es/topoCenter/hooks/editor/useDeleteEdges.js +2 -3
  53. package/es/topoCenter/utils/resourcePermissionUtil.js +18 -12
  54. package/es/utils/topoData.js +15 -13
  55. package/lib/components/index.module.scss +3 -114
  56. package/lib/core/components/AlarmListPanel/index.js +7 -12
  57. package/lib/core/components/DisplaySettingDrawer/DisplaySetting.js +9 -5
  58. package/lib/core/components/DisplaySettingDrawer/NodeTag.js +11 -5
  59. package/lib/core/components/DisplaySettingDrawer/NodeTip.js +12 -5
  60. package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +3 -21
  61. package/lib/core/components/TopoView/topoView.js +1 -0
  62. package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -151
  63. package/lib/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +2 -2
  64. package/lib/core/editor/components/settings/propertyViews/node/Setting/Setting.js +1 -1
  65. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +17 -16
  66. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +66 -20
  67. package/lib/core/models/Alarm.js +206 -121
  68. package/lib/core/models/DataModel.js +15 -1
  69. package/lib/core/models/TopoApp.js +4 -6
  70. package/lib/core/models/cache/CiTyeCache.js +4 -0
  71. package/lib/core/models/utils/linkUtils.js +92 -43
  72. package/lib/core/services/index.js +29 -0
  73. package/lib/core/utils/saveSerialize.js +43 -0
  74. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +0 -37
  75. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +29 -26
  76. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +45 -43
  77. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +38 -24
  78. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useCiData.js +1 -0
  79. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +155 -0
  80. package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +47 -0
  81. package/lib/core/viewer/components/titlebar/BasicTools.js +11 -1
  82. package/lib/core/viewer/components/titlebar/widgets/AlarmListShowButton.js +22 -15
  83. package/lib/hooks/useGraphAlarmDisplay.js +3 -5
  84. package/lib/hooks/useManageStatus.js +1 -1
  85. package/lib/hooks/useTopoEdit.js +197 -141
  86. package/lib/hooks/useTopoEventListener.js +13 -6
  87. package/lib/index.js +5 -0
  88. package/lib/models/topoConfig.js +0 -1
  89. package/lib/models/topoMod.js +15 -10
  90. package/lib/topoCenter/components/Topo404.js +4 -1
  91. package/lib/topoCenter/components/TopoNoPermission.js +4 -1
  92. package/lib/topoCenter/components/TopoView.js +78 -33
  93. package/lib/topoCenter/components/Topology.js +3 -0
  94. package/lib/topoCenter/components/editor/propertyViews/edge/EdgePropertyView.js +22 -0
  95. package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +5 -21
  96. package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +13 -8
  97. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +87 -42
  98. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +61 -37
  99. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +9 -0
  100. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/server.js +62 -18
  101. package/lib/topoCenter/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +183 -0
  102. package/lib/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +1 -2
  103. package/lib/topoCenter/hooks/editor/useDeleteEdges.js +2 -3
  104. package/lib/topoCenter/utils/resourcePermissionUtil.js +20 -12
  105. package/lib/utils/topoData.js +15 -13
  106. package/package.json +5 -5
@@ -160,6 +160,10 @@ var CiTyeCache = /*#__PURE__*/function () {
160
160
  if (type.id === connectType) {
161
161
  var metrics = ciType.metrics // 物理链路移除:ping状态、专线连通状态
162
162
  .filter(function (metric) {
163
+ if (connectType === 'exit') {
164
+ return true;
165
+ }
166
+
163
167
  return ['network_dedicated_line_status', 'ping_status'].indexOf(metric.code) === -1;
164
168
  }) // 按链路类型过滤对应指标
165
169
  .filter(function (metric) {
@@ -4,42 +4,87 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
 
5
5
  exports.__esModule = true;
6
6
  exports.buildTopoLinkData = buildTopoLinkData;
7
+ exports.getInterfaceObject = void 0;
7
8
  exports.getLinksDetail = getLinksDetail;
8
9
  exports.isAggLink = isAggLink;
9
10
  exports.mergeLinksData = mergeLinksData;
10
11
 
11
12
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
12
13
 
13
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
14
-
15
14
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
16
15
 
16
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
+
17
18
  var _topo = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/services/topo"));
18
19
 
19
20
  var _keyBy = _interopRequireDefault(require("lodash/keyBy"));
20
21
 
21
- var _services = require("../../services");
22
+ var _lodash = _interopRequireDefault(require("lodash"));
22
23
 
23
- var interfaceTypeMap = {
24
- "network.interface": {
25
- displayName: "网络接口"
26
- },
27
- "network.agg_interface": {
28
- displayName: "聚合接口"
29
- }
30
- };
24
+ var _services = require("../../services");
31
25
 
26
+ // const interfaceTypeMap = {
27
+ // "network.interface": {
28
+ // displayName: "网络接口",
29
+ // },
30
+ // "network.agg_interface": {
31
+ // displayName: "聚合接口",
32
+ // },
33
+ // };
32
34
  function isAggLink(link) {
33
35
  return link.attributes["network_link.connect_type"] === "agg";
34
36
  }
35
37
 
36
- function mergeLinksData(links, linkCis, nodes, interfaceCis) {
38
+ var getInterfaceObject = /*#__PURE__*/function () {
39
+ var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(codes) {
40
+ var query, promises, result, ifDoc;
41
+ return _regenerator["default"].wrap(function _callee$(_context) {
42
+ while (1) {
43
+ switch (_context.prev = _context.next) {
44
+ case 0:
45
+ query = _lodash["default"].compact(_lodash["default"].uniq(codes));
46
+ promises = query.map(_services.queryModelAsset);
47
+ _context.next = 4;
48
+ return Promise.all(promises);
49
+
50
+ case 4:
51
+ result = _context.sent;
52
+ ifDoc = {};
53
+ result.map(function (ifItem) {
54
+ ifDoc[ifItem.code] = {
55
+ displayName: ifItem.displayName
56
+ };
57
+ });
58
+ return _context.abrupt("return", ifDoc);
59
+
60
+ case 8:
61
+ case "end":
62
+ return _context.stop();
63
+ }
64
+ }
65
+ }, _callee);
66
+ }));
67
+
68
+ return function getInterfaceObject(_x) {
69
+ return _ref.apply(this, arguments);
70
+ };
71
+ }();
72
+
73
+ exports.getInterfaceObject = getInterfaceObject;
74
+
75
+ function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
37
76
  var linkCiMap = (0, _keyBy["default"])(linkCis, "id");
38
77
  return links.map(function (link) {
39
- var _nodes$find, _nodes$find2, _interfaceCis$find, _interfaceCis$find2;
78
+ var _interfaceCis$find, _interfaceCis$find2;
40
79
 
41
80
  var linkCi = linkCiMap[link.id];
42
- var attributes = (0, _extends2["default"])({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes); // 翻译
81
+ var attributes = (0, _extends2["default"])({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes);
82
+ var sourceNode = nodes.find(function (node) {
83
+ return node.id === attributes["network_link.source_device_id"];
84
+ });
85
+ var targetNode = nodes.find(function (node) {
86
+ return node.id === attributes["network_link.destination_device_id"];
87
+ }); // 翻译
43
88
 
44
89
  return (0, _extends2["default"])({}, link, {
45
90
  id: linkCi.id,
@@ -48,18 +93,14 @@ function mergeLinksData(links, linkCis, nodes, interfaceCis) {
48
93
  attributes: (0, _extends2["default"])({}, attributes, {
49
94
  // 源/目的设备
50
95
  "network_link.source_device_id_object": {
51
- displayName: (_nodes$find = nodes.find(function (node) {
52
- return node.id === attributes["network_link.source_device_id"];
53
- })) === null || _nodes$find === void 0 ? void 0 : _nodes$find.name
96
+ displayName: sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.name
54
97
  },
55
98
  "network_link.destination_device_id_object": {
56
- displayName: (_nodes$find2 = nodes.find(function (node) {
57
- return node.id === attributes["network_link.destination_device_id"];
58
- })) === null || _nodes$find2 === void 0 ? void 0 : _nodes$find2.name
99
+ displayName: targetNode === null || targetNode === void 0 ? void 0 : targetNode.name
59
100
  },
60
101
  // 源/目的接口类型
61
- source_type_object: interfaceTypeMap[attributes.source_type],
62
- destination_type_object: interfaceTypeMap[attributes.destination_type],
102
+ source_type_object: interfaceDoc[attributes.source_type],
103
+ destination_type_object: interfaceDoc[attributes.destination_type],
63
104
  // 源/目的接口
64
105
  source_id_object: {
65
106
  displayName: (_interfaceCis$find = interfaceCis.find(function (node) {
@@ -76,50 +117,58 @@ function mergeLinksData(links, linkCis, nodes, interfaceCis) {
76
117
  });
77
118
  }
78
119
 
79
- function getLinksDetail(_x, _x2) {
120
+ function getLinksDetail(_x2, _x3) {
80
121
  return _getLinksDetail.apply(this, arguments);
81
122
  }
82
123
 
83
124
  function _getLinksDetail() {
84
- _getLinksDetail = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(links, nodes) {
85
- var linkCis, interfaceIds, interfaceCis;
86
- return _regenerator["default"].wrap(function _callee$(_context) {
125
+ _getLinksDetail = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(links, nodes) {
126
+ var linkCis, interfaceIds, interfaceTypes, interfaceCis, interfaceDoc;
127
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
87
128
  while (1) {
88
- switch (_context.prev = _context.next) {
129
+ switch (_context2.prev = _context2.next) {
89
130
  case 0:
90
131
  if (!(!links || !links.length)) {
91
- _context.next = 2;
132
+ _context2.next = 2;
92
133
  break;
93
134
  }
94
135
 
95
- return _context.abrupt("return", []);
136
+ return _context2.abrupt("return", []);
96
137
 
97
138
  case 2:
98
- _context.next = 4;
139
+ _context2.next = 4;
99
140
  return _topo["default"].relation.batchQueryRelation(links.map(function (link) {
100
141
  return link.id;
101
142
  }));
102
143
 
103
144
  case 4:
104
- linkCis = _context.sent;
105
- interfaceIds = [].concat(linkCis.map(function (item) {
106
- return item.attributes.source_id;
107
- }), linkCis.map(function (item) {
108
- return item.attributes.destination_id;
109
- }));
110
- _context.next = 8;
145
+ linkCis = _context2.sent;
146
+ interfaceIds = [];
147
+ interfaceTypes = [];
148
+ linkCis.map(function (item) {
149
+ interfaceIds.push(item.attributes.source_id);
150
+ interfaceIds.push(item.attributes.destination_id);
151
+ interfaceTypes.push(item.attributes.source_type);
152
+ interfaceTypes.push(item.attributes.destination_type);
153
+ });
154
+ _context2.next = 10;
111
155
  return (0, _services.queryCisByIds)(interfaceIds);
112
156
 
113
- case 8:
114
- interfaceCis = _context.sent;
115
- return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis));
116
-
117
157
  case 10:
158
+ interfaceCis = _context2.sent;
159
+ _context2.next = 13;
160
+ return getInterfaceObject(interfaceTypes);
161
+
162
+ case 13:
163
+ interfaceDoc = _context2.sent;
164
+ return _context2.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
165
+
166
+ case 15:
118
167
  case "end":
119
- return _context.stop();
168
+ return _context2.stop();
120
169
  }
121
170
  }
122
- }, _callee);
171
+ }, _callee2);
123
172
  }));
124
173
  return _getLinksDetail.apply(this, arguments);
125
174
  }
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
 
5
5
  exports.__esModule = true;
6
6
  exports.queryCisByIds = queryCisByIds;
7
+ exports.queryModelAsset = queryModelAsset;
7
8
 
8
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
10
 
@@ -42,4 +43,32 @@ function _queryCisByIds() {
42
43
  }, _callee);
43
44
  }));
44
45
  return _queryCisByIds.apply(this, arguments);
46
+ }
47
+
48
+ function queryModelAsset(_x2) {
49
+ return _queryModelAsset.apply(this, arguments);
50
+ }
51
+
52
+ function _queryModelAsset() {
53
+ _queryModelAsset = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(code) {
54
+ var result;
55
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
56
+ while (1) {
57
+ switch (_context2.prev = _context2.next) {
58
+ case 0:
59
+ _context2.next = 2;
60
+ return _componentTopologyUtils.request.get("/mdc/v1/api/model-asset/" + code);
61
+
62
+ case 2:
63
+ result = _context2.sent;
64
+ return _context2.abrupt("return", result);
65
+
66
+ case 4:
67
+ case "end":
68
+ return _context2.stop();
69
+ }
70
+ }
71
+ }, _callee2);
72
+ }));
73
+ return _queryModelAsset.apply(this, arguments);
45
74
  }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports["default"] = saveSerialize;
7
+
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+
12
+ var _topo = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/services/topo"));
13
+
14
+ /**
15
+ * 增加保存拓扑序列化数据方法,以便于拓扑中心和业务拓扑使用
16
+ *
17
+ * @param {*} topo
18
+ */
19
+ function saveSerialize(_x) {
20
+ return _saveSerialize.apply(this, arguments);
21
+ }
22
+
23
+ function _saveSerialize() {
24
+ _saveSerialize = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(topo) {
25
+ var topoId, serialize;
26
+ return _regenerator["default"].wrap(function _callee$(_context) {
27
+ while (1) {
28
+ switch (_context.prev = _context.next) {
29
+ case 0:
30
+ topoId = topo.getId();
31
+ serialize = topo.getHtTopo().serialize();
32
+ _context.next = 4;
33
+ return _topo["default"].saveSerializeData(topoId, serialize);
34
+
35
+ case 4:
36
+ case "end":
37
+ return _context.stop();
38
+ }
39
+ }
40
+ }, _callee);
41
+ }));
42
+ return _saveSerialize.apply(this, arguments);
43
+ }
@@ -182,43 +182,6 @@ function ResourceDetail(props) {
182
182
  getUser();
183
183
  }
184
184
 
185
- (0, _react.useEffect)(function () {
186
- console.log('topoData', activeData.ciType, topoModData);
187
-
188
- if (topoModData && activeData !== null && activeData !== void 0 && activeData.id) {
189
- var id = activeData.id,
190
- ciType = activeData.ciType;
191
- var ciTypeMeta;
192
-
193
- if (ciType === 'network_link') {
194
- // 网络链路要按链路类型查询属性、指标
195
- var linkGroups = topoModData.linkGroups,
196
- links = topoModData.links;
197
- var link = [].concat(linkGroups, links).find(function (item) {
198
- return item.id === id;
199
- });
200
- var linkConnectType = link.attributes['network_link.connect_type'];
201
- ciTypeMeta = topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
202
- } else {
203
- ciTypeMeta = topo.ciTyeCache.getCiType(ciType);
204
- }
205
-
206
- if (!ciTypeMeta) {
207
- return;
208
- }
209
-
210
- var _ciTypeMeta = ciTypeMeta,
211
- metrics = _ciTypeMeta.metrics; // 同步需要实时展示的指标
212
-
213
- topoDispatchers.update({
214
- id: id,
215
- metricCodes: metrics.slice(0, 6).map(function (item) {
216
- return item.code;
217
- }) // 需要展示的关键指标 code
218
-
219
- });
220
- }
221
- }, [topoModData, activeData]);
222
185
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_drawer["default"], {
223
186
  className: _indexModule["default"].baseInfo,
224
187
  closeMode: ['close', 'esc'],
@@ -15,7 +15,7 @@ var _indexModule = _interopRequireDefault(require("./index.module.scss"));
15
15
  function formatUrl(url) {
16
16
  var _window, _window$location;
17
17
 
18
- var prefix = '/default/pagecenter';
18
+ var prefix = "/default/pagecenter";
19
19
 
20
20
  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) {
21
21
  return url.split(prefix)[1];
@@ -50,8 +50,8 @@ function BaseInfoContent(props) {
50
50
  data = props.data;
51
51
  var itemCols = {
52
52
  node: [{
53
- label: '资源名称:',
54
- objKey: 'resource',
53
+ label: "资源名称:",
54
+ objKey: "resource",
55
55
  render: function render(valueData, key) {
56
56
  var display_name = valueData.display_name,
57
57
  link = valueData.link;
@@ -62,43 +62,46 @@ function BaseInfoContent(props) {
62
62
  }, valueData ? /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
63
63
  className: _indexModule["default"].link,
64
64
  to: formatUrl(link)
65
- }, display_name || '-') : '-');
65
+ }, display_name || "-") : "-");
66
66
  }
67
67
  }, {
68
- label: 'IP地址:',
69
- objKey: 'ipv4_address'
68
+ label: "IP地址:",
69
+ objKey: "ipv4_address"
70
70
  }, {
71
- label: '资产编号:',
72
- objKey: 'asset_number'
71
+ label: "资产编号:",
72
+ objKey: "asset_number"
73
73
  }, {
74
- label: '资源类型:',
75
- objKey: 'ciName'
74
+ label: "资源类型:",
75
+ objKey: "ciName"
76
76
  }, {
77
- label: '资源位置:',
78
- objKey: 'res_address'
77
+ label: "资源位置:",
78
+ objKey: "res_address"
79
79
  } // {
80
80
  // label: '负责人:',
81
81
  // objKey: 'principal'
82
82
  // },
83
83
  ],
84
84
  link: [{
85
- label: '链路带宽:',
86
- objKey: 'rated_bandwidth',
85
+ label: "链路带宽:",
86
+ objKey: "rated_bandwidth",
87
87
  style: {
88
- width: '100%'
88
+ width: "100%"
89
89
  }
90
90
  }, {
91
- label: '源IP地址:',
92
- objKey: 'source_ipv4'
91
+ label: "源IP地址:",
92
+ objKey: "source_ipv4"
93
93
  }, {
94
- label: '目的IP地址:',
95
- objKey: 'destination_ipv4'
94
+ label: "目的IP地址:",
95
+ objKey: "destination_ipv4"
96
96
  }, {
97
- label: '源端口:',
98
- objKey: 'source_Interface'
97
+ label: "源端口:",
98
+ objKey: "source_Interface"
99
99
  }, {
100
- label: '目的端口:',
101
- objKey: 'destination_Interface'
100
+ label: "目的端口:",
101
+ objKey: "destination_Interface"
102
+ }, {
103
+ label: "连接方式:",
104
+ objKey: "network_link.connect_type"
102
105
  }]
103
106
  };
104
107
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, (_itemCols$type = itemCols[type]) === null || _itemCols$type === void 0 ? void 0 : _itemCols$type.map(function (_ref, key) {
@@ -106,12 +109,12 @@ function BaseInfoContent(props) {
106
109
  objKey = _ref.objKey,
107
110
  style = _ref.style,
108
111
  render = _ref.render;
109
- return data[objKey] === false ? '' : render ? render(data[objKey], key) : /*#__PURE__*/_react["default"].createElement(AttributeItem, {
112
+ return data[objKey] === false ? "" : render ? render(data[objKey], key) : /*#__PURE__*/_react["default"].createElement(AttributeItem, {
110
113
  key: key,
111
114
  label: label,
112
115
  style: style || {},
113
116
  contentTitle: data[objKey]
114
- }, data[objKey] || '-');
117
+ }, data[objKey] || "-");
115
118
  }));
116
119
  } // 基本信息
117
120
 
@@ -136,6 +139,6 @@ function BaseInfo(props) {
136
139
  }
137
140
 
138
141
  return /*#__PURE__*/_react["default"].createElement("div", {
139
- className: _indexModule["default"]['base-info']
142
+ className: _indexModule["default"]["base-info"]
140
143
  }, content);
141
144
  }
@@ -39,6 +39,8 @@ var _BaseInfoBlock = _interopRequireDefault(require("./BaseInfoBlock"));
39
39
 
40
40
  var _BlockBox = _interopRequireDefault(require("./BlockBox"));
41
41
 
42
+ var _useMetricModels2 = _interopRequireDefault(require("./hooks/useMetricModels"));
43
+
42
44
  var _indexModule = _interopRequireDefault(require("./index.module.scss"));
43
45
 
44
46
  var _ResourceOverviewMetric = _interopRequireDefault(require("./ResourceOverviewMetric"));
@@ -76,9 +78,7 @@ function ResourceOverview(props) {
76
78
  userId = props.userId,
77
79
  viewerProps = props.viewerProps;
78
80
  var resourceOverviewProps = (viewerProps === null || viewerProps === void 0 ? void 0 : (_viewerProps$resource = viewerProps.resourceDetailProps) === null || _viewerProps$resource === void 0 ? void 0 : _viewerProps$resource.resourceOverviewProps) || {};
79
- var data = (0, _react.useMemo)(function () {
80
- return topo.dataModel.getDataById(id);
81
- }, [id]);
81
+ var data = topo.dataModel.useDataById(id);
82
82
  var ciAttrAndMetricData = (0, _useCiAttrAndMetricData["default"])({
83
83
  topo: topo,
84
84
  id: id
@@ -110,7 +110,9 @@ function ResourceOverview(props) {
110
110
  // 目的IP地址
111
111
  source_Interface: '',
112
112
  // 源端口
113
- destination_Interface: '' // 目的端口
113
+ destination_Interface: '',
114
+ // 目的端口,
115
+ 'network_link.connect_type': '' // 连接方式,
114
116
 
115
117
  }),
116
118
  baseInfo = _useState[0],
@@ -142,9 +144,26 @@ function ResourceOverview(props) {
142
144
 
143
145
  return typeMeta;
144
146
  }, [id]);
147
+
148
+ var _useMetricModels = (0, _useMetricModels2["default"])({
149
+ data: {
150
+ type: type,
151
+ id: id,
152
+ ciType: ciType
153
+ },
154
+ isMonite: data.manageStatus !== 0,
155
+ ciTypeMeta: ciTypeMeta,
156
+ topo: topo,
157
+ resourceOverviewProps: resourceOverviewProps
158
+ }),
159
+ monitorMetricModels = _useMetricModels.metricModels,
160
+ metricInitLoading = _useMetricModels.initLoading;
161
+
145
162
  (0, _react.useEffect)(function () {
146
- init();
147
- }, [ciAttrAndMetricData, ciTypeMeta, id]);
163
+ if (monitorMetricModels) {
164
+ init();
165
+ }
166
+ }, [ciAttrAndMetricData, ciTypeMeta, monitorMetricModels, id]);
148
167
 
149
168
  function init() {
150
169
  return _init.apply(this, arguments);
@@ -152,79 +171,59 @@ function ResourceOverview(props) {
152
171
 
153
172
  function _init() {
154
173
  _init = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
155
- var _topo$options$resourc, _modelAttributeMap$ow, _modelAttributeMap$, _modelAttributeMap$2, _modelAttributeMap$3, _modelAttributeMap$di, _modelAttributeMap$ip, _modelAttributeMap$as, _modelAttributeMap$5, _modelAttributeMap$6, _modelAttributeMap$so, _attributeMap$source_, _modelAttributeMap$de, _attributeMap$destina;
174
+ var _topo$options$resourc, _modelAttributeMap$ow, _modelAttributeMap$, _modelAttributeMap$2, _modelAttributeMap$3, _modelAttributeMap$di, _modelAttributeMap$ip, _modelAttributeMap$as, _modelAttributeMap$5, _modelAttributeMap$6, _modelAttributeMap$so, _attributeMap$source_, _modelAttributeMap$de, _attributeMap$destina, _modelAttributeMap$ne;
156
175
 
157
- var modelMetrics, ciName, modelAttributeMap, domain, displayMetricModels, metricCodes, isAppTopoFlag, attributeMap, metrics, res_address, _attributeMap$, rated_bandwidth, _modelAttributeMap$4;
176
+ var displayMetricModels, ciName, modelAttributeMap, domain, isAppTopoFlag, attributeMap, metrics, res_address, _attributeMap$, rated_bandwidth, _modelAttributeMap$4, connect_type;
158
177
 
159
178
  return _regenerator["default"].wrap(function _callee$(_context) {
160
179
  while (1) {
161
180
  switch (_context.prev = _context.next) {
162
181
  case 0:
163
- console.log('初始化/更新概览 props', props); // 指标模型
182
+ console.log('初始化/更新概览 props', props);
183
+ displayMetricModels = monitorMetricModels; // 指标模型
164
184
 
165
- modelMetrics = ciTypeMeta.metrics, ciName = ciTypeMeta.displayName, modelAttributeMap = ciTypeMeta.attributeMap, domain = ciTypeMeta.domain;
166
- displayMetricModels = modelMetrics.slice(0, 6);
167
-
168
- if (resourceOverviewProps !== null && resourceOverviewProps !== void 0 && resourceOverviewProps.getMetricCodes) {
169
- metricCodes = resourceOverviewProps === null || resourceOverviewProps === void 0 ? void 0 : resourceOverviewProps.getMetricCodes({
170
- id: id,
171
- type: type,
172
- ciType: ciType
173
- });
174
-
175
- if (metricCodes) {
176
- displayMetricModels = metricCodes.map(function (code) {
177
- return modelMetrics.find(function (item) {
178
- return item.code === code;
179
- });
180
- }).filter(function (item) {
181
- return !!item;
182
- });
183
- }
184
- }
185
-
186
- displayMetricModels = displayMetricModels.slice(0, 6); // 应用拓扑处理
185
+ ciName = ciTypeMeta.displayName, modelAttributeMap = ciTypeMeta.attributeMap, domain = ciTypeMeta.domain; // 应用拓扑处理
187
186
 
188
187
  isAppTopoFlag = !!((_topo$options$resourc = topo.options.resourceOverviewDrawer) !== null && _topo$options$resourc !== void 0 && _topo$options$resourc.getData);
189
188
  console.log('应用拓扑判断', topo, isAppTopoFlag);
190
189
  setIsAppTopo(isAppTopoFlag);
191
190
 
192
191
  if (!isAppTopoFlag) {
193
- _context.next = 11;
192
+ _context.next = 9;
194
193
  break;
195
194
  }
196
195
 
197
196
  initAppTopo(displayMetricModels, modelAttributeMap, ciName, domain);
198
197
  return _context.abrupt("return");
199
198
 
200
- case 11:
199
+ case 9:
201
200
  // 拓扑(默认) ---------------------------
202
201
  // 基本信息
203
202
  attributeMap = ciAttrAndMetricData.attributeMap, metrics = ciAttrAndMetricData.metrics;
204
- console.log('基本信息', attributeMap, modelAttributeMap); // userVisible
203
+ console.log('基本信息x', attributeMap, modelAttributeMap); // userVisible
205
204
  // 位置
206
205
 
207
206
  res_address = false;
208
207
 
209
208
  if (!((_modelAttributeMap$ow = modelAttributeMap.owned_computer_room) !== null && _modelAttributeMap$ow !== void 0 && _modelAttributeMap$ow.userVisible)) {
210
- _context.next = 20;
209
+ _context.next = 18;
211
210
  break;
212
211
  }
213
212
 
214
- _context.next = 17;
213
+ _context.next = 15;
215
214
  return getAddressFormat(attributeMap);
216
215
 
217
- case 17:
216
+ case 15:
218
217
  res_address = _context.sent;
219
- _context.next = 21;
218
+ _context.next = 19;
220
219
  break;
221
220
 
222
- case 20:
221
+ case 18:
223
222
  if ((_modelAttributeMap$ = modelAttributeMap[ciType + ".computer_room"]) !== null && _modelAttributeMap$ !== void 0 && _modelAttributeMap$.userVisible || (_modelAttributeMap$2 = modelAttributeMap[ciType + ".area"]) !== null && _modelAttributeMap$2 !== void 0 && _modelAttributeMap$2.userVisible) {
224
223
  res_address = attributeMap[ciType + ".computer_room "] || attributeMap[ciType + ".area"] ? " " + (((_attributeMap$ = attributeMap[ciType + ".area_object"]) === null || _attributeMap$ === void 0 ? void 0 : _attributeMap$.displayName) || '') + " " + (attributeMap[ciType + ".computer_room"] || '') : false;
225
224
  }
226
225
 
227
- case 21:
226
+ case 19:
228
227
  // 链路带宽(取实际带宽)
229
228
  rated_bandwidth = false;
230
229
 
@@ -232,6 +231,7 @@ function ResourceOverview(props) {
232
231
  rated_bandwidth = attributeMap[ciType + ".actual_bandwidth"] ? attributeMap[ciType + ".actual_bandwidth"] + " " + ((_modelAttributeMap$4 = modelAttributeMap[ciType + ".actual_bandwidth"]) === null || _modelAttributeMap$4 === void 0 ? void 0 : _modelAttributeMap$4.unit) : '';
233
232
  }
234
233
 
234
+ connect_type = attributeMap['network_link.connect_type'] === 'exit' ? '出口' : '物理/聚合';
235
235
  setBaseInfo({
236
236
  // 资源
237
237
  // display_name: modelAttributeMap['display_name'] ? attributeMap.display_name : false,
@@ -251,7 +251,8 @@ function ResourceOverview(props) {
251
251
  source_ipv4: (_modelAttributeMap$5 = modelAttributeMap[ciType + ".source_ipv4"]) !== null && _modelAttributeMap$5 !== void 0 && _modelAttributeMap$5.userVisible ? attributeMap[ciType + ".source_ipv4"] : false,
252
252
  destination_ipv4: (_modelAttributeMap$6 = modelAttributeMap[ciType + ".destination_ipv4"]) !== null && _modelAttributeMap$6 !== void 0 && _modelAttributeMap$6.userVisible ? attributeMap[ciType + ".destination_ipv4"] : false,
253
253
  source_Interface: (_modelAttributeMap$so = modelAttributeMap.source_id) !== null && _modelAttributeMap$so !== void 0 && _modelAttributeMap$so.userVisible ? (_attributeMap$source_ = attributeMap.source_id_object) === null || _attributeMap$source_ === void 0 ? void 0 : _attributeMap$source_.displayName : false,
254
- destination_Interface: (_modelAttributeMap$de = modelAttributeMap.destination_id) !== null && _modelAttributeMap$de !== void 0 && _modelAttributeMap$de.userVisible ? (_attributeMap$destina = attributeMap.destination_id_object) === null || _attributeMap$destina === void 0 ? void 0 : _attributeMap$destina.displayName : false
254
+ destination_Interface: (_modelAttributeMap$de = modelAttributeMap.destination_id) !== null && _modelAttributeMap$de !== void 0 && _modelAttributeMap$de.userVisible ? (_attributeMap$destina = attributeMap.destination_id_object) === null || _attributeMap$destina === void 0 ? void 0 : _attributeMap$destina.displayName : false,
255
+ 'network_link.connect_type': (_modelAttributeMap$ne = modelAttributeMap['network_link.connect_type']) !== null && _modelAttributeMap$ne !== void 0 && _modelAttributeMap$ne.userVisible ? connect_type : false
255
256
  }); // 资源/链路-关键指标 数据 metrics,模型 topo.ciTyeCache.getCiType(ciType)
256
257
 
257
258
  setIndicator(displayMetricModels.map(function (item) {
@@ -264,7 +265,7 @@ function ResourceOverview(props) {
264
265
 
265
266
  getAlarmRiskData(id);
266
267
 
267
- case 26:
268
+ case 25:
268
269
  case "end":
269
270
  return _context.stop();
270
271
  }
@@ -673,7 +674,8 @@ function ResourceOverview(props) {
673
674
  data: data,
674
675
  ciAttrAndMetricData: ciAttrAndMetricData
675
676
  },
676
- data: indicator
677
+ data: indicator,
678
+ loading: metricInitLoading
677
679
  })), /*#__PURE__*/_react["default"].createElement(_BlockBox["default"], {
678
680
  headerTitle: "\u6700\u8FD1\u7684\u544A\u8B66\u548C\u98CE\u9669"
679
681
  }, /*#__PURE__*/_react["default"].createElement("div", {