@ytsaurus/ui 1.12.2 → 1.13.1

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 (176) hide show
  1. package/build/cjs/@types/core.d.ts +38 -0
  2. package/build/cjs/server/components/layout-config.js +6 -1
  3. package/build/cjs/server/components/layout-config.js.map +1 -1
  4. package/build/cjs/server/components/oauth.d.ts +26 -0
  5. package/build/cjs/server/components/oauth.js +123 -0
  6. package/build/cjs/server/components/oauth.js.map +1 -0
  7. package/build/cjs/server/components/yt-auth.d.ts +6 -0
  8. package/build/cjs/server/components/yt-auth.js +23 -0
  9. package/build/cjs/server/components/yt-auth.js.map +1 -0
  10. package/build/cjs/server/controllers/login.d.ts +0 -1
  11. package/build/cjs/server/controllers/login.js +4 -26
  12. package/build/cjs/server/controllers/login.js.map +1 -1
  13. package/build/cjs/server/controllers/logout.d.ts +2 -0
  14. package/build/cjs/server/controllers/logout.js +15 -0
  15. package/build/cjs/server/controllers/logout.js.map +1 -0
  16. package/build/cjs/server/controllers/oauth-login.d.ts +4 -0
  17. package/build/cjs/server/controllers/oauth-login.js +30 -0
  18. package/build/cjs/server/controllers/oauth-login.js.map +1 -0
  19. package/build/cjs/server/index.js +9 -1
  20. package/build/cjs/server/index.js.map +1 -1
  21. package/build/cjs/server/middlewares/authorization.d.ts +2 -0
  22. package/build/cjs/server/middlewares/authorization.js +42 -0
  23. package/build/cjs/server/middlewares/authorization.js.map +1 -0
  24. package/build/cjs/server/middlewares/oauth.d.ts +2 -0
  25. package/build/cjs/server/middlewares/oauth.js +27 -0
  26. package/build/cjs/server/middlewares/oauth.js.map +1 -0
  27. package/build/cjs/server/middlewares/yt-auth.d.ts +1 -1
  28. package/build/cjs/server/middlewares/yt-auth.js +10 -42
  29. package/build/cjs/server/middlewares/yt-auth.js.map +1 -1
  30. package/build/cjs/server/routes.js +6 -1
  31. package/build/cjs/server/routes.js.map +1 -1
  32. package/build/cjs/server/utils/authorization.d.ts +6 -0
  33. package/build/cjs/server/utils/authorization.js +33 -0
  34. package/build/cjs/server/utils/authorization.js.map +1 -0
  35. package/build/cjs/shared/constants/index.d.ts +3 -0
  36. package/build/cjs/shared/constants/index.js +3 -1
  37. package/build/cjs/shared/constants/index.js.map +1 -1
  38. package/build/cjs/shared/yt-types.d.ts +2 -0
  39. package/build/cjs/ui/components/Login/LoginFormPage/LoginFormPage.js +23 -5
  40. package/build/cjs/ui/components/Login/LoginFormPage/LoginFormPage.js.map +1 -1
  41. package/build/cjs/ui/components/Login/LoginPageWrapper/LoginPageWrapper.css +8 -0
  42. package/build/cjs/ui/components/Login/LoginPageWrapper/LoginPageWrapper.css.map +1 -1
  43. package/build/cjs/ui/components/NumberInput/NumberInput.d.ts +1 -1
  44. package/build/cjs/ui/containers/AppNavigation/AppNavigation.js +2 -0
  45. package/build/cjs/ui/containers/AppNavigation/AppNavigation.js.map +1 -1
  46. package/build/cjs/ui/containers/AppNavigation/AppNavigationComponent.d.ts +1 -1
  47. package/build/cjs/ui/containers/AppNavigation/AppNavigationComponent.js +5 -7
  48. package/build/cjs/ui/containers/AppNavigation/AppNavigationComponent.js.map +1 -1
  49. package/build/cjs/ui/containers/AppNavigation/AppNavigationPageLayout.d.ts +2 -0
  50. package/build/cjs/ui/containers/AppNavigation/AppNavigationPageLayout.js.map +1 -1
  51. package/build/cjs/ui/rum/constants.d.ts +5 -1
  52. package/build/cjs/ui/rum/constants.js +5 -2
  53. package/build/cjs/ui/rum/constants.js.map +1 -1
  54. package/build/cjs/ui/rum/rum-counter.js +1 -1
  55. package/build/cjs/ui/rum/rum-counter.js.map +1 -1
  56. package/build/cjs/ui/store/actions/system/masters.d.ts +7 -5
  57. package/build/cjs/ui/store/actions/system/masters.js +305 -235
  58. package/build/cjs/ui/store/actions/system/masters.js.map +1 -1
  59. package/build/cjs/ui/store/reducers/global/index.d.ts +1 -0
  60. package/build/cjs/ui/store/reducers/global/index.js +1 -0
  61. package/build/cjs/ui/store/reducers/global/index.js.map +1 -1
  62. package/build/cjs/ui/store/reducers/system/masters.d.ts +2 -2
  63. package/build/cjs/ui/store/reducers/system/masters.js.map +1 -1
  64. package/build/cjs/ui/store/selectors/global/index.d.ts +4 -0
  65. package/build/cjs/ui/store/selectors/global/index.js +14 -4
  66. package/build/cjs/ui/store/selectors/global/index.js.map +1 -1
  67. package/build/cjs/ui/store/selectors/system/masters.d.ts +1 -1
  68. package/build/cjs/ui/store/selectors/system/masters.js.map +1 -1
  69. package/build/esm/@types/core.d.ts +38 -0
  70. package/build/esm/server/components/layout-config.js +7 -2
  71. package/build/esm/server/components/layout-config.js.map +1 -1
  72. package/build/esm/server/components/oauth.d.ts +26 -0
  73. package/build/esm/server/components/oauth.js +169 -0
  74. package/build/esm/server/components/oauth.js.map +1 -0
  75. package/build/esm/server/components/yt-auth.d.ts +6 -0
  76. package/build/esm/server/components/yt-auth.js +17 -0
  77. package/build/esm/server/components/yt-auth.js.map +1 -0
  78. package/build/esm/server/controllers/login.d.ts +0 -1
  79. package/build/esm/server/controllers/login.js +41 -88
  80. package/build/esm/server/controllers/login.js.map +1 -1
  81. package/build/esm/server/controllers/logout.d.ts +2 -0
  82. package/build/esm/server/controllers/logout.js +11 -0
  83. package/build/esm/server/controllers/logout.js.map +1 -0
  84. package/build/esm/server/controllers/oauth-login.d.ts +4 -0
  85. package/build/esm/server/controllers/oauth-login.js +50 -0
  86. package/build/esm/server/controllers/oauth-login.js.map +1 -0
  87. package/build/esm/server/index.js +7 -2
  88. package/build/esm/server/index.js.map +1 -1
  89. package/build/esm/server/middlewares/authorization.d.ts +2 -0
  90. package/build/esm/server/middlewares/authorization.js +74 -0
  91. package/build/esm/server/middlewares/authorization.js.map +1 -0
  92. package/build/esm/server/middlewares/oauth.d.ts +2 -0
  93. package/build/esm/server/middlewares/oauth.js +50 -0
  94. package/build/esm/server/middlewares/oauth.js.map +1 -0
  95. package/build/esm/server/middlewares/yt-auth.d.ts +1 -1
  96. package/build/esm/server/middlewares/yt-auth.js +8 -58
  97. package/build/esm/server/middlewares/yt-auth.js.map +1 -1
  98. package/build/esm/server/routes.js +16 -2
  99. package/build/esm/server/routes.js.map +1 -1
  100. package/build/esm/server/utils/authorization.d.ts +6 -0
  101. package/build/esm/server/utils/authorization.js +28 -0
  102. package/build/esm/server/utils/authorization.js.map +1 -0
  103. package/build/esm/shared/constants/index.d.ts +3 -0
  104. package/build/esm/shared/constants/index.js +2 -1
  105. package/build/esm/shared/constants/index.js.map +1 -1
  106. package/build/esm/shared/yt-types.d.ts +2 -0
  107. package/build/esm/ui/components/Login/LoginFormPage/LoginFormPage.js +24 -6
  108. package/build/esm/ui/components/Login/LoginFormPage/LoginFormPage.js.map +1 -1
  109. package/build/esm/ui/components/Login/LoginPageWrapper/LoginPageWrapper.css +8 -0
  110. package/build/esm/ui/components/Login/LoginPageWrapper/LoginPageWrapper.css.map +1 -1
  111. package/build/esm/ui/components/Login/LoginPageWrapper/LoginPageWrapper.scss +12 -0
  112. package/build/esm/ui/components/NumberInput/NumberInput.d.ts +1 -1
  113. package/build/esm/ui/containers/AppNavigation/AppNavigation.js +3 -1
  114. package/build/esm/ui/containers/AppNavigation/AppNavigation.js.map +1 -1
  115. package/build/esm/ui/containers/AppNavigation/AppNavigationComponent.d.ts +1 -1
  116. package/build/esm/ui/containers/AppNavigation/AppNavigationComponent.js +5 -7
  117. package/build/esm/ui/containers/AppNavigation/AppNavigationComponent.js.map +1 -1
  118. package/build/esm/ui/containers/AppNavigation/AppNavigationPageLayout.d.ts +2 -0
  119. package/build/esm/ui/containers/AppNavigation/AppNavigationPageLayout.js.map +1 -1
  120. package/build/esm/ui/rum/constants.d.ts +5 -1
  121. package/build/esm/ui/rum/constants.js +5 -2
  122. package/build/esm/ui/rum/constants.js.map +1 -1
  123. package/build/esm/ui/rum/rum-counter.js +1 -1
  124. package/build/esm/ui/rum/rum-counter.js.map +1 -1
  125. package/build/esm/ui/store/actions/system/masters.d.ts +7 -5
  126. package/build/esm/ui/store/actions/system/masters.js +303 -233
  127. package/build/esm/ui/store/actions/system/masters.js.map +1 -1
  128. package/build/esm/ui/store/reducers/global/index.d.ts +1 -0
  129. package/build/esm/ui/store/reducers/global/index.js +1 -0
  130. package/build/esm/ui/store/reducers/global/index.js.map +1 -1
  131. package/build/esm/ui/store/reducers/system/masters.d.ts +2 -2
  132. package/build/esm/ui/store/reducers/system/masters.js.map +1 -1
  133. package/build/esm/ui/store/selectors/global/index.d.ts +4 -0
  134. package/build/esm/ui/store/selectors/global/index.js +12 -2
  135. package/build/esm/ui/store/selectors/global/index.js.map +1 -1
  136. package/build/esm/ui/store/selectors/system/masters.d.ts +1 -1
  137. package/build/esm/ui/store/selectors/system/masters.js.map +1 -1
  138. package/dist/public/build/assets-manifest.json +12 -12
  139. package/dist/public/build/css/{main.136a49c7.css → main.e919e247.css} +2 -2
  140. package/dist/public/build/css/main.e919e247.css.map +1 -0
  141. package/dist/public/build/js/89.07445d46.chunk.js +2 -0
  142. package/dist/public/build/js/89.07445d46.chunk.js.map +1 -0
  143. package/dist/public/build/js/main.4eb01db4.js +3 -0
  144. package/dist/public/build/js/{main.f91e3651.js.map → main.4eb01db4.js.map} +1 -1
  145. package/dist/public/build/js/{runtime.6c8d85d3.js → runtime.9491563b.js} +2 -2
  146. package/dist/public/build/js/{runtime.6c8d85d3.js.map → runtime.9491563b.js.map} +1 -1
  147. package/dist/public/build/manifest.json +8 -8
  148. package/dist/server/components/layout-config.js +6 -1
  149. package/dist/server/components/oauth.d.ts +26 -0
  150. package/dist/server/components/oauth.js +123 -0
  151. package/dist/server/components/yt-auth.d.ts +6 -0
  152. package/dist/server/components/yt-auth.js +23 -0
  153. package/dist/server/controllers/login.d.ts +0 -1
  154. package/dist/server/controllers/login.js +4 -26
  155. package/dist/server/controllers/logout.d.ts +2 -0
  156. package/dist/server/controllers/logout.js +15 -0
  157. package/dist/server/controllers/oauth-login.d.ts +4 -0
  158. package/dist/server/controllers/oauth-login.js +30 -0
  159. package/dist/server/index.js +9 -1
  160. package/dist/server/middlewares/authorization.d.ts +2 -0
  161. package/dist/server/middlewares/authorization.js +42 -0
  162. package/dist/server/middlewares/oauth.d.ts +2 -0
  163. package/dist/server/middlewares/oauth.js +27 -0
  164. package/dist/server/middlewares/yt-auth.d.ts +1 -1
  165. package/dist/server/middlewares/yt-auth.js +10 -42
  166. package/dist/server/routes.js +6 -1
  167. package/dist/server/utils/authorization.d.ts +6 -0
  168. package/dist/server/utils/authorization.js +33 -0
  169. package/dist/shared/constants/index.d.ts +3 -0
  170. package/dist/shared/constants/index.js +3 -1
  171. package/package.json +2 -2
  172. package/dist/public/build/css/main.136a49c7.css.map +0 -1
  173. package/dist/public/build/js/89.6ea87438.chunk.js +0 -2
  174. package/dist/public/build/js/89.6ea87438.chunk.js.map +0 -1
  175. package/dist/public/build/js/main.f91e3651.js +0 -3
  176. /package/dist/public/build/js/{main.f91e3651.js.LICENSE.txt → main.4eb01db4.js.LICENSE.txt} +0 -0
@@ -1,192 +1,234 @@
1
- import _sortBy from "lodash/sortBy";
2
- import _each from "lodash/each";
3
1
  import _reduce from "lodash/reduce";
4
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
2
  import _keys from "lodash/keys";
6
3
  import _map from "lodash/map";
4
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
7
5
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
8
6
  import _objectSpread from "@babel/runtime/helpers/objectSpread2";
7
+ import _sortBy from "lodash/sortBy";
8
+ import _each from "lodash/each";
9
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
10
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
9
11
  import ypath from '../../../common/thor/ypath';
10
12
  import { Toaster } from '@gravity-ui/uikit';
11
13
  import createActionTypes from '../../../constants/utils';
12
14
  import { isRetryFutile } from '../../../utils/index';
13
15
  import { getBatchError, showErrorPopup } from '../../../utils/utils';
14
- import yt from '@ytsaurus/javascript-wrapper/lib/yt';
16
+ import { YTErrors } from '../../../rum/constants';
15
17
  import { YTApiId, ytApiV3Id } from '../../../rum/rum-wrap-api';
16
18
  import { USE_SUPRESS_SYNC } from '../../../../shared/constants';
17
19
  export var FETCH_MASTER_CONFIG = createActionTypes('MASTER_CONFIG');
18
20
  export var FETCH_MASTER_DATA = createActionTypes('MASTER_DATA');
19
21
  var toaster = new Toaster();
22
+ var NODE_DOES_NOT_EXIST = YTErrors.NODE_DOES_NOT_EXIST;
20
23
  function loadMastersConfig() {
21
- var requests = [{
22
- command: 'get',
23
- parameters: _objectSpread({
24
- path: '//sys/primary_masters',
25
- attributes: ['annotations', 'maintenance', 'maintenance_message']
26
- }, USE_SUPRESS_SYNC)
27
- }, {
28
- command: 'get',
29
- parameters: _objectSpread({
30
- path: '//sys/@cell_tag'
31
- }, USE_SUPRESS_SYNC)
32
- }, {
33
- command: 'get',
34
- parameters: _objectSpread({
35
- path: '//sys/secondary_masters',
36
- attributes: ['annotations', 'maintenance', 'maintenance_message']
37
- }, USE_SUPRESS_SYNC)
38
- }, {
39
- command: 'get',
40
- parameters: _objectSpread({
41
- path: '//sys/timestamp_providers',
42
- attributes: ['annotations', 'native_cell_tag', 'maintenance', 'maintenance_message']
43
- }, USE_SUPRESS_SYNC)
44
- }, {
45
- command: 'get',
46
- parameters: _objectSpread({
47
- path: '//sys/discovery_servers',
48
- attributes: ['annotations', 'native_cell_tag']
49
- }, USE_SUPRESS_SYNC)
50
- }, {
51
- command: 'get',
52
- parameters: _objectSpread({
53
- path: '//sys/queue_agents/instances',
54
- attributes: ['annotations', 'maintenance', 'maintenance_message']
55
- }, USE_SUPRESS_SYNC)
56
- }];
57
- return ytApiV3Id.executeBatch(YTApiId.systemMastersConfig, {
58
- requests: requests
59
- }).then(function (_ref) {
24
+ return _loadMastersConfig.apply(this, arguments);
25
+ }
26
+ function _loadMastersConfig() {
27
+ _loadMastersConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
60
28
  var _timestampProvidersRe, _queueAgentsResult$er;
61
- var _ref2 = _slicedToArray(_ref, 6),
62
- primaryMasterResult = _ref2[0],
63
- primaryCellTagResult = _ref2[1],
64
- secondaryMastersResult = _ref2[2],
65
- timestampProvidersResult = _ref2[3],
66
- discoveryServersResult = _ref2[4],
67
- queueAgentsResult = _ref2[5];
68
- var batchError = getBatchError([primaryMasterResult, primaryCellTagResult, secondaryMastersResult], "Masters' details cannot be loaded");
69
- if (batchError) {
70
- throw batchError;
71
- }
72
- var error = getBatchError([timestampProvidersResult], 'Timestamp providers cannot be loaded');
73
- if (error && ((_timestampProvidersRe = timestampProvidersResult.error) === null || _timestampProvidersRe === void 0 ? void 0 : _timestampProvidersRe.code) !== yt.codes.NODE_DOES_NOT_EXIST) {
74
- throw error;
75
- }
76
- var queueAgentsError = getBatchError([queueAgentsResult], 'Queue agents cannot be loaded');
77
- if (queueAgentsError && ((_queueAgentsResult$er = queueAgentsResult.error) === null || _queueAgentsResult$er === void 0 ? void 0 : _queueAgentsResult$er.code) !== yt.codes.NODE_DOES_NOT_EXIST) {
78
- throw queueAgentsError;
79
- }
80
- var primaryMaster = primaryMasterResult.output;
81
- var secondaryMasters = secondaryMastersResult.output;
82
- var primaryCellTag = primaryCellTagResult.output;
83
- var timestampProviders = !timestampProvidersResult.output ? {} : {
84
- addresses: _map(ypath.getValue(timestampProvidersResult.output), function (value, address) {
85
- return {
86
- host: address,
87
- physicalHost: ypath.getValue(value, '/@annotations/physical_host'),
88
- attributes: ypath.getValue(value, '/@')
89
- };
90
- }),
91
- cellTag: ypath.getValue(timestampProvidersResult.output, '/@native_cell_tag')
92
- };
93
- return [{
94
- primaryMaster: {
95
- addresses: _map(_keys(primaryMaster), function (address) {
96
- var value = primaryMaster[address];
97
- return {
98
- host: address,
99
- physicalHost: ypath.getValue(value, '/@annotations/physical_host'),
100
- attributes: ypath.getValue(value, '/@')
29
+ var requests, _yield$ytApiV3Id$exec, _yield$ytApiV3Id$exec2, primaryMasterResult, secondaryMastersResult, timestampProvidersResult, discoveryServersResult, queueAgentsResult, batchError, error, queueAgentsError, _ref3, timestamp_path, _ref4, primary_path, tag_cell_requests, _yield$ytApiV3Id$exec3, _yield$ytApiV3Id$exec4, primaryMasterCellTag, timestampProviderCellTag, primaryMaster, secondaryMasters, timestampProviders, mainResult, discoveryRequests, queueAgentsStateRequests, discoveryServersStatuses, queueAgentsStatuses, results, discoveryResults, queueAgentsStateResults;
30
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
31
+ while (1) switch (_context2.prev = _context2.next) {
32
+ case 0:
33
+ requests = [{
34
+ command: 'get',
35
+ parameters: _objectSpread({
36
+ path: '//sys/primary_masters',
37
+ attributes: ['annotations', 'maintenance', 'maintenance_message']
38
+ }, USE_SUPRESS_SYNC)
39
+ }, {
40
+ command: 'get',
41
+ parameters: _objectSpread({
42
+ path: '//sys/secondary_masters',
43
+ attributes: ['annotations', 'maintenance', 'maintenance_message']
44
+ }, USE_SUPRESS_SYNC)
45
+ }, {
46
+ command: 'get',
47
+ parameters: _objectSpread({
48
+ path: '//sys/timestamp_providers',
49
+ attributes: ['annotations', 'maintenance', 'maintenance_message']
50
+ }, USE_SUPRESS_SYNC)
51
+ }, {
52
+ command: 'get',
53
+ parameters: _objectSpread({
54
+ path: '//sys/discovery_servers',
55
+ attributes: ['annotations', 'native_cell_tag']
56
+ }, USE_SUPRESS_SYNC)
57
+ }, {
58
+ command: 'get',
59
+ parameters: _objectSpread({
60
+ path: '//sys/queue_agents/instances',
61
+ attributes: ['annotations', 'maintenance', 'maintenance_message']
62
+ }, USE_SUPRESS_SYNC)
63
+ }];
64
+ _context2.next = 3;
65
+ return ytApiV3Id.executeBatch(YTApiId.systemMastersConfig, {
66
+ requests: requests
67
+ });
68
+ case 3:
69
+ _yield$ytApiV3Id$exec = _context2.sent;
70
+ _yield$ytApiV3Id$exec2 = _slicedToArray(_yield$ytApiV3Id$exec, 5);
71
+ primaryMasterResult = _yield$ytApiV3Id$exec2[0];
72
+ secondaryMastersResult = _yield$ytApiV3Id$exec2[1];
73
+ timestampProvidersResult = _yield$ytApiV3Id$exec2[2];
74
+ discoveryServersResult = _yield$ytApiV3Id$exec2[3];
75
+ queueAgentsResult = _yield$ytApiV3Id$exec2[4];
76
+ batchError = getBatchError([primaryMasterResult, secondaryMastersResult], "Masters' details cannot be loaded");
77
+ if (!batchError) {
78
+ _context2.next = 13;
79
+ break;
80
+ }
81
+ throw batchError;
82
+ case 13:
83
+ error = getBatchError([timestampProvidersResult], 'Timestamp providers cannot be loaded');
84
+ if (!(error && ((_timestampProvidersRe = timestampProvidersResult.error) === null || _timestampProvidersRe === void 0 ? void 0 : _timestampProvidersRe.code) !== NODE_DOES_NOT_EXIST)) {
85
+ _context2.next = 16;
86
+ break;
87
+ }
88
+ throw error;
89
+ case 16:
90
+ queueAgentsError = getBatchError([queueAgentsResult], 'Queue agents cannot be loaded');
91
+ if (!(queueAgentsError && ((_queueAgentsResult$er = queueAgentsResult.error) === null || _queueAgentsResult$er === void 0 ? void 0 : _queueAgentsResult$er.code) !== NODE_DOES_NOT_EXIST)) {
92
+ _context2.next = 19;
93
+ break;
94
+ }
95
+ throw queueAgentsError;
96
+ case 19:
97
+ _ref3 = _toConsumableArray(Object.keys(ypath.getValue(timestampProvidersResult.output))), timestamp_path = _ref3[0];
98
+ _ref4 = _toConsumableArray(Object.keys(ypath.getValue(primaryMasterResult.output))), primary_path = _ref4[0];
99
+ tag_cell_requests = [{
100
+ command: 'get',
101
+ parameters: _objectSpread({
102
+ path: "//sys/primary_masters/".concat(primary_path, "/orchid/config/primary_master/cell_id")
103
+ }, USE_SUPRESS_SYNC)
104
+ }, {
105
+ command: 'get',
106
+ parameters: _objectSpread({
107
+ path: "//sys/timestamp_providers/".concat(timestamp_path, "/orchid/config/clock_cell")
108
+ }, USE_SUPRESS_SYNC)
109
+ }];
110
+ _context2.next = 24;
111
+ return ytApiV3Id.executeBatch(YTApiId.systemMastersConfig, {
112
+ requests: [].concat(tag_cell_requests)
113
+ });
114
+ case 24:
115
+ _yield$ytApiV3Id$exec3 = _context2.sent;
116
+ _yield$ytApiV3Id$exec4 = _slicedToArray(_yield$ytApiV3Id$exec3, 2);
117
+ primaryMasterCellTag = _yield$ytApiV3Id$exec4[0];
118
+ timestampProviderCellTag = _yield$ytApiV3Id$exec4[1];
119
+ primaryMaster = primaryMasterResult.output;
120
+ secondaryMasters = secondaryMastersResult.output;
121
+ timestampProviders = !timestampProvidersResult.output ? {} : {
122
+ addresses: _map(ypath.getValue(timestampProvidersResult.output), function (value, address) {
123
+ return {
124
+ host: address,
125
+ physicalHost: ypath.getValue(value, '/@annotations/physical_host'),
126
+ attributes: ypath.getValue(value, '/@')
127
+ };
128
+ }),
129
+ cellTag: getCellIdTag(ypath.getValue(timestampProviderCellTag.output).cell_id)
130
+ };
131
+ mainResult = {
132
+ primaryMaster: {
133
+ addresses: _map(_keys(primaryMaster), function (address) {
134
+ var value = primaryMaster[address];
135
+ return {
136
+ host: address,
137
+ physicalHost: ypath.getValue(value, '/@annotations/physical_host'),
138
+ attributes: ypath.getValue(value, '/@')
139
+ };
140
+ }),
141
+ cellTag: getCellIdTag(primaryMasterCellTag.output)
142
+ },
143
+ secondaryMasters: _map(secondaryMasters, function (addresses, cellTag) {
144
+ return {
145
+ addresses: _map(_keys(addresses), function (address) {
146
+ var value = secondaryMasters[cellTag][address];
147
+ return {
148
+ host: address,
149
+ physicalHost: ypath.getValue(value, '/@annotations/physical_host'),
150
+ attributes: ypath.getValue(value, '/@')
151
+ };
152
+ }),
153
+ cellTag: Number(cellTag)
154
+ };
155
+ }),
156
+ timestampProviders: timestampProviders,
157
+ discoveryServers: {},
158
+ queueAgents: {}
101
159
  };
102
- }),
103
- cellTag: primaryCellTag
104
- },
105
- secondaryMasters: _map(secondaryMasters, function (addresses, cellTag) {
106
- return {
107
- addresses: _map(_keys(addresses), function (address) {
108
- var value = secondaryMasters[cellTag][address];
160
+ discoveryRequests = _map(ypath.getValue(discoveryServersResult.output), function (_v, address) {
109
161
  return {
110
- host: address,
111
- physicalHost: ypath.getValue(value, '/@annotations/physical_host'),
112
- attributes: ypath.getValue(value, '/@')
162
+ command: 'get',
163
+ parameters: _objectSpread({
164
+ path: "//sys/discovery_servers/".concat(address, "/orchid/discovery_server")
165
+ }, USE_SUPRESS_SYNC),
166
+ address: address
113
167
  };
114
- }),
115
- cellTag: Number(cellTag)
116
- };
117
- }),
118
- timestampProviders: timestampProviders
119
- }, discoveryServersResult, queueAgentsResult];
120
- }).then(function (_ref3) {
121
- var _ref4 = _slicedToArray(_ref3, 3),
122
- mainResult = _ref4[0],
123
- discoveryServersResult = _ref4[1],
124
- queueAgentsResult = _ref4[2];
125
- var discoveryRequests = _map(ypath.getValue(discoveryServersResult.output), function (value, address) {
126
- return {
127
- command: 'get',
128
- parameters: _objectSpread({
129
- path: "//sys/discovery_servers/".concat(address, "/orchid/discovery_server")
130
- }, USE_SUPRESS_SYNC),
131
- address: address
132
- };
133
- });
134
- var queueAgentsStateRequests = _map(ypath.getValue(queueAgentsResult.output), function (value, address) {
135
- return {
136
- command: 'get',
137
- parameters: _objectSpread({
138
- path: "//sys/queue_agents/instances/".concat(address, "/orchid/cypress_synchronizer/active")
139
- }, USE_SUPRESS_SYNC),
140
- address: address
141
- };
142
- });
143
- return ytApiV3Id.executeBatch(YTApiId.systemMastersConfigDiscoveryServer, {
144
- requests: [].concat(_toConsumableArray(discoveryRequests), _toConsumableArray(queueAgentsStateRequests))
145
- }).then(function (results) {
146
- var discoveryResults = results.slice(0, discoveryRequests.length);
147
- var queueAgentsStateResults = results.slice(discoveryRequests.length, queueAgentsStateRequests.length);
148
- var discoveryServersStatuses = _reduce(discoveryResults, function (acc, item, key) {
149
- acc[discoveryRequests[key].address] = item !== null && item !== void 0 && item.error ? 'offline' : 'online';
150
- return acc;
151
- }, {});
152
- var queueAgentsStatuses = _reduce(queueAgentsStateResults, function (acc, item, key) {
153
- acc[queueAgentsStateRequests[key].address] = typeof item.output !== 'undefined' ? item.output ? 'active' : 'standby' : 'offline';
154
- return acc;
155
- }, {});
156
- return [mainResult, discoveryServersResult, queueAgentsResult, discoveryServersStatuses, queueAgentsStatuses];
157
- })["catch"](function () {
158
- return [mainResult, discoveryServersResult, queueAgentsResult];
159
- });
160
- }).then(function (_ref5) {
161
- var _ref6 = _slicedToArray(_ref5, 5),
162
- mainResult = _ref6[0],
163
- discoveryServersResult = _ref6[1],
164
- queueAgentsResult = _ref6[2],
165
- discoveryServersStatuses = _ref6[3],
166
- queueAgentsStatuses = _ref6[4];
167
- mainResult.discoveryServers = discoveryServersResult.output ? {
168
- addresses: _map(ypath.getValue(discoveryServersResult.output), function (value, address) {
169
- return {
170
- host: address,
171
- physicalHost: ypath.getValue(value, '/@annotations/physical_host'),
172
- attributes: ypath.getValue(value, '/@'),
173
- state: discoveryServersStatuses[address]
174
- };
175
- }),
176
- cellTag: ypath.getValue(discoveryServersResult.output, '/@native_cell_tag')
177
- } : {};
178
- mainResult.queueAgents = queueAgentsResult.output ? {
179
- addresses: _map(ypath.getValue(queueAgentsResult.output), function (value, address) {
180
- return {
181
- host: address,
182
- physicalHost: ypath.getValue(value, '/@annotations/physical_host'),
183
- attributes: ypath.getValue(value, '/@'),
184
- state: queueAgentsStatuses[address]
185
- };
186
- })
187
- } : {};
188
- return mainResult;
189
- });
168
+ });
169
+ queueAgentsStateRequests = _map(ypath.getValue(queueAgentsResult.output), function (_v, address) {
170
+ return {
171
+ command: 'get',
172
+ parameters: _objectSpread({
173
+ path: "//sys/queue_agents/instances/".concat(address, "/orchid/cypress_synchronizer/active")
174
+ }, USE_SUPRESS_SYNC),
175
+ address: address
176
+ };
177
+ });
178
+ discoveryServersStatuses = {};
179
+ queueAgentsStatuses = {};
180
+ _context2.prev = 36;
181
+ _context2.next = 39;
182
+ return ytApiV3Id.executeBatch(YTApiId.systemMastersConfigDiscoveryServer, {
183
+ requests: [].concat(_toConsumableArray(discoveryRequests), _toConsumableArray(queueAgentsStateRequests))
184
+ });
185
+ case 39:
186
+ results = _context2.sent;
187
+ discoveryResults = results.slice(0, discoveryRequests.length);
188
+ queueAgentsStateResults = results.slice(discoveryRequests.length, queueAgentsStateRequests.length);
189
+ discoveryServersStatuses = _reduce(discoveryResults, function (acc, item, key) {
190
+ acc[discoveryRequests[key].address] = item !== null && item !== void 0 && item.error ? 'offline' : 'online';
191
+ return acc;
192
+ }, {});
193
+ queueAgentsStatuses = _reduce(queueAgentsStateResults, function (acc, item, key) {
194
+ acc[queueAgentsStateRequests[key].address] = typeof item.output !== 'undefined' ? item.output ? 'active' : 'standby' : 'offline';
195
+ return acc;
196
+ }, {});
197
+ _context2.next = 48;
198
+ break;
199
+ case 46:
200
+ _context2.prev = 46;
201
+ _context2.t0 = _context2["catch"](36);
202
+ case 48:
203
+ mainResult.discoveryServers = discoveryServersResult.output ? {
204
+ addresses: _map(ypath.getValue(discoveryServersResult.output), function (value, address) {
205
+ return {
206
+ host: address,
207
+ physicalHost: ypath.getValue(value, '/@annotations/physical_host'),
208
+ attributes: ypath.getValue(value, '/@'),
209
+ state: discoveryServersStatuses[address]
210
+ };
211
+ }),
212
+ cellTag: ypath.getValue(discoveryServersResult.output, '/@native_cell_tag')
213
+ } : {};
214
+ mainResult.queueAgents = queueAgentsResult.output ? {
215
+ addresses: _map(ypath.getValue(queueAgentsResult.output), function (value, address) {
216
+ return {
217
+ host: address,
218
+ physicalHost: ypath.getValue(value, '/@annotations/physical_host'),
219
+ attributes: ypath.getValue(value, '/@'),
220
+ state: queueAgentsStatuses[address]
221
+ };
222
+ })
223
+ } : {};
224
+ return _context2.abrupt("return", mainResult);
225
+ case 51:
226
+ case "end":
227
+ return _context2.stop();
228
+ }
229
+ }, _callee2, null, [[36, 46]]);
230
+ }));
231
+ return _loadMastersConfig.apply(this, arguments);
190
232
  }
191
233
  function loadHydra(requests, masterInfo, type, masterEntry) {
192
234
  var addresses = masterEntry.addresses,
@@ -206,8 +248,8 @@ function loadHydra(requests, masterInfo, type, masterEntry) {
206
248
  }
207
249
  _each(_sortBy(addresses, function (address) {
208
250
  return address.host;
209
- }), function (_ref7) {
210
- var host = _ref7.host;
251
+ }), function (_ref) {
252
+ var host = _ref.host;
211
253
  masterInfo.push({
212
254
  host: host,
213
255
  type: type,
@@ -216,72 +258,100 @@ function loadHydra(requests, masterInfo, type, masterEntry) {
216
258
  requests.push({
217
259
  command: 'get',
218
260
  parameters: _objectSpread({
219
- path: cypressPath + '/' + host + hydraPath,
220
- timeout: 5000
261
+ path: cypressPath + '/' + host + hydraPath
221
262
  }, USE_SUPRESS_SYNC)
222
263
  });
223
264
  });
224
265
  }
225
266
  export function loadMasters() {
226
- return function (dispatch) {
227
- dispatch({
228
- type: FETCH_MASTER_CONFIG.REQUEST
229
- });
230
- return loadMastersConfig().then(function (config) {
231
- dispatch({
232
- type: FETCH_MASTER_CONFIG.SUCCESS,
233
- data: config
234
- });
235
- dispatch({
236
- type: FETCH_MASTER_DATA.REQUEST
237
- });
238
- var masterDataRequests = [];
239
- var masterInfo = [];
240
- loadHydra(masterDataRequests, masterInfo, 'primary', config.primaryMaster);
241
- _each(config.secondaryMasters, function (currentConfig) {
242
- loadHydra(masterDataRequests, masterInfo, 'secondary', currentConfig);
243
- });
244
- loadHydra(masterDataRequests, masterInfo, 'providers', config.timestampProviders);
245
- loadHydra(masterDataRequests, masterInfo, 'discovery', config.discoveryServers);
246
- return ytApiV3Id.executeBatch(YTApiId.systemMasters, {
247
- requests: masterDataRequests
248
- }).then(function (data) {
249
- dispatch({
250
- type: FETCH_MASTER_DATA.SUCCESS,
251
- data: {
252
- masterInfo: masterInfo,
253
- data: data
254
- }
255
- });
256
- });
257
- })["catch"](function (error) {
258
- var _error$response;
259
- dispatch({
260
- type: FETCH_MASTER_DATA.FAILURE,
261
- data: error
262
- });
263
- var data = (error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) || error;
264
- var code = data.code,
265
- message = data.message;
266
- toaster.add({
267
- name: 'load/system/masters',
268
- autoHiding: false,
269
- type: 'error',
270
- content: "[code ".concat(code, "] ").concat(message),
271
- title: 'Could not load Masters',
272
- actions: [{
273
- label: ' view',
274
- onClick: function onClick() {
275
- return showErrorPopup(error);
276
- }
277
- }]
278
- });
279
- if (isRetryFutile(error.code)) {
280
- return {
281
- isRetryFutile: true
282
- };
283
- }
284
- });
285
- };
267
+ return /*#__PURE__*/function () {
268
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch) {
269
+ var config, masterDataRequests, masterInfo, data, _response, _data, code, message;
270
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
271
+ while (1) switch (_context.prev = _context.next) {
272
+ case 0:
273
+ dispatch({
274
+ type: FETCH_MASTER_CONFIG.REQUEST
275
+ });
276
+ _context.prev = 1;
277
+ _context.next = 4;
278
+ return loadMastersConfig();
279
+ case 4:
280
+ config = _context.sent;
281
+ dispatch({
282
+ type: FETCH_MASTER_CONFIG.SUCCESS,
283
+ data: config
284
+ });
285
+ dispatch({
286
+ type: FETCH_MASTER_DATA.REQUEST
287
+ });
288
+ masterDataRequests = [];
289
+ masterInfo = [];
290
+ loadHydra(masterDataRequests, masterInfo, 'primary', config.primaryMaster);
291
+ _each(config.secondaryMasters, function (currentConfig) {
292
+ loadHydra(masterDataRequests, masterInfo, 'secondary', currentConfig);
293
+ });
294
+ loadHydra(masterDataRequests, masterInfo, 'providers', config.timestampProviders);
295
+ loadHydra(masterDataRequests, masterInfo, 'discovery', config.discoveryServers);
296
+ _context.next = 15;
297
+ return ytApiV3Id.executeBatch(YTApiId.systemMasters, {
298
+ requests: masterDataRequests
299
+ });
300
+ case 15:
301
+ data = _context.sent;
302
+ dispatch({
303
+ type: FETCH_MASTER_DATA.SUCCESS,
304
+ data: {
305
+ masterInfo: masterInfo,
306
+ data: data
307
+ }
308
+ });
309
+ _context.next = 27;
310
+ break;
311
+ case 19:
312
+ _context.prev = 19;
313
+ _context.t0 = _context["catch"](1);
314
+ dispatch({
315
+ type: FETCH_MASTER_DATA.FAILURE,
316
+ data: _context.t0
317
+ });
318
+ _data = (_context.t0 === null || _context.t0 === void 0 || (_response = _context.t0.response) === null || _response === void 0 ? void 0 : _response.data) || _context.t0;
319
+ code = _data.code, message = _data.message;
320
+ toaster.add({
321
+ name: 'load/system/masters',
322
+ autoHiding: false,
323
+ type: 'error',
324
+ content: "[code ".concat(code, "] ").concat(message),
325
+ title: 'Could not load Masters',
326
+ actions: [{
327
+ label: ' view',
328
+ onClick: function onClick() {
329
+ return showErrorPopup(_context.t0);
330
+ }
331
+ }]
332
+ });
333
+ if (!isRetryFutile(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.code)) {
334
+ _context.next = 27;
335
+ break;
336
+ }
337
+ return _context.abrupt("return", {
338
+ isRetryFutile: true
339
+ });
340
+ case 27:
341
+ case "end":
342
+ return _context.stop();
343
+ }
344
+ }, _callee, null, [[1, 19]]);
345
+ }));
346
+ return function (_x) {
347
+ return _ref2.apply(this, arguments);
348
+ };
349
+ }();
350
+ }
351
+ function getCellIdTag(uuid) {
352
+ var _uuid$split = uuid.split('-'),
353
+ _uuid$split2 = _slicedToArray(_uuid$split, 3),
354
+ third = _uuid$split2[2];
355
+ return Number("0x".concat(third.substring(0, third.length - 4)));
286
356
  }
287
357
  // #sourceMappingURL=masters.js.map