@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
@@ -148,6 +148,10 @@ var CiTyeCache = /*#__PURE__*/function () {
148
148
  if (type.id === connectType) {
149
149
  var metrics = ciType.metrics // 物理链路移除:ping状态、专线连通状态
150
150
  .filter(function (metric) {
151
+ if (connectType === 'exit') {
152
+ return true;
153
+ }
154
+
151
155
  return ['network_dedicated_line_status', 'ping_status'].indexOf(metric.code) === -1;
152
156
  }) // 按链路类型过滤对应指标
153
157
  .filter(function (metric) {
@@ -1,29 +1,70 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import topoService from "@riil-frontend/component-topology-common/es/services/topo";
5
5
  import keyBy from "lodash/keyBy";
6
- import { queryCisByIds } from "../../services";
7
- var interfaceTypeMap = {
8
- "network.interface": {
9
- displayName: "网络接口"
10
- },
11
- "network.agg_interface": {
12
- displayName: "聚合接口"
13
- }
14
- };
6
+ import _ from "lodash";
7
+ import { queryCisByIds, queryModelAsset } from "../../services"; // const interfaceTypeMap = {
8
+ // "network.interface": {
9
+ // displayName: "网络接口",
10
+ // },
11
+ // "network.agg_interface": {
12
+ // displayName: "聚合接口",
13
+ // },
14
+ // };
15
+
15
16
  export function isAggLink(link) {
16
17
  return link.attributes["network_link.connect_type"] === "agg";
17
18
  }
18
- export function mergeLinksData(links, linkCis, nodes, interfaceCis) {
19
+ export var getInterfaceObject = /*#__PURE__*/function () {
20
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(codes) {
21
+ var query, promises, result, ifDoc;
22
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
23
+ while (1) {
24
+ switch (_context.prev = _context.next) {
25
+ case 0:
26
+ query = _.compact(_.uniq(codes));
27
+ promises = query.map(queryModelAsset);
28
+ _context.next = 4;
29
+ return Promise.all(promises);
30
+
31
+ case 4:
32
+ result = _context.sent;
33
+ ifDoc = {};
34
+ result.map(function (ifItem) {
35
+ ifDoc[ifItem.code] = {
36
+ displayName: ifItem.displayName
37
+ };
38
+ });
39
+ return _context.abrupt("return", ifDoc);
40
+
41
+ case 8:
42
+ case "end":
43
+ return _context.stop();
44
+ }
45
+ }
46
+ }, _callee);
47
+ }));
48
+
49
+ return function getInterfaceObject(_x) {
50
+ return _ref.apply(this, arguments);
51
+ };
52
+ }();
53
+ export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
19
54
  var linkCiMap = keyBy(linkCis, "id");
20
55
  return links.map(function (link) {
21
- var _nodes$find, _nodes$find2, _interfaceCis$find, _interfaceCis$find2;
56
+ var _interfaceCis$find, _interfaceCis$find2;
22
57
 
23
58
  var linkCi = linkCiMap[link.id];
24
59
 
25
- var attributes = _extends({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes); // 翻译
60
+ var attributes = _extends({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes);
26
61
 
62
+ var sourceNode = nodes.find(function (node) {
63
+ return node.id === attributes["network_link.source_device_id"];
64
+ });
65
+ var targetNode = nodes.find(function (node) {
66
+ return node.id === attributes["network_link.destination_device_id"];
67
+ }); // 翻译
27
68
 
28
69
  return _extends({}, link, {
29
70
  id: linkCi.id,
@@ -32,18 +73,14 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCis) {
32
73
  attributes: _extends({}, attributes, {
33
74
  // 源/目的设备
34
75
  "network_link.source_device_id_object": {
35
- displayName: (_nodes$find = nodes.find(function (node) {
36
- return node.id === attributes["network_link.source_device_id"];
37
- })) === null || _nodes$find === void 0 ? void 0 : _nodes$find.name
76
+ displayName: sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.name
38
77
  },
39
78
  "network_link.destination_device_id_object": {
40
- displayName: (_nodes$find2 = nodes.find(function (node) {
41
- return node.id === attributes["network_link.destination_device_id"];
42
- })) === null || _nodes$find2 === void 0 ? void 0 : _nodes$find2.name
79
+ displayName: targetNode === null || targetNode === void 0 ? void 0 : targetNode.name
43
80
  },
44
81
  // 源/目的接口类型
45
- source_type_object: interfaceTypeMap[attributes.source_type],
46
- destination_type_object: interfaceTypeMap[attributes.destination_type],
82
+ source_type_object: interfaceDoc[attributes.source_type],
83
+ destination_type_object: interfaceDoc[attributes.destination_type],
47
84
  // 源/目的接口
48
85
  source_id_object: {
49
86
  displayName: (_interfaceCis$find = interfaceCis.find(function (node) {
@@ -59,50 +96,58 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCis) {
59
96
  });
60
97
  });
61
98
  }
62
- export function getLinksDetail(_x, _x2) {
99
+ export function getLinksDetail(_x2, _x3) {
63
100
  return _getLinksDetail.apply(this, arguments);
64
101
  }
65
102
 
66
103
  function _getLinksDetail() {
67
- _getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(links, nodes) {
68
- var linkCis, interfaceIds, interfaceCis;
69
- return _regeneratorRuntime.wrap(function _callee$(_context) {
104
+ _getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(links, nodes) {
105
+ var linkCis, interfaceIds, interfaceTypes, interfaceCis, interfaceDoc;
106
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
70
107
  while (1) {
71
- switch (_context.prev = _context.next) {
108
+ switch (_context2.prev = _context2.next) {
72
109
  case 0:
73
110
  if (!(!links || !links.length)) {
74
- _context.next = 2;
111
+ _context2.next = 2;
75
112
  break;
76
113
  }
77
114
 
78
- return _context.abrupt("return", []);
115
+ return _context2.abrupt("return", []);
79
116
 
80
117
  case 2:
81
- _context.next = 4;
118
+ _context2.next = 4;
82
119
  return topoService.relation.batchQueryRelation(links.map(function (link) {
83
120
  return link.id;
84
121
  }));
85
122
 
86
123
  case 4:
87
- linkCis = _context.sent;
88
- interfaceIds = [].concat(linkCis.map(function (item) {
89
- return item.attributes.source_id;
90
- }), linkCis.map(function (item) {
91
- return item.attributes.destination_id;
92
- }));
93
- _context.next = 8;
124
+ linkCis = _context2.sent;
125
+ interfaceIds = [];
126
+ interfaceTypes = [];
127
+ linkCis.map(function (item) {
128
+ interfaceIds.push(item.attributes.source_id);
129
+ interfaceIds.push(item.attributes.destination_id);
130
+ interfaceTypes.push(item.attributes.source_type);
131
+ interfaceTypes.push(item.attributes.destination_type);
132
+ });
133
+ _context2.next = 10;
94
134
  return queryCisByIds(interfaceIds);
95
135
 
96
- case 8:
97
- interfaceCis = _context.sent;
98
- return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis));
99
-
100
136
  case 10:
137
+ interfaceCis = _context2.sent;
138
+ _context2.next = 13;
139
+ return getInterfaceObject(interfaceTypes);
140
+
141
+ case 13:
142
+ interfaceDoc = _context2.sent;
143
+ return _context2.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
144
+
145
+ case 15:
101
146
  case "end":
102
- return _context.stop();
147
+ return _context2.stop();
103
148
  }
104
149
  }
105
- }, _callee);
150
+ }, _callee2);
106
151
  }));
107
152
  return _getLinksDetail.apply(this, arguments);
108
153
  }
@@ -32,4 +32,32 @@ function _queryCisByIds() {
32
32
  }, _callee);
33
33
  }));
34
34
  return _queryCisByIds.apply(this, arguments);
35
+ }
36
+
37
+ export function queryModelAsset(_x2) {
38
+ return _queryModelAsset.apply(this, arguments);
39
+ }
40
+
41
+ function _queryModelAsset() {
42
+ _queryModelAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(code) {
43
+ var result;
44
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
45
+ while (1) {
46
+ switch (_context2.prev = _context2.next) {
47
+ case 0:
48
+ _context2.next = 2;
49
+ return request.get("/mdc/v1/api/model-asset/" + code);
50
+
51
+ case 2:
52
+ result = _context2.sent;
53
+ return _context2.abrupt("return", result);
54
+
55
+ case 4:
56
+ case "end":
57
+ return _context2.stop();
58
+ }
59
+ }
60
+ }, _callee2);
61
+ }));
62
+ return _queryModelAsset.apply(this, arguments);
35
63
  }
@@ -0,0 +1,34 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import topoService from "@riil-frontend/component-topology-common/es/services/topo";
4
+ /**
5
+ * 增加保存拓扑序列化数据方法,以便于拓扑中心和业务拓扑使用
6
+ *
7
+ * @param {*} topo
8
+ */
9
+
10
+ export default function saveSerialize(_x) {
11
+ return _saveSerialize.apply(this, arguments);
12
+ }
13
+
14
+ function _saveSerialize() {
15
+ _saveSerialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(topo) {
16
+ var topoId, serialize;
17
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
18
+ while (1) {
19
+ switch (_context.prev = _context.next) {
20
+ case 0:
21
+ topoId = topo.getId();
22
+ serialize = topo.getHtTopo().serialize();
23
+ _context.next = 4;
24
+ return topoService.saveSerializeData(topoId, serialize);
25
+
26
+ case 4:
27
+ case "end":
28
+ return _context.stop();
29
+ }
30
+ }
31
+ }, _callee);
32
+ }));
33
+ return _saveSerialize.apply(this, arguments);
34
+ }
@@ -159,43 +159,6 @@ function ResourceDetail(props) {
159
159
  getUser();
160
160
  }
161
161
 
162
- useEffect(function () {
163
- console.log('topoData', activeData.ciType, topoModData);
164
-
165
- if (topoModData && activeData !== null && activeData !== void 0 && activeData.id) {
166
- var id = activeData.id,
167
- ciType = activeData.ciType;
168
- var ciTypeMeta;
169
-
170
- if (ciType === 'network_link') {
171
- // 网络链路要按链路类型查询属性、指标
172
- var linkGroups = topoModData.linkGroups,
173
- links = topoModData.links;
174
- var link = [].concat(linkGroups, links).find(function (item) {
175
- return item.id === id;
176
- });
177
- var linkConnectType = link.attributes['network_link.connect_type'];
178
- ciTypeMeta = topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
179
- } else {
180
- ciTypeMeta = topo.ciTyeCache.getCiType(ciType);
181
- }
182
-
183
- if (!ciTypeMeta) {
184
- return;
185
- }
186
-
187
- var _ciTypeMeta = ciTypeMeta,
188
- metrics = _ciTypeMeta.metrics; // 同步需要实时展示的指标
189
-
190
- topoDispatchers.update({
191
- id: id,
192
- metricCodes: metrics.slice(0, 6).map(function (item) {
193
- return item.code;
194
- }) // 需要展示的关键指标 code
195
-
196
- });
197
- }
198
- }, [topoModData, activeData]);
199
162
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Drawer, {
200
163
  className: styles.baseInfo,
201
164
  closeMode: ['close', 'esc'],
@@ -1,11 +1,11 @@
1
- import React from 'react';
2
- import { Link } from 'react-router-dom';
1
+ import React from "react";
2
+ import { Link } from "react-router-dom";
3
3
  import styles from "./index.module.scss"; // url 处理,UICBB 的地址需截取前缀
4
4
 
5
5
  function formatUrl(url) {
6
6
  var _window, _window$location;
7
7
 
8
- var prefix = '/default/pagecenter';
8
+ var prefix = "/default/pagecenter";
9
9
 
10
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
11
  return url.split(prefix)[1];
@@ -40,8 +40,8 @@ function BaseInfoContent(props) {
40
40
  data = props.data;
41
41
  var itemCols = {
42
42
  node: [{
43
- label: '资源名称:',
44
- objKey: 'resource',
43
+ label: "资源名称:",
44
+ objKey: "resource",
45
45
  render: function render(valueData, key) {
46
46
  var display_name = valueData.display_name,
47
47
  link = valueData.link;
@@ -52,43 +52,46 @@ function BaseInfoContent(props) {
52
52
  }, valueData ? /*#__PURE__*/React.createElement(Link, {
53
53
  className: styles.link,
54
54
  to: formatUrl(link)
55
- }, display_name || '-') : '-');
55
+ }, display_name || "-") : "-");
56
56
  }
57
57
  }, {
58
- label: 'IP地址:',
59
- objKey: 'ipv4_address'
58
+ label: "IP地址:",
59
+ objKey: "ipv4_address"
60
60
  }, {
61
- label: '资产编号:',
62
- objKey: 'asset_number'
61
+ label: "资产编号:",
62
+ objKey: "asset_number"
63
63
  }, {
64
- label: '资源类型:',
65
- objKey: 'ciName'
64
+ label: "资源类型:",
65
+ objKey: "ciName"
66
66
  }, {
67
- label: '资源位置:',
68
- objKey: 'res_address'
67
+ label: "资源位置:",
68
+ objKey: "res_address"
69
69
  } // {
70
70
  // label: '负责人:',
71
71
  // objKey: 'principal'
72
72
  // },
73
73
  ],
74
74
  link: [{
75
- label: '链路带宽:',
76
- objKey: 'rated_bandwidth',
75
+ label: "链路带宽:",
76
+ objKey: "rated_bandwidth",
77
77
  style: {
78
- width: '100%'
78
+ width: "100%"
79
79
  }
80
80
  }, {
81
- label: '源IP地址:',
82
- objKey: 'source_ipv4'
81
+ label: "源IP地址:",
82
+ objKey: "source_ipv4"
83
83
  }, {
84
- label: '目的IP地址:',
85
- objKey: 'destination_ipv4'
84
+ label: "目的IP地址:",
85
+ objKey: "destination_ipv4"
86
86
  }, {
87
- label: '源端口:',
88
- objKey: 'source_Interface'
87
+ label: "源端口:",
88
+ objKey: "source_Interface"
89
89
  }, {
90
- label: '目的端口:',
91
- objKey: 'destination_Interface'
90
+ label: "目的端口:",
91
+ objKey: "destination_Interface"
92
+ }, {
93
+ label: "连接方式:",
94
+ objKey: "network_link.connect_type"
92
95
  }]
93
96
  };
94
97
  return /*#__PURE__*/React.createElement(React.Fragment, null, (_itemCols$type = itemCols[type]) === null || _itemCols$type === void 0 ? void 0 : _itemCols$type.map(function (_ref, key) {
@@ -96,12 +99,12 @@ function BaseInfoContent(props) {
96
99
  objKey = _ref.objKey,
97
100
  style = _ref.style,
98
101
  render = _ref.render;
99
- return data[objKey] === false ? '' : render ? render(data[objKey], key) : /*#__PURE__*/React.createElement(AttributeItem, {
102
+ return data[objKey] === false ? "" : render ? render(data[objKey], key) : /*#__PURE__*/React.createElement(AttributeItem, {
100
103
  key: key,
101
104
  label: label,
102
105
  style: style || {},
103
106
  contentTitle: data[objKey]
104
- }, data[objKey] || '-');
107
+ }, data[objKey] || "-");
105
108
  }));
106
109
  } // 基本信息
107
110
 
@@ -126,6 +129,6 @@ export default function BaseInfo(props) {
126
129
  }
127
130
 
128
131
  return /*#__PURE__*/React.createElement("div", {
129
- className: styles['base-info']
132
+ className: styles["base-info"]
130
133
  }, content);
131
134
  }
@@ -15,6 +15,7 @@ import alarmService from "../../../../../../services/alarm";
15
15
  import service from "../../../../../../services/overview";
16
16
  import BaseInfoBlock from "./BaseInfoBlock";
17
17
  import BlockBox from "./BlockBox";
18
+ import useMetricModels from "./hooks/useMetricModels";
18
19
  import styles from "./index.module.scss";
19
20
  import ResourceOverviewMetric from "./ResourceOverviewMetric";
20
21
  import useCiAttrAndMetricData from "./useCiAttrAndMetricData"; // url 处理,UICBB 的地址需截取前缀
@@ -45,9 +46,7 @@ export default function ResourceOverview(props) {
45
46
  userId = props.userId,
46
47
  viewerProps = props.viewerProps;
47
48
  var resourceOverviewProps = (viewerProps === null || viewerProps === void 0 ? void 0 : (_viewerProps$resource = viewerProps.resourceDetailProps) === null || _viewerProps$resource === void 0 ? void 0 : _viewerProps$resource.resourceOverviewProps) || {};
48
- var data = useMemo(function () {
49
- return topo.dataModel.getDataById(id);
50
- }, [id]);
49
+ var data = topo.dataModel.useDataById(id);
51
50
  var ciAttrAndMetricData = useCiAttrAndMetricData({
52
51
  topo: topo,
53
52
  id: id
@@ -79,7 +78,9 @@ export default function ResourceOverview(props) {
79
78
  // 目的IP地址
80
79
  source_Interface: '',
81
80
  // 源端口
82
- destination_Interface: '' // 目的端口
81
+ destination_Interface: '',
82
+ // 目的端口,
83
+ 'network_link.connect_type': '' // 连接方式,
83
84
 
84
85
  }),
85
86
  baseInfo = _useState[0],
@@ -111,9 +112,26 @@ export default function ResourceOverview(props) {
111
112
 
112
113
  return typeMeta;
113
114
  }, [id]);
115
+
116
+ var _useMetricModels = useMetricModels({
117
+ data: {
118
+ type: type,
119
+ id: id,
120
+ ciType: ciType
121
+ },
122
+ isMonite: data.manageStatus !== 0,
123
+ ciTypeMeta: ciTypeMeta,
124
+ topo: topo,
125
+ resourceOverviewProps: resourceOverviewProps
126
+ }),
127
+ monitorMetricModels = _useMetricModels.metricModels,
128
+ metricInitLoading = _useMetricModels.initLoading;
129
+
114
130
  useEffect(function () {
115
- init();
116
- }, [ciAttrAndMetricData, ciTypeMeta, id]);
131
+ if (monitorMetricModels) {
132
+ init();
133
+ }
134
+ }, [ciAttrAndMetricData, ciTypeMeta, monitorMetricModels, id]);
117
135
 
118
136
  function init() {
119
137
  return _init.apply(this, arguments);
@@ -121,79 +139,59 @@ export default function ResourceOverview(props) {
121
139
 
122
140
  function _init() {
123
141
  _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
124
- 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;
142
+ 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;
125
143
 
126
- var modelMetrics, ciName, modelAttributeMap, domain, displayMetricModels, metricCodes, isAppTopoFlag, attributeMap, metrics, res_address, _attributeMap$, rated_bandwidth, _modelAttributeMap$4;
144
+ var displayMetricModels, ciName, modelAttributeMap, domain, isAppTopoFlag, attributeMap, metrics, res_address, _attributeMap$, rated_bandwidth, _modelAttributeMap$4, connect_type;
127
145
 
128
146
  return _regeneratorRuntime.wrap(function _callee$(_context) {
129
147
  while (1) {
130
148
  switch (_context.prev = _context.next) {
131
149
  case 0:
132
- console.log('初始化/更新概览 props', props); // 指标模型
133
-
134
- modelMetrics = ciTypeMeta.metrics, ciName = ciTypeMeta.displayName, modelAttributeMap = ciTypeMeta.attributeMap, domain = ciTypeMeta.domain;
135
- displayMetricModels = modelMetrics.slice(0, 6);
150
+ console.log('初始化/更新概览 props', props);
151
+ displayMetricModels = monitorMetricModels; // 指标模型
136
152
 
137
- if (resourceOverviewProps !== null && resourceOverviewProps !== void 0 && resourceOverviewProps.getMetricCodes) {
138
- metricCodes = resourceOverviewProps === null || resourceOverviewProps === void 0 ? void 0 : resourceOverviewProps.getMetricCodes({
139
- id: id,
140
- type: type,
141
- ciType: ciType
142
- });
143
-
144
- if (metricCodes) {
145
- displayMetricModels = metricCodes.map(function (code) {
146
- return modelMetrics.find(function (item) {
147
- return item.code === code;
148
- });
149
- }).filter(function (item) {
150
- return !!item;
151
- });
152
- }
153
- }
154
-
155
- displayMetricModels = displayMetricModels.slice(0, 6); // 应用拓扑处理
153
+ ciName = ciTypeMeta.displayName, modelAttributeMap = ciTypeMeta.attributeMap, domain = ciTypeMeta.domain; // 应用拓扑处理
156
154
 
157
155
  isAppTopoFlag = !!((_topo$options$resourc = topo.options.resourceOverviewDrawer) !== null && _topo$options$resourc !== void 0 && _topo$options$resourc.getData);
158
156
  console.log('应用拓扑判断', topo, isAppTopoFlag);
159
157
  setIsAppTopo(isAppTopoFlag);
160
158
 
161
159
  if (!isAppTopoFlag) {
162
- _context.next = 11;
160
+ _context.next = 9;
163
161
  break;
164
162
  }
165
163
 
166
164
  initAppTopo(displayMetricModels, modelAttributeMap, ciName, domain);
167
165
  return _context.abrupt("return");
168
166
 
169
- case 11:
167
+ case 9:
170
168
  // 拓扑(默认) ---------------------------
171
169
  // 基本信息
172
170
  attributeMap = ciAttrAndMetricData.attributeMap, metrics = ciAttrAndMetricData.metrics;
173
- console.log('基本信息', attributeMap, modelAttributeMap); // userVisible
171
+ console.log('基本信息x', attributeMap, modelAttributeMap); // userVisible
174
172
  // 位置
175
173
 
176
174
  res_address = false;
177
175
 
178
176
  if (!((_modelAttributeMap$ow = modelAttributeMap.owned_computer_room) !== null && _modelAttributeMap$ow !== void 0 && _modelAttributeMap$ow.userVisible)) {
179
- _context.next = 20;
177
+ _context.next = 18;
180
178
  break;
181
179
  }
182
180
 
183
- _context.next = 17;
181
+ _context.next = 15;
184
182
  return getAddressFormat(attributeMap);
185
183
 
186
- case 17:
184
+ case 15:
187
185
  res_address = _context.sent;
188
- _context.next = 21;
186
+ _context.next = 19;
189
187
  break;
190
188
 
191
- case 20:
189
+ case 18:
192
190
  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) {
193
191
  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;
194
192
  }
195
193
 
196
- case 21:
194
+ case 19:
197
195
  // 链路带宽(取实际带宽)
198
196
  rated_bandwidth = false;
199
197
 
@@ -201,6 +199,7 @@ export default function ResourceOverview(props) {
201
199
  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) : '';
202
200
  }
203
201
 
202
+ connect_type = attributeMap['network_link.connect_type'] === 'exit' ? '出口' : '物理/聚合';
204
203
  setBaseInfo({
205
204
  // 资源
206
205
  // display_name: modelAttributeMap['display_name'] ? attributeMap.display_name : false,
@@ -220,7 +219,8 @@ export default function ResourceOverview(props) {
220
219
  source_ipv4: (_modelAttributeMap$5 = modelAttributeMap[ciType + ".source_ipv4"]) !== null && _modelAttributeMap$5 !== void 0 && _modelAttributeMap$5.userVisible ? attributeMap[ciType + ".source_ipv4"] : false,
221
220
  destination_ipv4: (_modelAttributeMap$6 = modelAttributeMap[ciType + ".destination_ipv4"]) !== null && _modelAttributeMap$6 !== void 0 && _modelAttributeMap$6.userVisible ? attributeMap[ciType + ".destination_ipv4"] : false,
222
221
  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,
223
- 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
222
+ 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,
223
+ 'network_link.connect_type': (_modelAttributeMap$ne = modelAttributeMap['network_link.connect_type']) !== null && _modelAttributeMap$ne !== void 0 && _modelAttributeMap$ne.userVisible ? connect_type : false
224
224
  }); // 资源/链路-关键指标 数据 metrics,模型 topo.ciTyeCache.getCiType(ciType)
225
225
 
226
226
  setIndicator(displayMetricModels.map(function (item) {
@@ -233,7 +233,7 @@ export default function ResourceOverview(props) {
233
233
 
234
234
  getAlarmRiskData(id);
235
235
 
236
- case 26:
236
+ case 25:
237
237
  case "end":
238
238
  return _context.stop();
239
239
  }
@@ -642,7 +642,8 @@ export default function ResourceOverview(props) {
642
642
  data: data,
643
643
  ciAttrAndMetricData: ciAttrAndMetricData
644
644
  },
645
- data: indicator
645
+ data: indicator,
646
+ loading: metricInitLoading
646
647
  })), /*#__PURE__*/React.createElement(BlockBox, {
647
648
  headerTitle: "\u6700\u8FD1\u7684\u544A\u8B66\u548C\u98CE\u9669"
648
649
  }, /*#__PURE__*/React.createElement("div", {