@riil-frontend/component-topology 10.0.57 → 10.0.59

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