@riil-frontend/component-topology 11.0.30 → 11.0.31

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 (217) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.css +2 -4
  4. package/build/index.js +34 -49
  5. package/es/components/MultiResourceDrawer/index.js +18 -16
  6. package/es/components/ResourceList/ResourceSelect.js +50 -48
  7. package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +26 -24
  8. package/es/components/SingleResourceDrawer/SelectDrawer.js +20 -18
  9. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +25 -23
  10. package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +84 -78
  11. package/es/core/components/titlebar/widgets/TitleWidget.js +3 -5
  12. package/es/core/editor/components/BackgroundView/UploadDialog/index.js +17 -15
  13. package/es/core/editor/components/BackgroundView/index.js +129 -119
  14. package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +22 -20
  15. package/es/core/editor/components/CustomIconPlugin/UploadIconDialog.js +33 -31
  16. package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +17 -15
  17. package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +9 -7
  18. package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +41 -37
  19. package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +54 -50
  20. package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +54 -50
  21. package/es/core/editor/components/Toolbar/widgets/IconSelect/index.module.scss +1 -1
  22. package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +13 -11
  23. package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +23 -21
  24. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +17 -15
  25. package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +12 -10
  26. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +27 -21
  27. package/es/core/editor/hooks/useKeyboardShortcut.js +2 -2
  28. package/es/core/editor/hooks/useNewElementTheme.js +2 -2
  29. package/es/core/editor/store/background.js +10 -8
  30. package/es/core/editor/store/topoEdit.js +6 -4
  31. package/es/core/editor/utils/edgeTypeStyleUtil.js +4 -2
  32. package/es/core/hooks/usePolling.js +121 -117
  33. package/es/core/hooks/useResourceConfig.js +66 -58
  34. package/es/core/hooks/useTopoEdit.js +511 -476
  35. package/es/core/models/Alarm.js +298 -281
  36. package/es/core/models/AttributeMetricDisplay.js +107 -101
  37. package/es/core/models/PluginManager.js +3 -4
  38. package/es/core/models/SelectionModel.js +5 -4
  39. package/es/core/models/TopoApp.js +240 -205
  40. package/es/core/models/TopoGraphView.js +21 -18
  41. package/es/core/models/cache/CiCache.js +27 -28
  42. package/es/core/models/cache/CiTypeCache.js +41 -37
  43. package/es/core/models/cache/DictCache.js +35 -33
  44. package/es/core/models/graph/Background.js +17 -15
  45. package/es/core/models/plugins/resourceWebControllUrl.js +82 -76
  46. package/es/core/models/tagstips/ElementTagTipConfig.js +38 -34
  47. package/es/core/models/topoData.js +70 -68
  48. package/es/core/models/utils/linkUtils.js +43 -41
  49. package/es/core/models/utils/nodeNameVisibleUtil.js +4 -4
  50. package/es/core/services/alarm.js +16 -14
  51. package/es/core/services/background.js +67 -59
  52. package/es/core/services/cmdb/metric.js +11 -9
  53. package/es/core/services/cmdb.js +20 -18
  54. package/es/core/services/index.js +45 -39
  55. package/es/core/services/overview.js +151 -131
  56. package/es/core/services/topo/basic.js +13 -11
  57. package/es/core/services/topo/tagtip.js +12 -10
  58. package/es/core/store/models/ciModel.js +62 -58
  59. package/es/core/store/models/customIcon.js +134 -120
  60. package/es/core/store/models/displayConfig.js +19 -15
  61. package/es/core/store/models/selection.js +6 -4
  62. package/es/core/store/models/topoAlarm.js +145 -162
  63. package/es/core/store/models/topoBaseInfoOverview.js +6 -4
  64. package/es/core/store/models/topoBizMod.js +32 -28
  65. package/es/core/store/models/topoConfig.js +231 -215
  66. package/es/core/store/models/topoGraphView.js +6 -4
  67. package/es/core/store/models/topoMod.js +395 -373
  68. package/es/core/utils/imageUtil.js +20 -18
  69. package/es/core/utils/saveSerialize.js +11 -9
  70. package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +58 -56
  71. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +17 -15
  72. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +357 -343
  73. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +92 -86
  74. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +41 -39
  75. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +205 -189
  76. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +109 -107
  77. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +59 -57
  78. package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +37 -33
  79. package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +29 -25
  80. package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -32
  81. package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +19 -17
  82. package/es/networkTopo/components/Link/hook.js +77 -73
  83. package/es/networkTopo/components/Link/index.js +94 -86
  84. package/es/networkTopo/components/Link/setting.js +44 -42
  85. package/es/networkTopo/getTopoData.js +69 -63
  86. package/es/networkTopo/hooks/viewer/useRelateTopo.js +32 -30
  87. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
  88. package/es/networkTopo/models/TopoCenter.js +22 -18
  89. package/es/networkTopo/services/alert.js +22 -18
  90. package/es/networkTopo/services/authorization.js +55 -45
  91. package/es/networkTopo/services/cmdb.js +470 -422
  92. package/es/networkTopo/services/funcAuth.js +24 -22
  93. package/es/networkTopo/services/link.js +117 -107
  94. package/es/networkTopo/services/mdc.js +24 -18
  95. package/es/networkTopo/services/metric.js +27 -23
  96. package/es/networkTopo/services/model.js +509 -445
  97. package/es/networkTopo/services/risk.js +11 -9
  98. package/es/networkTopo/services/topo/auth.js +33 -27
  99. package/es/networkTopo/services/topo/basic.js +314 -274
  100. package/es/networkTopo/services/topo/blacklist.js +24 -20
  101. package/es/networkTopo/services/topo/ciInfo.js +31 -27
  102. package/es/networkTopo/services/topo/icon.js +59 -49
  103. package/es/networkTopo/services/topo/networkLink.js +36 -32
  104. package/es/networkTopo/services/topo/relation.js +11 -9
  105. package/es/networkTopo/services/topo/resourceWebUrl.js +42 -36
  106. package/es/networkTopo/store/functionAuth.js +37 -31
  107. package/es/networkTopo/store/topoCenter.js +152 -142
  108. package/es/networkTopo/store/topoLinkMod.js +6 -4
  109. package/es/networkTopo/store/topoTreeMod.js +182 -170
  110. package/es/networkTopo/utils/exportData.js +54 -52
  111. package/lib/components/MultiResourceDrawer/index.js +18 -16
  112. package/lib/components/ResourceList/ResourceSelect.js +50 -48
  113. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +29 -27
  114. package/lib/components/SingleResourceDrawer/SelectDrawer.js +20 -18
  115. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +32 -30
  116. package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +84 -78
  117. package/lib/core/components/titlebar/widgets/TitleWidget.js +3 -5
  118. package/lib/core/editor/components/BackgroundView/UploadDialog/index.js +17 -15
  119. package/lib/core/editor/components/BackgroundView/index.js +128 -118
  120. package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +24 -22
  121. package/lib/core/editor/components/CustomIconPlugin/UploadIconDialog.js +33 -31
  122. package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +21 -19
  123. package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +10 -8
  124. package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +41 -37
  125. package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +54 -50
  126. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +54 -50
  127. package/lib/core/editor/components/Toolbar/widgets/IconSelect/index.module.scss +1 -1
  128. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +14 -12
  129. package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +28 -26
  130. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +17 -15
  131. package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +14 -12
  132. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +31 -25
  133. package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -2
  134. package/lib/core/editor/hooks/useNewElementTheme.js +2 -2
  135. package/lib/core/editor/store/background.js +10 -8
  136. package/lib/core/editor/store/topoEdit.js +6 -4
  137. package/lib/core/editor/utils/edgeTypeStyleUtil.js +4 -2
  138. package/lib/core/hooks/usePolling.js +120 -116
  139. package/lib/core/hooks/useResourceConfig.js +66 -58
  140. package/lib/core/hooks/useTopoEdit.js +503 -468
  141. package/lib/core/models/Alarm.js +292 -275
  142. package/lib/core/models/AttributeMetricDisplay.js +110 -104
  143. package/lib/core/models/PluginManager.js +3 -4
  144. package/lib/core/models/SelectionModel.js +5 -4
  145. package/lib/core/models/TopoApp.js +240 -205
  146. package/lib/core/models/TopoGraphView.js +21 -18
  147. package/lib/core/models/cache/CiCache.js +32 -33
  148. package/lib/core/models/cache/CiTypeCache.js +42 -38
  149. package/lib/core/models/cache/DictCache.js +35 -33
  150. package/lib/core/models/graph/Background.js +18 -16
  151. package/lib/core/models/plugins/resourceWebControllUrl.js +80 -74
  152. package/lib/core/models/tagstips/ElementTagTipConfig.js +38 -34
  153. package/lib/core/models/topoData.js +71 -69
  154. package/lib/core/models/utils/linkUtils.js +43 -41
  155. package/lib/core/models/utils/nodeNameVisibleUtil.js +4 -4
  156. package/lib/core/services/alarm.js +20 -18
  157. package/lib/core/services/background.js +78 -70
  158. package/lib/core/services/cmdb/metric.js +12 -10
  159. package/lib/core/services/cmdb.js +22 -20
  160. package/lib/core/services/index.js +51 -45
  161. package/lib/core/services/overview.js +151 -131
  162. package/lib/core/services/topo/basic.js +15 -13
  163. package/lib/core/services/topo/tagtip.js +14 -12
  164. package/lib/core/store/models/ciModel.js +70 -66
  165. package/lib/core/store/models/customIcon.js +134 -120
  166. package/lib/core/store/models/displayConfig.js +19 -15
  167. package/lib/core/store/models/selection.js +6 -4
  168. package/lib/core/store/models/topoAlarm.js +145 -163
  169. package/lib/core/store/models/topoBaseInfoOverview.js +6 -4
  170. package/lib/core/store/models/topoBizMod.js +38 -34
  171. package/lib/core/store/models/topoConfig.js +238 -222
  172. package/lib/core/store/models/topoGraphView.js +6 -4
  173. package/lib/core/store/models/topoMod.js +397 -375
  174. package/lib/core/utils/imageUtil.js +24 -22
  175. package/lib/core/utils/saveSerialize.js +11 -9
  176. package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +58 -56
  177. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +17 -15
  178. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +358 -344
  179. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +92 -86
  180. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +41 -39
  181. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +206 -190
  182. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +109 -107
  183. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +59 -57
  184. package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +33 -29
  185. package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +29 -25
  186. package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -32
  187. package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +20 -18
  188. package/lib/networkTopo/components/Link/hook.js +77 -73
  189. package/lib/networkTopo/components/Link/index.js +95 -87
  190. package/lib/networkTopo/components/Link/setting.js +44 -42
  191. package/lib/networkTopo/getTopoData.js +69 -63
  192. package/lib/networkTopo/hooks/viewer/useRelateTopo.js +33 -31
  193. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
  194. package/lib/networkTopo/models/TopoCenter.js +22 -18
  195. package/lib/networkTopo/services/alert.js +22 -18
  196. package/lib/networkTopo/services/authorization.js +65 -55
  197. package/lib/networkTopo/services/cmdb.js +470 -422
  198. package/lib/networkTopo/services/funcAuth.js +26 -24
  199. package/lib/networkTopo/services/link.js +118 -108
  200. package/lib/networkTopo/services/mdc.js +27 -21
  201. package/lib/networkTopo/services/metric.js +31 -27
  202. package/lib/networkTopo/services/model.js +509 -445
  203. package/lib/networkTopo/services/risk.js +13 -11
  204. package/lib/networkTopo/services/topo/auth.js +33 -27
  205. package/lib/networkTopo/services/topo/basic.js +317 -277
  206. package/lib/networkTopo/services/topo/blacklist.js +24 -20
  207. package/lib/networkTopo/services/topo/ciInfo.js +38 -34
  208. package/lib/networkTopo/services/topo/icon.js +69 -59
  209. package/lib/networkTopo/services/topo/networkLink.js +36 -32
  210. package/lib/networkTopo/services/topo/relation.js +13 -11
  211. package/lib/networkTopo/services/topo/resourceWebUrl.js +50 -44
  212. package/lib/networkTopo/store/functionAuth.js +37 -31
  213. package/lib/networkTopo/store/topoCenter.js +152 -142
  214. package/lib/networkTopo/store/topoLinkMod.js +6 -4
  215. package/lib/networkTopo/store/topoTreeMod.js +178 -166
  216. package/lib/networkTopo/utils/exportData.js +61 -59
  217. package/package.json +3 -3
@@ -13,18 +13,20 @@ function _queryAssetModel() {
13
13
  _queryAssetModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(code) {
14
14
  var result;
15
15
  return _regeneratorRuntime.wrap(function _callee$(_context) {
16
- while (1) switch (_context.prev = _context.next) {
17
- case 0:
18
- _context.next = 2;
19
- return request.get("/mdc/v1/api/model-asset/" + code);
20
-
21
- case 2:
22
- result = _context.sent;
23
- return _context.abrupt("return", result);
24
-
25
- case 4:
26
- case "end":
27
- return _context.stop();
16
+ while (1) {
17
+ switch (_context.prev = _context.next) {
18
+ case 0:
19
+ _context.next = 2;
20
+ return request.get("/mdc/v1/api/model-asset/" + code);
21
+
22
+ case 2:
23
+ result = _context.sent;
24
+ return _context.abrupt("return", result);
25
+
26
+ case 4:
27
+ case "end":
28
+ return _context.stop();
29
+ }
28
30
  }
29
31
  }, _callee);
30
32
  }));
@@ -45,13 +47,15 @@ export function queryLatestMetrics(_x2) {
45
47
  function _queryLatestMetrics() {
46
48
  _queryLatestMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(params) {
47
49
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
48
- while (1) switch (_context2.prev = _context2.next) {
49
- case 0:
50
- return _context2.abrupt("return", request.post('/mdc/v1/api/cmdb/metric/queryLatestMetrics', params));
51
-
52
- case 1:
53
- case "end":
54
- return _context2.stop();
50
+ while (1) {
51
+ switch (_context2.prev = _context2.next) {
52
+ case 0:
53
+ return _context2.abrupt("return", request.post('/mdc/v1/api/cmdb/metric/queryLatestMetrics', params));
54
+
55
+ case 1:
56
+ case "end":
57
+ return _context2.stop();
58
+ }
55
59
  }
56
60
  }, _callee2);
57
61
  }));
@@ -68,55 +72,57 @@ function _queryLinkLatestMetrics() {
68
72
 
69
73
  var linkMetrics, resultData;
70
74
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
71
- while (1) switch (_context3.prev = _context3.next) {
72
- case 0:
73
- rlog.debug('链路拓扑指标轮询 queryLinkLatestMetrics', linkCi, linkMetricCodes);
74
-
75
- if (linkMetricCodes.length) {
76
- _context3.next = 3;
77
- break;
78
- }
79
-
80
- return _context3.abrupt("return", {
81
- linkMetrics: [],
82
- linkMetricsTs: undefined
83
- });
84
-
85
- case 3:
86
- _context3.next = 5;
87
- return queryLatestMetrics({
88
- ciId: [linkCi.id],
89
- 'metricCode': linkMetricCodes
90
- });
91
-
92
- case 5:
93
- linkMetrics = _context3.sent;
94
- _context3.next = 8;
95
- return ciTypeCache.load([linkCi.ciType || linkCi.typeCode]);
96
-
97
- case 8:
98
- // format
99
- resultData = linkMetricCodes.map(function (code) {
100
- var metric = linkMetrics.find(function (m) {
101
- return m.metricCode === code;
75
+ while (1) {
76
+ switch (_context3.prev = _context3.next) {
77
+ case 0:
78
+ rlog.debug('链路拓扑指标轮询 queryLinkLatestMetrics', linkCi, linkMetricCodes);
79
+
80
+ if (linkMetricCodes.length) {
81
+ _context3.next = 3;
82
+ break;
83
+ }
84
+
85
+ return _context3.abrupt("return", {
86
+ linkMetrics: [],
87
+ linkMetricsTs: undefined
102
88
  });
103
- var value = metric === null || metric === void 0 ? void 0 : metric.metricValue;
104
- var metricDef = ciTypeCache.getMetric(linkCi.ciType || linkCi.typeCode, code);
105
- return {
106
- code: code,
107
- name: metricDef.name,
108
- value: formatMetric(value, metricDef) || '',
109
- ts: metric === null || metric === void 0 ? void 0 : metric.ts
110
- };
111
- });
112
- return _context3.abrupt("return", {
113
- linkMetrics: resultData,
114
- linkMetricsTs: (_linkMetrics$ = linkMetrics[0]) === null || _linkMetrics$ === void 0 ? void 0 : _linkMetrics$.ts
115
- });
116
-
117
- case 10:
118
- case "end":
119
- return _context3.stop();
89
+
90
+ case 3:
91
+ _context3.next = 5;
92
+ return queryLatestMetrics({
93
+ ciId: [linkCi.id],
94
+ 'metricCode': linkMetricCodes
95
+ });
96
+
97
+ case 5:
98
+ linkMetrics = _context3.sent;
99
+ _context3.next = 8;
100
+ return ciTypeCache.load([linkCi.ciType || linkCi.typeCode]);
101
+
102
+ case 8:
103
+ // format
104
+ resultData = linkMetricCodes.map(function (code) {
105
+ var metric = linkMetrics.find(function (m) {
106
+ return m.metricCode === code;
107
+ });
108
+ var value = metric === null || metric === void 0 ? void 0 : metric.metricValue;
109
+ var metricDef = ciTypeCache.getMetric(linkCi.ciType || linkCi.typeCode, code);
110
+ return {
111
+ code: code,
112
+ name: metricDef.name,
113
+ value: formatMetric(value, metricDef) || '',
114
+ ts: metric === null || metric === void 0 ? void 0 : metric.ts
115
+ };
116
+ });
117
+ return _context3.abrupt("return", {
118
+ linkMetrics: resultData,
119
+ linkMetricsTs: (_linkMetrics$ = linkMetrics[0]) === null || _linkMetrics$ === void 0 ? void 0 : _linkMetrics$.ts
120
+ });
121
+
122
+ case 10:
123
+ case "end":
124
+ return _context3.stop();
125
+ }
120
126
  }
121
127
  }, _callee3);
122
128
  }));
@@ -136,69 +142,71 @@ function _queryLinkInterfacesLatestMetrics() {
136
142
  var _linkCi$attributes, sourceType, sourceId, destinationId, destinationType, typeCodes, queryInterfaceMetricsParam, interfaceMetrics, resultData, findMetricsBySubCiId, parseInterfaceMetrics;
137
143
 
138
144
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
139
- while (1) switch (_context4.prev = _context4.next) {
140
- case 0:
141
- parseInterfaceMetrics = function _parseInterfaceMetric(subCiId) {
142
- var metrics = findMetricsBySubCiId(subCiId);
143
- return INTERFACE_METRIC_CODES.reduce(function (res, code) {
144
- var _metrics$find;
145
-
146
- var value = (_metrics$find = metrics.find(function (m) {
147
- return m.metricCode === code;
148
- })) === null || _metrics$find === void 0 ? void 0 : _metrics$find.metricValue;
149
- var metricDef = ciTypeCache.getMetric(linkCi.ciType || linkCi.typeCode, code);
150
- var formatValue = formatMetric(value, metricDef);
151
- res[code] = formatValue === 'undefined' ? '-' : formatValue;
152
- return res;
153
- }, {});
154
- };
155
-
156
- findMetricsBySubCiId = function _findMetricsBySubCiId(subCiId) {
157
- var metrics = interfaceMetrics.filter(function (metric) {
158
- return metric.subCiId === subCiId;
159
- });
160
- return metrics;
161
- };
162
-
163
- _linkCi$attributes = linkCi.attributes, sourceType = _linkCi$attributes.source_type, sourceId = _linkCi$attributes.source_id, destinationId = _linkCi$attributes.destination_id, destinationType = _linkCi$attributes.destination_type;
164
- rlog.debug('查询链路接口指标', linkCi); // 查询指标模型
165
-
166
- typeCodes = [sourceType];
167
- queryInterfaceMetricsParam = {
168
- 'subCiId': [sourceId],
169
- 'metricCode': [].concat(INTERFACE_METRIC_CODES)
170
- };
171
-
172
- if (destinationId) {
173
- queryInterfaceMetricsParam.subCiId.push(destinationId);
174
- typeCodes.push(destinationType);
175
- }
176
-
177
- _context4.next = 9;
178
- return ciTypeCache.load(typeCodes);
179
-
180
- case 9:
181
- _context4.next = 11;
182
- return queryLatestMetrics(queryInterfaceMetricsParam);
183
-
184
- case 11:
185
- interfaceMetrics = _context4.sent;
186
- // format
187
- resultData = {
188
- sourceMetrics: parseInterfaceMetrics(sourceId),
189
- destinationMetrics: destinationId ? parseInterfaceMetrics(destinationId) : null,
190
- // 源目的接口指标原始数据。支持关键链路详情过滤最近一小时指标
191
- originMetricData: {
192
- source: findMetricsBySubCiId(sourceId),
193
- destination: destinationId ? findMetricsBySubCiId(destinationId) : []
145
+ while (1) {
146
+ switch (_context4.prev = _context4.next) {
147
+ case 0:
148
+ parseInterfaceMetrics = function _parseInterfaceMetric(subCiId) {
149
+ var metrics = findMetricsBySubCiId(subCiId);
150
+ return INTERFACE_METRIC_CODES.reduce(function (res, code) {
151
+ var _metrics$find;
152
+
153
+ var value = (_metrics$find = metrics.find(function (m) {
154
+ return m.metricCode === code;
155
+ })) === null || _metrics$find === void 0 ? void 0 : _metrics$find.metricValue;
156
+ var metricDef = ciTypeCache.getMetric(linkCi.ciType || linkCi.typeCode, code);
157
+ var formatValue = formatMetric(value, metricDef);
158
+ res[code] = formatValue === 'undefined' ? '-' : formatValue;
159
+ return res;
160
+ }, {});
161
+ };
162
+
163
+ findMetricsBySubCiId = function _findMetricsBySubCiId(subCiId) {
164
+ var metrics = interfaceMetrics.filter(function (metric) {
165
+ return metric.subCiId === subCiId;
166
+ });
167
+ return metrics;
168
+ };
169
+
170
+ _linkCi$attributes = linkCi.attributes, sourceType = _linkCi$attributes.source_type, sourceId = _linkCi$attributes.source_id, destinationId = _linkCi$attributes.destination_id, destinationType = _linkCi$attributes.destination_type;
171
+ rlog.debug('查询链路接口指标', linkCi); // 查询指标模型
172
+
173
+ typeCodes = [sourceType];
174
+ queryInterfaceMetricsParam = {
175
+ 'subCiId': [sourceId],
176
+ 'metricCode': [].concat(INTERFACE_METRIC_CODES)
177
+ };
178
+
179
+ if (destinationId) {
180
+ queryInterfaceMetricsParam.subCiId.push(destinationId);
181
+ typeCodes.push(destinationType);
194
182
  }
195
- };
196
- rlog.debug('查询链路接口指标 结果', linkCi);
197
- return _context4.abrupt("return", resultData);
198
183
 
199
- case 15:
200
- case "end":
201
- return _context4.stop();
184
+ _context4.next = 9;
185
+ return ciTypeCache.load(typeCodes);
186
+
187
+ case 9:
188
+ _context4.next = 11;
189
+ return queryLatestMetrics(queryInterfaceMetricsParam);
190
+
191
+ case 11:
192
+ interfaceMetrics = _context4.sent;
193
+ // format
194
+ resultData = {
195
+ sourceMetrics: parseInterfaceMetrics(sourceId),
196
+ destinationMetrics: destinationId ? parseInterfaceMetrics(destinationId) : null,
197
+ // 源目的接口指标原始数据。支持关键链路详情过滤最近一小时指标
198
+ originMetricData: {
199
+ source: findMetricsBySubCiId(sourceId),
200
+ destination: destinationId ? findMetricsBySubCiId(destinationId) : []
201
+ }
202
+ };
203
+ rlog.debug('查询链路接口指标 结果', linkCi);
204
+ return _context4.abrupt("return", resultData);
205
+
206
+ case 15:
207
+ case "end":
208
+ return _context4.stop();
209
+ }
202
210
  }
203
211
  }, _callee4);
204
212
  }));
@@ -216,15 +224,17 @@ export function checkMenu() {
216
224
  function _checkMenu() {
217
225
  _checkMenu = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
218
226
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
219
- while (1) switch (_context5.prev = _context5.next) {
220
- case 0:
221
- return _context5.abrupt("return", request.post('/authorization/v1/api/authority/check/checkMenuAuthentication', [{
222
- "url": "/default/trafficControl"
223
- }]));
224
-
225
- case 1:
226
- case "end":
227
- return _context5.stop();
227
+ while (1) {
228
+ switch (_context5.prev = _context5.next) {
229
+ case 0:
230
+ return _context5.abrupt("return", request.post('/authorization/v1/api/authority/check/checkMenuAuthentication', [{
231
+ "url": "/default/trafficControl"
232
+ }]));
233
+
234
+ case 1:
235
+ case "end":
236
+ return _context5.stop();
237
+ }
228
238
  }
229
239
  }, _callee5);
230
240
  }));
@@ -242,13 +252,15 @@ export function isOpenFlow(_x6) {
242
252
  function _isOpenFlow() {
243
253
  _isOpenFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(params) {
244
254
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
245
- while (1) switch (_context6.prev = _context6.next) {
246
- case 0:
247
- return _context6.abrupt("return", request.post('/flow/v1/api/link/isOpenFlowMonitorByName', params));
248
-
249
- case 1:
250
- case "end":
251
- return _context6.stop();
255
+ while (1) {
256
+ switch (_context6.prev = _context6.next) {
257
+ case 0:
258
+ return _context6.abrupt("return", request.post('/flow/v1/api/link/isOpenFlowMonitorByName', params));
259
+
260
+ case 1:
261
+ case "end":
262
+ return _context6.stop();
263
+ }
252
264
  }
253
265
  }, _callee6);
254
266
  }));
@@ -262,13 +274,15 @@ export function queryLastestValue(_x7) {
262
274
  function _queryLastestValue() {
263
275
  _queryLastestValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(params) {
264
276
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
265
- while (1) switch (_context7.prev = _context7.next) {
266
- case 0:
267
- return _context7.abrupt("return", request.post('/flow/v1/api/LinkAnalyse/queryLastestValue', params));
268
-
269
- case 1:
270
- case "end":
271
- return _context7.stop();
277
+ while (1) {
278
+ switch (_context7.prev = _context7.next) {
279
+ case 0:
280
+ return _context7.abrupt("return", request.post('/flow/v1/api/LinkAnalyse/queryLastestValue', params));
281
+
282
+ case 1:
283
+ case "end":
284
+ return _context7.stop();
285
+ }
272
286
  }
273
287
  }, _callee7);
274
288
  }));
@@ -283,46 +297,48 @@ function _queryRetansRatioNetDelayRatio() {
283
297
  _queryRetansRatioNetDelayRatio = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(params, retansRatioNetDelayRatioCodes) {
284
298
  var result, linkOther;
285
299
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
286
- while (1) switch (_context8.prev = _context8.next) {
287
- case 0:
288
- if (retansRatioNetDelayRatioCodes.length) {
289
- _context8.next = 2;
290
- break;
291
- }
292
-
293
- return _context8.abrupt("return", []);
294
-
295
- case 2:
296
- _context8.next = 4;
297
- return queryLastestValue(params);
298
-
299
- case 4:
300
- result = _context8.sent;
301
- linkOther = [];
302
-
303
- if (retansRatioNetDelayRatioCodes.includes('netDelayRatio')) {
304
- linkOther.push({
305
- 'code': 'netDelayRatio',
306
- 'name': 'RTT时延',
307
- 'ts': result.time,
308
- 'value': (result.upNetDelayRatio * 1).toFixed(2) + ' ms' + '|' + (result.downNetDelayRatio * 1).toFixed(2) + ' ms'
309
- });
310
- }
311
-
312
- if (retansRatioNetDelayRatioCodes.includes('retansRatio')) {
313
- linkOther.push({
314
- 'code': 'retansRatio',
315
- 'name': '重传率',
316
- 'ts': result.time,
317
- 'value': result.upRetransRatio + ' %' + '|' + result.downRetansRatio + ' %'
318
- });
319
- }
300
+ while (1) {
301
+ switch (_context8.prev = _context8.next) {
302
+ case 0:
303
+ if (retansRatioNetDelayRatioCodes.length) {
304
+ _context8.next = 2;
305
+ break;
306
+ }
307
+
308
+ return _context8.abrupt("return", []);
309
+
310
+ case 2:
311
+ _context8.next = 4;
312
+ return queryLastestValue(params);
313
+
314
+ case 4:
315
+ result = _context8.sent;
316
+ linkOther = [];
317
+
318
+ if (retansRatioNetDelayRatioCodes.includes('netDelayRatio')) {
319
+ linkOther.push({
320
+ 'code': 'netDelayRatio',
321
+ 'name': 'RTT时延',
322
+ 'ts': result.time,
323
+ 'value': (result.upNetDelayRatio * 1).toFixed(2) + ' ms' + '|' + (result.downNetDelayRatio * 1).toFixed(2) + ' ms'
324
+ });
325
+ }
326
+
327
+ if (retansRatioNetDelayRatioCodes.includes('retansRatio')) {
328
+ linkOther.push({
329
+ 'code': 'retansRatio',
330
+ 'name': '重传率',
331
+ 'ts': result.time,
332
+ 'value': result.upRetransRatio + ' %' + '|' + result.downRetansRatio + ' %'
333
+ });
334
+ }
320
335
 
321
- return _context8.abrupt("return", linkOther);
336
+ return _context8.abrupt("return", linkOther);
322
337
 
323
- case 9:
324
- case "end":
325
- return _context8.stop();
338
+ case 9:
339
+ case "end":
340
+ return _context8.stop();
341
+ }
326
342
  }
327
343
  }, _callee8);
328
344
  }));