@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
@@ -19,11 +19,14 @@ var _Background = _interopRequireDefault(require("./graph/Background"));
19
19
  * 包含元素操作相关,不同类型拓扑图结构不同,后续支持多种实现
20
20
  */
21
21
  var TopoGraphView = /*#__PURE__*/function () {
22
- /**
23
- * @type TopoClient
24
- */
22
+ var _switchToViewMode, _switchToEditMode;
23
+
25
24
  function TopoGraphView() {
26
25
  this.store = void 0;
26
+
27
+ /**
28
+ * @type TopoClient
29
+ */
27
30
  this.topoClient = void 0;
28
31
  this.background = void 0;
29
32
  this.init();
@@ -59,51 +62,35 @@ var TopoGraphView = /*#__PURE__*/function () {
59
62
  this.topoClient.getGraphView().fitContent(anim, padding, notZoomIn);
60
63
  };
61
64
 
62
- _proto.switchToViewMode = /*#__PURE__*/function () {
63
- var _switchToViewMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
65
+ _proto.switchToViewMode = function switchToViewMode() {
66
+ return (_switchToViewMode = _switchToViewMode || (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
64
67
  return _regenerator["default"].wrap(function _callee$(_context) {
65
- while (1) {
66
- switch (_context.prev = _context.next) {
67
- case 0:
68
- this.topoClient.exitEditMode();
69
-
70
- case 1:
71
- case "end":
72
- return _context.stop();
73
- }
68
+ while (1) switch (_context.prev = _context.next) {
69
+ case 0:
70
+ this.topoClient.exitEditMode();
71
+
72
+ case 1:
73
+ case "end":
74
+ return _context.stop();
74
75
  }
75
76
  }, _callee, this);
76
- }));
77
-
78
- function switchToViewMode() {
79
- return _switchToViewMode.apply(this, arguments);
80
- }
81
-
82
- return switchToViewMode;
83
- }();
77
+ }))).apply(this, arguments);
78
+ };
84
79
 
85
- _proto.switchToEditMode = /*#__PURE__*/function () {
86
- var _switchToEditMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
80
+ _proto.switchToEditMode = function switchToEditMode() {
81
+ return (_switchToEditMode = _switchToEditMode || (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
87
82
  return _regenerator["default"].wrap(function _callee2$(_context2) {
88
- while (1) {
89
- switch (_context2.prev = _context2.next) {
90
- case 0:
91
- this.topoClient.enterEditMode();
92
-
93
- case 1:
94
- case "end":
95
- return _context2.stop();
96
- }
83
+ while (1) switch (_context2.prev = _context2.next) {
84
+ case 0:
85
+ this.topoClient.enterEditMode();
86
+
87
+ case 1:
88
+ case "end":
89
+ return _context2.stop();
97
90
  }
98
91
  }, _callee2, this);
99
- }));
100
-
101
- function switchToEditMode() {
102
- return _switchToEditMode.apply(this, arguments);
103
- }
104
-
105
- return switchToEditMode;
106
- }();
92
+ }))).apply(this, arguments);
93
+ };
107
94
 
108
95
  _proto.loadAlarm = function loadAlarm(alarms) {
109
96
  this.topoClient.loadAlarm(alarms);
@@ -15,7 +15,12 @@ var _services = require("../../services");
15
15
  * Ci缓存
16
16
  */
17
17
  var CiCache = /*#__PURE__*/function () {
18
+ var _load;
19
+
18
20
  function CiCache() {
21
+ /**
22
+ * @param {object<string, object>}
23
+ */
19
24
  this.ciMap = {};
20
25
  }
21
26
 
@@ -26,56 +31,46 @@ var CiCache = /*#__PURE__*/function () {
26
31
  * @param ids {string[]}
27
32
  * @returns {Promise<Object>}
28
33
  */
29
- _proto.load =
30
- /*#__PURE__*/
31
- function () {
32
- var _load = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(ids) {
34
+ _proto.load = function load(_x) {
35
+ return (_load = _load || (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(ids) {
33
36
  var _this = this;
34
37
 
35
38
  var unloadCiIds, cis, map;
36
39
  return _regenerator["default"].wrap(function _callee$(_context) {
37
- while (1) {
38
- switch (_context.prev = _context.next) {
39
- case 0:
40
- unloadCiIds = ids.filter(function (id) {
41
- return !_this.ciMap[id];
42
- });
43
-
44
- if (!unloadCiIds.length) {
45
- _context.next = 6;
46
- break;
47
- }
48
-
49
- _context.next = 4;
50
- return (0, _services.queryCisByIds)(unloadCiIds);
51
-
52
- case 4:
53
- cis = _context.sent;
54
- cis.forEach(function (ci) {
55
- _this.ciMap[ci.id] = ci;
56
- });
57
-
58
- case 6:
59
- map = {};
60
- ids.forEach(function (id) {
61
- map[id] = _this.ciMap[id];
62
- });
63
- return _context.abrupt("return", this.ciMap);
64
-
65
- case 9:
66
- case "end":
67
- return _context.stop();
68
- }
40
+ while (1) switch (_context.prev = _context.next) {
41
+ case 0:
42
+ unloadCiIds = ids.filter(function (id) {
43
+ return !_this.ciMap[id];
44
+ });
45
+
46
+ if (!unloadCiIds.length) {
47
+ _context.next = 6;
48
+ break;
49
+ }
50
+
51
+ _context.next = 4;
52
+ return (0, _services.queryCisByIds)(unloadCiIds);
53
+
54
+ case 4:
55
+ cis = _context.sent;
56
+ cis.forEach(function (ci) {
57
+ _this.ciMap[ci.id] = ci;
58
+ });
59
+
60
+ case 6:
61
+ map = {};
62
+ ids.forEach(function (id) {
63
+ map[id] = _this.ciMap[id];
64
+ });
65
+ return _context.abrupt("return", this.ciMap);
66
+
67
+ case 9:
68
+ case "end":
69
+ return _context.stop();
69
70
  }
70
71
  }, _callee, this);
71
- }));
72
-
73
- function load(_x) {
74
- return _load.apply(this, arguments);
75
- }
76
-
77
- return load;
78
- }();
72
+ }))).apply(this, arguments);
73
+ };
79
74
 
80
75
  _proto.getCi = function getCi(id) {
81
76
  return this.ciMap[id];
@@ -23,110 +23,96 @@ var _keyBy = _interopRequireDefault(require("lodash/keyBy"));
23
23
  * Ci类型属性、指标缓存
24
24
  */
25
25
  var CiTyeCache = /*#__PURE__*/function () {
26
+ var _getCiTypeMap, _load;
27
+
26
28
  function CiTyeCache() {
27
29
  this.cache = {};
28
30
  }
29
31
 
30
32
  var _proto = CiTyeCache.prototype;
31
33
 
32
- _proto.getCiTypeMap = /*#__PURE__*/function () {
33
- var _getCiTypeMap = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(ciTypeIds) {
34
+ _proto.getCiTypeMap = function getCiTypeMap(_x) {
35
+ return (_getCiTypeMap = _getCiTypeMap || (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(ciTypeIds) {
34
36
  return _regenerator["default"].wrap(function _callee$(_context) {
35
- while (1) {
36
- switch (_context.prev = _context.next) {
37
- case 0:
38
- _context.prev = 0;
39
- _context.next = 3;
40
- return this.load(ciTypeIds);
41
-
42
- case 3:
43
- _context.next = 8;
44
- break;
45
-
46
- case 5:
47
- _context.prev = 5;
48
- _context.t0 = _context["catch"](0);
49
-
50
- _rlog["default"].error('查询Ci模型异常', _context.t0);
51
-
52
- case 8:
53
- return _context.abrupt("return", this.cache);
54
-
55
- case 9:
56
- case "end":
57
- return _context.stop();
58
- }
59
- }
60
- }, _callee, this, [[0, 5]]);
61
- }));
37
+ while (1) switch (_context.prev = _context.next) {
38
+ case 0:
39
+ _context.prev = 0;
40
+ _context.next = 3;
41
+ return this.load(ciTypeIds);
62
42
 
63
- function getCiTypeMap(_x) {
64
- return _getCiTypeMap.apply(this, arguments);
65
- }
43
+ case 3:
44
+ _context.next = 8;
45
+ break;
46
+
47
+ case 5:
48
+ _context.prev = 5;
49
+ _context.t0 = _context["catch"](0);
66
50
 
67
- return getCiTypeMap;
68
- }();
51
+ _rlog["default"].error('查询Ci模型异常', _context.t0);
69
52
 
70
- _proto.load = /*#__PURE__*/function () {
71
- var _load = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(ciTypeIds) {
53
+ case 8:
54
+ return _context.abrupt("return", this.cache);
55
+
56
+ case 9:
57
+ case "end":
58
+ return _context.stop();
59
+ }
60
+ }, _callee, this, [[0, 5]]);
61
+ }))).apply(this, arguments);
62
+ };
63
+
64
+ _proto.load = function load(_x2) {
65
+ return (_load = _load || (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(ciTypeIds) {
72
66
  var _this = this;
73
67
 
74
68
  var unLoadCiTypeIds, ciTypeMetas, cache;
75
69
  return _regenerator["default"].wrap(function _callee2$(_context2) {
76
- while (1) {
77
- switch (_context2.prev = _context2.next) {
78
- case 0:
79
- unLoadCiTypeIds = ciTypeIds.filter(function (id) {
80
- return !_this.cache[id];
81
- });
82
- _context2.next = 3;
83
- return _topo["default"].ciInfo.batchQueryCiTypeInfo(unLoadCiTypeIds);
84
-
85
- case 3:
86
- ciTypeMetas = _context2.sent;
87
- cache = (0, _extends2["default"])({}, this.cache);
88
- ciTypeMetas.forEach(function (ciTypeMeta) {
89
- var attributes = (ciTypeMeta.attributes || []).map(function (attr) {
90
- if (ciTypeMeta.code !== 'network_link') {
91
- return attr;
92
- } // 链路属性名称转化,临时方案
93
-
94
-
95
- var name = {
96
- source_id: '源端口',
97
- destination_id: '目的端口'
98
- }[attr.code] || attr.name;
99
- var userVisible = ['source_id', 'destination_id'].indexOf(attr.code) !== -1 ? true : attr.userVisible;
100
- return (0, _extends2["default"])({}, attr, {
101
- name: name,
102
- userVisible: userVisible
103
- });
104
- });
105
- var metrics = ciTypeMeta.metrics || [];
106
- cache[ciTypeMeta.code] = (0, _extends2["default"])({}, ciTypeMeta, {
107
- attributes: attributes,
108
- attributeMap: (0, _keyBy["default"])(attributes, 'code'),
109
- metrics: metrics,
110
- metricMap: (0, _keyBy["default"])(metrics, 'code')
70
+ while (1) switch (_context2.prev = _context2.next) {
71
+ case 0:
72
+ unLoadCiTypeIds = ciTypeIds.filter(function (id) {
73
+ return !_this.cache[id];
74
+ });
75
+ _context2.next = 3;
76
+ return _topo["default"].ciInfo.batchQueryCiTypeInfo(unLoadCiTypeIds);
77
+
78
+ case 3:
79
+ ciTypeMetas = _context2.sent;
80
+ cache = (0, _extends2["default"])({}, this.cache);
81
+ ciTypeMetas.forEach(function (ciTypeMeta) {
82
+ var attributes = (ciTypeMeta.attributes || []).map(function (attr) {
83
+ if (ciTypeMeta.code !== 'network_link') {
84
+ return attr;
85
+ } // 链路属性名称转化,临时方案
86
+
87
+
88
+ var name = {
89
+ source_id: '源端口',
90
+ destination_id: '目的端口'
91
+ }[attr.code] || attr.name;
92
+ var userVisible = ['source_id', 'destination_id'].indexOf(attr.code) !== -1 ? true : attr.userVisible;
93
+ return (0, _extends2["default"])({}, attr, {
94
+ name: name,
95
+ userVisible: userVisible
111
96
  });
112
97
  });
113
- this.cache = cache;
114
- return _context2.abrupt("return", this.cache);
98
+ var metrics = ciTypeMeta.metrics || [];
99
+ cache[ciTypeMeta.code] = (0, _extends2["default"])({}, ciTypeMeta, {
100
+ attributes: attributes,
101
+ attributeMap: (0, _keyBy["default"])(attributes, 'code'),
102
+ metrics: metrics,
103
+ metricMap: (0, _keyBy["default"])(metrics, 'code')
104
+ });
105
+ });
106
+ this.cache = cache;
107
+ return _context2.abrupt("return", this.cache);
115
108
 
116
- case 8:
117
- case "end":
118
- return _context2.stop();
119
- }
109
+ case 8:
110
+ case "end":
111
+ return _context2.stop();
120
112
  }
121
113
  }, _callee2, this);
122
- }));
123
-
124
- function load(_x2) {
125
- return _load.apply(this, arguments);
126
- }
127
-
128
- return load;
129
- }();
114
+ }))).apply(this, arguments);
115
+ };
130
116
 
131
117
  _proto.getCiType = function getCiType(typeCode) {
132
118
  return this.cache[typeCode];
@@ -23,6 +23,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
23
23
  * 数据字典缓存
24
24
  */
25
25
  var DictCache = /*#__PURE__*/function () {
26
+ var _init;
27
+
26
28
  function DictCache() {
27
29
  this.dists = void 0;
28
30
  this.dictObject = void 0;
@@ -30,61 +32,53 @@ var DictCache = /*#__PURE__*/function () {
30
32
 
31
33
  var _proto = DictCache.prototype;
32
34
 
33
- _proto.init = /*#__PURE__*/function () {
34
- var _init = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
35
+ _proto.init = function init() {
36
+ return (_init = _init || (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
35
37
  var distsStr, dicts;
36
38
  return _regenerator["default"].wrap(function _callee$(_context) {
37
- while (1) {
38
- switch (_context.prev = _context.next) {
39
- case 0:
40
- if (!this.dists) {
41
- _context.next = 2;
42
- break;
43
- }
44
-
45
- return _context.abrupt("return");
46
-
47
- case 2:
48
- distsStr = sessionStorage.getItem('dists');
49
-
50
- if (!distsStr) {
51
- _context.next = 7;
52
- break;
53
- }
54
-
55
- dicts = JSON.parse(distsStr);
56
- _context.next = 10;
39
+ while (1) switch (_context.prev = _context.next) {
40
+ case 0:
41
+ if (!this.dists) {
42
+ _context.next = 2;
57
43
  break;
44
+ }
58
45
 
59
- case 7:
60
- _context.next = 9;
61
- return modelService.queryDicts()["catch"](function (e) {
62
- _rlog["default"].error('初始化数据字典异常', e);
46
+ return _context.abrupt("return");
63
47
 
64
- return [];
65
- });
48
+ case 2:
49
+ distsStr = sessionStorage.getItem('dists');
66
50
 
67
- case 9:
68
- dicts = _context.sent;
51
+ if (!distsStr) {
52
+ _context.next = 7;
53
+ break;
54
+ }
69
55
 
70
- case 10:
71
- this.dists = dicts;
72
- this.dictObject = (0, _utils.dictFormat)(dicts);
56
+ dicts = JSON.parse(distsStr);
57
+ _context.next = 10;
58
+ break;
73
59
 
74
- case 12:
75
- case "end":
76
- return _context.stop();
77
- }
78
- }
79
- }, _callee, this);
80
- }));
60
+ case 7:
61
+ _context.next = 9;
62
+ return modelService.queryDicts()["catch"](function (e) {
63
+ _rlog["default"].error('初始化数据字典异常', e);
64
+
65
+ return [];
66
+ });
81
67
 
82
- function init() {
83
- return _init.apply(this, arguments);
84
- }
68
+ case 9:
69
+ dicts = _context.sent;
85
70
 
86
- return init;
87
- }();
71
+ case 10:
72
+ this.dists = dicts;
73
+ this.dictObject = (0, _utils.dictFormat)(dicts);
74
+
75
+ case 12:
76
+ case "end":
77
+ return _context.stop();
78
+ }
79
+ }, _callee, this);
80
+ }))).apply(this, arguments);
81
+ };
88
82
 
89
83
  _proto.getDictObject = function getDictObject() {
90
84
  return this.dictObject;
@@ -14,38 +14,33 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
14
14
  */
15
15
  var Background = /*#__PURE__*/function () {
16
16
  function Background(view) {
17
- var _this = this;
17
+ var _this = this,
18
+ _ref2;
18
19
 
19
- this.setSize = /*#__PURE__*/function () {
20
- var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref) {
20
+ this.setSize = function (_x) {
21
+ return (_ref2 = _ref2 || (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref) {
21
22
  var width, height, backgroundNode, backgroundDispatchers;
22
23
  return _regenerator["default"].wrap(function _callee$(_context) {
23
- while (1) {
24
- switch (_context.prev = _context.next) {
25
- case 0:
26
- width = _ref.width, height = _ref.height;
27
- backgroundNode = _this.getBackgroundNode();
28
- backgroundNode.setWidth(width);
29
- backgroundNode.setHeight(height);
30
- backgroundDispatchers = _this.view.store.getModelDispatchers('background');
31
- _context.next = 7;
32
- return backgroundDispatchers.setSize({
33
- width: width,
34
- height: height
35
- });
36
-
37
- case 7:
38
- case "end":
39
- return _context.stop();
40
- }
24
+ while (1) switch (_context.prev = _context.next) {
25
+ case 0:
26
+ width = _ref.width, height = _ref.height;
27
+ backgroundNode = _this.getBackgroundNode();
28
+ backgroundNode.setWidth(width);
29
+ backgroundNode.setHeight(height);
30
+ backgroundDispatchers = _this.view.store.getModelDispatchers('background');
31
+ _context.next = 7;
32
+ return backgroundDispatchers.setSize({
33
+ width: width,
34
+ height: height
35
+ });
36
+
37
+ case 7:
38
+ case "end":
39
+ return _context.stop();
41
40
  }
42
41
  }, _callee);
43
- }));
44
-
45
- return function (_x) {
46
- return _ref2.apply(this, arguments);
47
- };
48
- }();
42
+ }))).apply(this, arguments);
43
+ };
49
44
 
50
45
  this.view = view;
51
46
  }