ydb-embedded-ui 0.1.0

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 (285) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +28 -0
  3. package/dist/HOCS/WithSearch/WithSearch.js +26 -0
  4. package/dist/HOCS/index.js +1 -0
  5. package/dist/assets/icons/bug.svg +1 -0
  6. package/dist/assets/icons/close.svg +1 -0
  7. package/dist/assets/icons/control-menu-button.svg +1 -0
  8. package/dist/assets/icons/databases.svg +3 -0
  9. package/dist/assets/icons/dots.svg +1 -0
  10. package/dist/assets/icons/server.svg +1 -0
  11. package/dist/assets/icons/settings-with-dot.svg +1 -0
  12. package/dist/assets/icons/settings.svg +1 -0
  13. package/dist/assets/icons/signIn.svg +1 -0
  14. package/dist/assets/icons/signOut.svg +1 -0
  15. package/dist/assets/icons/star.svg +1 -0
  16. package/dist/assets/icons/storage.svg +1 -0
  17. package/dist/assets/icons/support.svg +1 -0
  18. package/dist/assets/icons/user-check.svg +1 -0
  19. package/dist/assets/icons/user-secret.svg +1 -0
  20. package/dist/assets/icons/ydb.svg +4 -0
  21. package/dist/components/AsideNavigation/AsideHeader.scss +148 -0
  22. package/dist/components/AsideNavigation/AsideHeader.tsx +388 -0
  23. package/dist/components/AsideNavigation/AsideHeaderFooterItem/AsideHeaderFooterItem.scss +82 -0
  24. package/dist/components/AsideNavigation/AsideHeaderFooterItem/AsideHeaderFooterItem.tsx +138 -0
  25. package/dist/components/AsideNavigation/AsideHeaderFooterSlot/AsideHeaderFooterSlot.tsx +33 -0
  26. package/dist/components/AsideNavigation/AsideHeaderFooterSlot/SlotsContext.tsx +49 -0
  27. package/dist/components/AsideNavigation/AsideHeaderTooltip/AsideHeaderTooltip.scss +16 -0
  28. package/dist/components/AsideNavigation/AsideHeaderTooltip/AsideHeaderTooltip.tsx +37 -0
  29. package/dist/components/AsideNavigation/CompositeBar/CompositeBar.scss +108 -0
  30. package/dist/components/AsideNavigation/CompositeBar/CompositeBar.tsx +282 -0
  31. package/dist/components/AsideNavigation/Content/Content.tsx +35 -0
  32. package/dist/components/AsideNavigation/Drawer/Drawer.scss +76 -0
  33. package/dist/components/AsideNavigation/Drawer/Drawer.tsx +134 -0
  34. package/dist/components/AsideNavigation/Drawer/index.ts +1 -0
  35. package/dist/components/AsideNavigation/Logo/Logo.scss +44 -0
  36. package/dist/components/AsideNavigation/Logo/Logo.tsx +82 -0
  37. package/dist/components/AsideNavigation/Settings/README.md +92 -0
  38. package/dist/components/AsideNavigation/Settings/Settings.scss +113 -0
  39. package/dist/components/AsideNavigation/Settings/Settings.tsx +270 -0
  40. package/dist/components/AsideNavigation/Settings/SettingsMenu/SettingsMenu.scss +70 -0
  41. package/dist/components/AsideNavigation/Settings/SettingsMenu/SettingsMenu.tsx +141 -0
  42. package/dist/components/AsideNavigation/Settings/SettingsSearch/SettingsSearch.tsx +57 -0
  43. package/dist/components/AsideNavigation/Settings/collect-settings.ts +156 -0
  44. package/dist/components/AsideNavigation/Settings/filter-settings.ts +38 -0
  45. package/dist/components/AsideNavigation/Settings/helpers.ts +39 -0
  46. package/dist/components/AsideNavigation/Settings/i18n/en.json +5 -0
  47. package/dist/components/AsideNavigation/Settings/i18n/index.ts +11 -0
  48. package/dist/components/AsideNavigation/Settings/i18n/ru.json +5 -0
  49. package/dist/components/AsideNavigation/Settings/index.ts +1 -0
  50. package/dist/components/AsideNavigation/constants.ts +28 -0
  51. package/dist/components/AsideNavigation/helpers.ts +34 -0
  52. package/dist/components/AsideNavigation/i18n/en.json +4 -0
  53. package/dist/components/AsideNavigation/i18n/index.ts +11 -0
  54. package/dist/components/AsideNavigation/i18n/ru.json +4 -0
  55. package/dist/components/AsideNavigation/icons.ts +32 -0
  56. package/dist/components/AsideNavigation/types.ts +23 -0
  57. package/dist/components/Breadcrumbs/Breadcrumbs.js +25 -0
  58. package/dist/components/Breadcrumbs/Breadcrumbs.scss +4 -0
  59. package/dist/components/ClusterInfo/ClusterInfo.scss +65 -0
  60. package/dist/components/ClusterInfo/ClusterInfo.tsx +157 -0
  61. package/dist/components/Collapse/Collapse.js +84 -0
  62. package/dist/components/Collapse/Collapse.scss +70 -0
  63. package/dist/components/CriticalActionDialog/CriticalActionDialog.js +53 -0
  64. package/dist/components/CriticalActionDialog/CriticalActionDialog.scss +31 -0
  65. package/dist/components/EmptyState/EmptyState.js +48 -0
  66. package/dist/components/EmptyState/EmptyState.scss +70 -0
  67. package/dist/components/EntityStatus/EntityStatus.js +96 -0
  68. package/dist/components/EntityStatus/EntityStatus.scss +81 -0
  69. package/dist/components/FullGroupViewer/FullGroupViewer.js +149 -0
  70. package/dist/components/FullGroupViewer/FullGroupViewer.scss +32 -0
  71. package/dist/components/FullNodeViewer/FullNodeViewer.js +108 -0
  72. package/dist/components/FullNodeViewer/FullNodeViewer.scss +78 -0
  73. package/dist/components/GroupTreeViewer/GroupTreeViewer.js +86 -0
  74. package/dist/components/GroupTreeViewer/GroupTreeViewer.scss +17 -0
  75. package/dist/components/GroupViewer/GroupViewer.js +100 -0
  76. package/dist/components/GroupViewer/GroupViewer.scss +41 -0
  77. package/dist/components/Hotkey/Hotkey.js +102 -0
  78. package/dist/components/Icon/Icon.js +26 -0
  79. package/dist/components/InfoViewer/InfoViewer.js +47 -0
  80. package/dist/components/InfoViewer/InfoViewer.scss +48 -0
  81. package/dist/components/InternalLink/InternalLink.js +15 -0
  82. package/dist/components/NodesViewer/NodesViewer.js +183 -0
  83. package/dist/components/NodesViewer/NodesViewer.scss +66 -0
  84. package/dist/components/PDiskViewer/PDiskViewer.js +80 -0
  85. package/dist/components/PDiskViewer/PDiskViewer.scss +40 -0
  86. package/dist/components/Pagination/Pagination.js +63 -0
  87. package/dist/components/Pagination/Pagination.scss +25 -0
  88. package/dist/components/PoolBar/PoolBar.js +52 -0
  89. package/dist/components/PoolBar/PoolBar.scss +40 -0
  90. package/dist/components/PoolUsage/PoolUsage.js +54 -0
  91. package/dist/components/PoolUsage/PoolUsage.scss +65 -0
  92. package/dist/components/PoolsGraph/PoolsGraph.js +33 -0
  93. package/dist/components/PoolsGraph/PoolsGraph.scss +3 -0
  94. package/dist/components/ProblemFilter/ProblemFilter.js +24 -0
  95. package/dist/components/ProgressViewer/ProgressViewer.js +92 -0
  96. package/dist/components/ProgressViewer/ProgressViewer.scss +84 -0
  97. package/dist/components/SplitPane/SplitPane.js +368 -0
  98. package/dist/components/SplitPane/SplitPane.scss +107 -0
  99. package/dist/components/SplitPane/index.js +3 -0
  100. package/dist/components/Tablet/Tablet.js +61 -0
  101. package/dist/components/Tablet/Tablet.scss +49 -0
  102. package/dist/components/TabletsStatistic/TabletsStatistic.js +58 -0
  103. package/dist/components/TabletsStatistic/TabletsStatistic.scss +41 -0
  104. package/dist/components/TabletsViewer/TabletsViewer.js +44 -0
  105. package/dist/components/TabletsViewer/TabletsViewer.scss +37 -0
  106. package/dist/components/Tag/Tag.js +14 -0
  107. package/dist/components/Tag/Tag.scss +17 -0
  108. package/dist/components/Tags/Tags.js +36 -0
  109. package/dist/components/Tags/Tags.scss +5 -0
  110. package/dist/components/TenantOverview/TenantOverview.js +148 -0
  111. package/dist/components/TenantOverview/TenantOverview.scss +75 -0
  112. package/dist/components/TreeView/TreeView.js +60 -0
  113. package/dist/components/TreeView/TreeView.scss +30 -0
  114. package/dist/components/TruncatedQuery/TruncatedQuery.js +26 -0
  115. package/dist/components/TruncatedQuery/TruncatedQuery.scss +12 -0
  116. package/dist/containers/App/App.js +67 -0
  117. package/dist/containers/App/App.scss +154 -0
  118. package/dist/containers/App/Content.js +109 -0
  119. package/dist/containers/App/TipPopup/TipPopup.js +66 -0
  120. package/dist/containers/App/TipPopup/TipPopup.scss +42 -0
  121. package/dist/containers/AppIcons/AppIcons.js +477 -0
  122. package/dist/containers/AsideNavigation/AsideNavigation.scss +43 -0
  123. package/dist/containers/AsideNavigation/AsideNavigation.tsx +228 -0
  124. package/dist/containers/Authentication/Authentication.scss +37 -0
  125. package/dist/containers/Authentication/Authentication.tsx +89 -0
  126. package/dist/containers/Cluster/Cluster.js +168 -0
  127. package/dist/containers/Cluster/Cluster.scss +52 -0
  128. package/dist/containers/Group/Group.js +97 -0
  129. package/dist/containers/Group/Group.scss +6 -0
  130. package/dist/containers/Header/Header.js +88 -0
  131. package/dist/containers/Header/Header.scss +72 -0
  132. package/dist/containers/Header/Host/Host.js +66 -0
  133. package/dist/containers/Header/Host/Host.scss +43 -0
  134. package/dist/containers/Heatmap/Heatmap.js +246 -0
  135. package/dist/containers/Heatmap/Heatmap.scss +94 -0
  136. package/dist/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.js +167 -0
  137. package/dist/containers/Heatmap/Histogram/Histogram.js +108 -0
  138. package/dist/containers/Heatmap/Histogram/Histogram.scss +49 -0
  139. package/dist/containers/Heatmap/util.js +110 -0
  140. package/dist/containers/Node/Node.js +184 -0
  141. package/dist/containers/Node/Node.scss +34 -0
  142. package/dist/containers/Node/NodePages.js +13 -0
  143. package/dist/containers/Nodes/Nodes.js +193 -0
  144. package/dist/containers/Nodes/Nodes.scss +50 -0
  145. package/dist/containers/Pdisk/Pdisk.js +159 -0
  146. package/dist/containers/Pdisk/Pdisk.scss +40 -0
  147. package/dist/containers/Pool/Pool.js +169 -0
  148. package/dist/containers/Pool/Pool.scss +32 -0
  149. package/dist/containers/ReduxTooltip/ReduxTooltip.js +108 -0
  150. package/dist/containers/ReduxTooltip/ReduxTooltip.scss +67 -0
  151. package/dist/containers/StorageV2/DiskStateProgressBar/DiskStateProgressBar.scss +81 -0
  152. package/dist/containers/StorageV2/DiskStateProgressBar/DiskStateProgressBar.tsx +56 -0
  153. package/dist/containers/StorageV2/Pdisk/Pdisk.scss +32 -0
  154. package/dist/containers/StorageV2/Pdisk/Pdisk.tsx +167 -0
  155. package/dist/containers/StorageV2/Storage.js +249 -0
  156. package/dist/containers/StorageV2/Storage.scss +57 -0
  157. package/dist/containers/StorageV2/StorageFilter/StorageFilter.js +39 -0
  158. package/dist/containers/StorageV2/StorageGroups/StorageGroups.scss +26 -0
  159. package/dist/containers/StorageV2/StorageGroups/StorageGroups.tsx +234 -0
  160. package/dist/containers/StorageV2/StorageNodes/StorageNodes.scss +30 -0
  161. package/dist/containers/StorageV2/StorageNodes/StorageNodes.tsx +135 -0
  162. package/dist/containers/StorageV2/Vdisk/Vdisk.js +250 -0
  163. package/dist/containers/StorageV2/Vdisk/Vdisk.scss +32 -0
  164. package/dist/containers/Tablet/Tablet.js +453 -0
  165. package/dist/containers/Tablet/Tablet.scss +88 -0
  166. package/dist/containers/Tablets/Tablets.js +306 -0
  167. package/dist/containers/Tablets/Tablets.scss +77 -0
  168. package/dist/containers/TabletsFilters/TabletsFilters.js +412 -0
  169. package/dist/containers/TabletsFilters/TabletsFilters.scss +104 -0
  170. package/dist/containers/Tenant/Acl/Acl.js +149 -0
  171. package/dist/containers/Tenant/Acl/Acl.scss +34 -0
  172. package/dist/containers/Tenant/Compute/Compute.js +110 -0
  173. package/dist/containers/Tenant/Compute/Compute.scss +6 -0
  174. package/dist/containers/Tenant/Describe/Describe.js +81 -0
  175. package/dist/containers/Tenant/Describe/Describe.scss +25 -0
  176. package/dist/containers/Tenant/Healthcheck/Healthcheck.js +116 -0
  177. package/dist/containers/Tenant/Healthcheck/Healthcheck.scss +64 -0
  178. package/dist/containers/Tenant/Healthcheck/IssuesViewer/IssueViewer.scss +164 -0
  179. package/dist/containers/Tenant/Healthcheck/IssuesViewer/IssuesViewer.js +185 -0
  180. package/dist/containers/Tenant/Network/Network.js +341 -0
  181. package/dist/containers/Tenant/Network/Network.scss +145 -0
  182. package/dist/containers/Tenant/Network/NodeNetwork/NodeNetwork.js +71 -0
  183. package/dist/containers/Tenant/Network/NodeNetwork/NodeNetwork.scss +52 -0
  184. package/dist/containers/Tenant/Preview/Preview.js +169 -0
  185. package/dist/containers/Tenant/Preview/Preview.scss +20 -0
  186. package/dist/containers/Tenant/QueryEditor/QueryEditor.js +649 -0
  187. package/dist/containers/Tenant/QueryEditor/QueryEditor.scss +71 -0
  188. package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.js +168 -0
  189. package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.scss +42 -0
  190. package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.js +58 -0
  191. package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.scss +24 -0
  192. package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.js +171 -0
  193. package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.scss +51 -0
  194. package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.js +156 -0
  195. package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.scss +82 -0
  196. package/dist/containers/Tenant/Schema/HotKeys/HotKeys.js +149 -0
  197. package/dist/containers/Tenant/Schema/HotKeys/HotKeys.scss +48 -0
  198. package/dist/containers/Tenant/Schema/Info/Info.js +84 -0
  199. package/dist/containers/Tenant/Schema/Info/Info.scss +3 -0
  200. package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.js +67 -0
  201. package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.scss +21 -0
  202. package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.js +439 -0
  203. package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.scss +90 -0
  204. package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.js +150 -0
  205. package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.scss +41 -0
  206. package/dist/containers/Tenant/Schema/SchemaPages.js +56 -0
  207. package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +115 -0
  208. package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.scss +13 -0
  209. package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +63 -0
  210. package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.scss +28 -0
  211. package/dist/containers/Tenant/Tenant.js +199 -0
  212. package/dist/containers/Tenant/Tenant.scss +94 -0
  213. package/dist/containers/Tenant/TenantPages.js +35 -0
  214. package/dist/containers/Tenant/TopQueries/TopQueries.js +184 -0
  215. package/dist/containers/Tenant/TopQueries/TopQueries.scss +53 -0
  216. package/dist/containers/Tenant/TopShards/TopShards.js +171 -0
  217. package/dist/containers/Tenant/TopShards/TopShards.scss +23 -0
  218. package/dist/containers/Tenants/Tenants.js +375 -0
  219. package/dist/containers/Tenants/Tenants.scss +73 -0
  220. package/dist/containers/UserSettings/UserSettings.tsx +57 -0
  221. package/dist/containers/Vdisk/Vdisk.js +160 -0
  222. package/dist/containers/Vdisk/Vdisk.scss +40 -0
  223. package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.js +528 -0
  224. package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.scss +60 -0
  225. package/dist/contexts/HistoryContext.ts +6 -0
  226. package/dist/index.css +11 -0
  227. package/dist/index.js +28 -0
  228. package/dist/index.test.js +5 -0
  229. package/dist/react-app-env.d.ts +1 -0
  230. package/dist/reportWebVitals.js +13 -0
  231. package/dist/routes.js +40 -0
  232. package/dist/services/api.js +224 -0
  233. package/dist/setupTests.js +5 -0
  234. package/dist/store/index.js +61 -0
  235. package/dist/store/reducers/authentication.js +77 -0
  236. package/dist/store/reducers/cluster.js +52 -0
  237. package/dist/store/reducers/clusterInfo.js +48 -0
  238. package/dist/store/reducers/clusterNodes.js +70 -0
  239. package/dist/store/reducers/describe.js +45 -0
  240. package/dist/store/reducers/executeQuery.js +158 -0
  241. package/dist/store/reducers/executeTopQueries.js +69 -0
  242. package/dist/store/reducers/explainQuery.js +174 -0
  243. package/dist/store/reducers/group.js +49 -0
  244. package/dist/store/reducers/healthcheckInfo.js +45 -0
  245. package/dist/store/reducers/heatmap.js +105 -0
  246. package/dist/store/reducers/host.js +44 -0
  247. package/dist/store/reducers/hotKeys.js +57 -0
  248. package/dist/store/reducers/index.js +78 -0
  249. package/dist/store/reducers/network.js +45 -0
  250. package/dist/store/reducers/node.js +42 -0
  251. package/dist/store/reducers/nodes.js +58 -0
  252. package/dist/store/reducers/olapStats.js +74 -0
  253. package/dist/store/reducers/pdisk.js +51 -0
  254. package/dist/store/reducers/pool.js +42 -0
  255. package/dist/store/reducers/preview.js +73 -0
  256. package/dist/store/reducers/schema.js +95 -0
  257. package/dist/store/reducers/schemaAcl.js +44 -0
  258. package/dist/store/reducers/settings.js +76 -0
  259. package/dist/store/reducers/shardsWorkload.js +75 -0
  260. package/dist/store/reducers/storage.js +280 -0
  261. package/dist/store/reducers/tablet.js +94 -0
  262. package/dist/store/reducers/tablets.js +90 -0
  263. package/dist/store/reducers/tabletsFilters.js +126 -0
  264. package/dist/store/reducers/tenant.js +76 -0
  265. package/dist/store/reducers/tenants.js +61 -0
  266. package/dist/store/reducers/tooltip.js +64 -0
  267. package/dist/store/reducers/vdisk.js +49 -0
  268. package/dist/store/state-url-mapping.js +133 -0
  269. package/dist/store/utils.js +55 -0
  270. package/dist/styles/mixins.scss +254 -0
  271. package/dist/styles/react-treeview.scss +45 -0
  272. package/dist/types/assets.d.ts +12 -0
  273. package/dist/types/react-list.d.ts +4 -0
  274. package/dist/types/window.d.ts +33 -0
  275. package/dist/utils/actionsConstants.js +4 -0
  276. package/dist/utils/constants.js +126 -0
  277. package/dist/utils/getNodesColumns.js +156 -0
  278. package/dist/utils/i18n/i18n.ts +7 -0
  279. package/dist/utils/i18n/index.ts +1 -0
  280. package/dist/utils/index.js +136 -0
  281. package/dist/utils/monaco.js +69 -0
  282. package/dist/utils/prepareQueryExplain.ts +101 -0
  283. package/dist/utils/tooltip.js +197 -0
  284. package/dist/utils/utils.js +75 -0
  285. package/package.json +89 -0
@@ -0,0 +1,158 @@
1
+ import {createRequestActionTypes, createApiRequest} from '../utils';
2
+ import '../../services/api';
3
+
4
+ const SEND_QUERY = createRequestActionTypes('query', 'SEND_QUERY');
5
+ const CHANGE_USER_INPUT = 'query/CHANGE_USER_INPUT';
6
+ const SAVE_QUERY_TO_HISTORY = 'query/SAVE_QUERY_TO_HISTORY';
7
+ const GO_TO_PREVIOUS_QUERY = 'query/GO_TO_PREVIOUS_QUERY';
8
+ const GO_TO_NEXT_QUERY = 'query/GO_TO_NEXT_QUERY';
9
+ const SELECT_RUN_ACTION = 'query/SELECT_RUN_ACTION';
10
+
11
+ export const RUN_ACTIONS_VALUES = {
12
+ script: 'execute-script',
13
+ scan: 'execute-scan',
14
+ };
15
+
16
+ const initialState = {
17
+ loading: false,
18
+ input: '',
19
+ history: {
20
+ queries: [],
21
+ currentIndex: -1,
22
+ },
23
+ runAction: RUN_ACTIONS_VALUES.script,
24
+ };
25
+
26
+ const executeQuery = (state = initialState, action) => {
27
+ switch (action.type) {
28
+ case SEND_QUERY.REQUEST: {
29
+ return {
30
+ ...state,
31
+ loading: true,
32
+ data: undefined,
33
+ error: undefined,
34
+ };
35
+ }
36
+ case SEND_QUERY.SUCCESS: {
37
+ return {
38
+ ...state,
39
+ data: action.data.result ?? action.data,
40
+ stats: action.data.stats,
41
+ loading: false,
42
+ error: undefined,
43
+ };
44
+ }
45
+ // 401 Unauthorized error is handled by GenericAPI
46
+ case SEND_QUERY.FAILURE: {
47
+ return {
48
+ ...state,
49
+ error: action.error || 'Unauthorized',
50
+ loading: false,
51
+ };
52
+ }
53
+
54
+ case SELECT_RUN_ACTION: {
55
+ return {
56
+ ...state,
57
+ runAction: action.data,
58
+ };
59
+ }
60
+
61
+ case CHANGE_USER_INPUT: {
62
+ return {
63
+ ...state,
64
+ input: action.data.input,
65
+ };
66
+ }
67
+
68
+ case SAVE_QUERY_TO_HISTORY: {
69
+ const query = action.data;
70
+ const newQueries = [...state.history.queries, query];
71
+ const currentIndex = newQueries.length - 1;
72
+
73
+ return {
74
+ ...state,
75
+ history: {
76
+ queries: newQueries,
77
+ currentIndex,
78
+ },
79
+ };
80
+ }
81
+
82
+ case GO_TO_PREVIOUS_QUERY: {
83
+ const newCurrentIndex = Math.max(0, state.history.currentIndex - 1);
84
+
85
+ return {
86
+ ...state,
87
+ history: {
88
+ ...state.history,
89
+ currentIndex: newCurrentIndex,
90
+ },
91
+ };
92
+ }
93
+
94
+ case GO_TO_NEXT_QUERY: {
95
+ const lastIndexInHistory = state.history.queries.length - 1;
96
+ const newCurrentIndex = Math.min(lastIndexInHistory, state.history.currentIndex + 1);
97
+
98
+ return {
99
+ ...state,
100
+ history: {
101
+ ...state.history,
102
+ currentIndex: newCurrentIndex,
103
+ },
104
+ };
105
+ }
106
+
107
+ default:
108
+ return state;
109
+ }
110
+ };
111
+
112
+ export const sendQuery = ({query, database, action}) => {
113
+ return createApiRequest({
114
+ request: window.api.sendQuery(query, database, action, 'profile'),
115
+ actions: SEND_QUERY,
116
+ dataHandler: (result) => {
117
+ const resultData = result.result ?? result;
118
+ if (resultData && typeof resultData === 'string') {
119
+ throw 'Unexpected token in JSON.';
120
+ }
121
+ return result;
122
+ },
123
+ });
124
+ };
125
+
126
+ export const saveQueryToHistory = (query) => {
127
+ return {
128
+ type: SAVE_QUERY_TO_HISTORY,
129
+ data: query,
130
+ };
131
+ };
132
+
133
+ export const selectRunAction = (value) => {
134
+ return {
135
+ type: SELECT_RUN_ACTION,
136
+ data: value,
137
+ };
138
+ };
139
+
140
+ export const goToPreviousQuery = () => {
141
+ return {
142
+ type: GO_TO_PREVIOUS_QUERY,
143
+ };
144
+ };
145
+
146
+ export const goToNextQuery = () => {
147
+ return {
148
+ type: GO_TO_NEXT_QUERY,
149
+ };
150
+ };
151
+
152
+ export const changeUserInput = ({input}) => {
153
+ return (dispatch) => {
154
+ dispatch({type: CHANGE_USER_INPUT, data: {input}});
155
+ };
156
+ };
157
+
158
+ export default executeQuery;
@@ -0,0 +1,69 @@
1
+ import {createRequestActionTypes, createApiRequest} from '../utils';
2
+ import '../../services/api';
3
+
4
+ const SEND_QUERY = createRequestActionTypes('top-queries', 'SEND_QUERY');
5
+ const SET_QUERY_OPTIONS = createRequestActionTypes('top-queries', 'SET_QUERY_OPTIONS');
6
+
7
+ const initialState = {
8
+ loading: false,
9
+ wasLoaded: false,
10
+ };
11
+
12
+ const executeTopQueries = (state = initialState, action) => {
13
+ switch (action.type) {
14
+ case SEND_QUERY.REQUEST: {
15
+ return {
16
+ ...state,
17
+ loading: true,
18
+ error: undefined,
19
+ };
20
+ }
21
+ case SEND_QUERY.SUCCESS: {
22
+ return {
23
+ ...state,
24
+ data: action.data,
25
+ loading: false,
26
+ error: undefined,
27
+ wasLoaded: true,
28
+ };
29
+ }
30
+ // 401 Unauthorized error is handled by GenericAPI
31
+ case SEND_QUERY.FAILURE: {
32
+ return {
33
+ ...state,
34
+ error: action.error || 'Unauthorized',
35
+ loading: false,
36
+ };
37
+ }
38
+ case SET_QUERY_OPTIONS:
39
+ return {
40
+ ...state,
41
+ ...action.data,
42
+ };
43
+ default:
44
+ return state;
45
+ }
46
+ };
47
+
48
+ export const sendQuery = ({query, database, action}) => {
49
+ return createApiRequest({
50
+ request: window.api.sendQuery(query, database, action),
51
+ actions: SEND_QUERY,
52
+ dataHandler: (result) => {
53
+ if (result && typeof result === 'string') {
54
+ throw 'Unexpected token in JSON.';
55
+ }
56
+
57
+ return result;
58
+ },
59
+ });
60
+ };
61
+
62
+ export function setQueryOptions(options) {
63
+ return {
64
+ type: SET_QUERY_OPTIONS,
65
+ data: options,
66
+ };
67
+ }
68
+
69
+ export default executeTopQueries;
@@ -0,0 +1,174 @@
1
+ import {createRequestActionTypes, createApiRequest} from '../utils';
2
+ import '../../services/api';
3
+ import _ from 'lodash';
4
+ import {getExplainNodeId, getMetaForExplainNode} from '../../utils';
5
+ import {preparePlan} from '../../utils/prepareQueryExplain';
6
+
7
+ const GET_EXPLAIN_QUERY = createRequestActionTypes('query', 'GET_EXPLAIN_QUERY');
8
+ const GET_EXPLAIN_QUERY_AST = createRequestActionTypes('query', 'GET_EXPLAIN_QUERY_AST');
9
+
10
+ const initialState = {
11
+ loading: false,
12
+ };
13
+
14
+ const explainQuery = (state = initialState, action) => {
15
+ switch (action.type) {
16
+ case GET_EXPLAIN_QUERY.REQUEST: {
17
+ return {
18
+ ...state,
19
+ loading: true,
20
+ data: undefined,
21
+ error: undefined,
22
+ dataAst: undefined,
23
+ errorAst: undefined,
24
+ };
25
+ }
26
+ case GET_EXPLAIN_QUERY.SUCCESS: {
27
+ return {
28
+ ...state,
29
+ data: action.data,
30
+ loading: false,
31
+ error: undefined,
32
+ };
33
+ }
34
+ // 401 Unauthorized error is handled by GenericAPI
35
+ case GET_EXPLAIN_QUERY.FAILURE: {
36
+ return {
37
+ ...state,
38
+ error: action.error || 'Unauthorized',
39
+ loading: false,
40
+ };
41
+ }
42
+ case GET_EXPLAIN_QUERY_AST.REQUEST: {
43
+ return {
44
+ ...state,
45
+ loadingAst: true,
46
+ dataAst: undefined,
47
+ errorAst: undefined,
48
+ };
49
+ }
50
+ case GET_EXPLAIN_QUERY_AST.SUCCESS: {
51
+ return {
52
+ ...state,
53
+ dataAst: action.data,
54
+ loadingAst: false,
55
+ error: undefined,
56
+ };
57
+ }
58
+ case GET_EXPLAIN_QUERY_AST.FAILURE: {
59
+ return {
60
+ ...state,
61
+ errorAst: action.error || 'Unauthorized',
62
+ loadingAst: false,
63
+ };
64
+ }
65
+
66
+ default:
67
+ return state;
68
+ }
69
+ };
70
+
71
+ export const getExplainQueryAst = ({query, database}) => {
72
+ return createApiRequest({
73
+ request: window.api.getExplainQueryAst(query, database),
74
+ actions: GET_EXPLAIN_QUERY_AST,
75
+ });
76
+ };
77
+
78
+ export const explainVersions = {
79
+ v1: '0.1',
80
+ v2: '0.2',
81
+ };
82
+
83
+ const supportedExplainQueryVersions = Object.values(explainVersions);
84
+
85
+ export const getExplainQuery = ({query, database}) => {
86
+ return createApiRequest({
87
+ request: window.api.getExplainQuery(query, database),
88
+ actions: GET_EXPLAIN_QUERY,
89
+ dataHandler: (result) => {
90
+ let links = [];
91
+ let nodes = [];
92
+ let graphDepth;
93
+ const {tables, meta, Plan} = result;
94
+
95
+ if (supportedExplainQueryVersions.indexOf(meta.version) === -1) {
96
+ return {
97
+ pristine: result,
98
+ version: meta.version,
99
+ };
100
+ }
101
+ if (meta.version === explainVersions.v2) {
102
+ const preparedPlan = preparePlan(Plan);
103
+ links = preparedPlan.links;
104
+ nodes = preparedPlan.nodes;
105
+ graphDepth = preparedPlan.graphDepth;
106
+ } else {
107
+ graphDepth = tables.length;
108
+ _.forEach(tables, (table) => {
109
+ nodes.push({
110
+ name: table.name,
111
+ });
112
+
113
+ const tableTypes = {};
114
+
115
+ const {reads = [], writes = []} = table;
116
+ let prevEl = null;
117
+
118
+ _.forEach([...reads, ...writes], (node) => {
119
+ if (tableTypes[node.type]) {
120
+ tableTypes[node.type] = tableTypes[node.type] + 1;
121
+ } else {
122
+ tableTypes[node.type] = 1;
123
+ }
124
+
125
+ const nodeId = getExplainNodeId(
126
+ table.name,
127
+ node.type,
128
+ tableTypes[node.type],
129
+ );
130
+
131
+ let prevNodeId = table.name;
132
+ if (prevEl) {
133
+ prevNodeId =
134
+ node.type === prevEl.type
135
+ ? getExplainNodeId(
136
+ table.name,
137
+ prevEl.type,
138
+ tableTypes[prevEl.type] - 1,
139
+ )
140
+ : getExplainNodeId(
141
+ table.name,
142
+ prevEl.type,
143
+ tableTypes[prevEl.type],
144
+ );
145
+ }
146
+
147
+ links.push({
148
+ from: prevNodeId,
149
+ to: nodeId,
150
+ });
151
+ nodes.push({
152
+ name: nodeId,
153
+ meta: getMetaForExplainNode(node),
154
+ id: nodeId,
155
+ });
156
+
157
+ prevEl = node;
158
+ });
159
+ });
160
+ }
161
+
162
+ return {
163
+ links,
164
+ nodes,
165
+ tables,
166
+ version: meta.version,
167
+ pristine: result,
168
+ graphDepth,
169
+ };
170
+ },
171
+ });
172
+ };
173
+
174
+ export default explainQuery;
@@ -0,0 +1,49 @@
1
+ import {createRequestActionTypes, createApiRequest} from '../utils';
2
+ import '../../services/api';
3
+
4
+ const FETCH_GROUP = createRequestActionTypes('GROUP', 'FETCH_GROUP');
5
+
6
+ const initialState = {loading: true, wasLoaded: false, data: undefined};
7
+
8
+ const group = (state = initialState, action) => {
9
+ switch (action.type) {
10
+ case FETCH_GROUP.REQUEST: {
11
+ return {
12
+ ...state,
13
+ loading: true,
14
+ };
15
+ }
16
+ case FETCH_GROUP.SUCCESS: {
17
+ return {
18
+ ...state,
19
+ data: action.data,
20
+ loading: false,
21
+ wasLoaded: true,
22
+ error: undefined,
23
+ };
24
+ }
25
+ case FETCH_GROUP.FAILURE: {
26
+ return {
27
+ ...state,
28
+ error: action.error,
29
+ loading: false,
30
+ };
31
+ }
32
+ case 'CLEAR_STORE': {
33
+ return initialState;
34
+ }
35
+ default:
36
+ return state;
37
+ }
38
+ };
39
+
40
+ export const clearStore = () => ({type: 'CLEAR_STORE'});
41
+
42
+ export const getGroupInfo = (nodeId) => {
43
+ return createApiRequest({
44
+ request: window.api.getGroupInfo(nodeId),
45
+ actions: FETCH_GROUP,
46
+ });
47
+ };
48
+
49
+ export default group;
@@ -0,0 +1,45 @@
1
+ import {createRequestActionTypes, createApiRequest} from '../utils';
2
+ import '../../services/api';
3
+
4
+ const FETCH_HEALTHCHECK = createRequestActionTypes('cluster', 'FETCH_HEALTHCHECK');
5
+
6
+ const initialState = {loading: false, wasLoaded: false};
7
+ const healthcheckInfo = function (state = initialState, action) {
8
+ switch (action.type) {
9
+ case FETCH_HEALTHCHECK.REQUEST: {
10
+ return {
11
+ ...state,
12
+ loading: true,
13
+ };
14
+ }
15
+ case FETCH_HEALTHCHECK.SUCCESS: {
16
+ const {data} = action;
17
+
18
+ return {
19
+ ...state,
20
+ data,
21
+ wasLoaded: true,
22
+ loading: false,
23
+ error: undefined,
24
+ };
25
+ }
26
+ case FETCH_HEALTHCHECK.FAILURE: {
27
+ return {
28
+ ...state,
29
+ error: action.error,
30
+ loading: false,
31
+ };
32
+ }
33
+ default:
34
+ return state;
35
+ }
36
+ };
37
+
38
+ export function getHealthcheckInfo(database) {
39
+ return createApiRequest({
40
+ request: window.api.getHealthcheckInfo(database),
41
+ actions: FETCH_HEALTHCHECK,
42
+ });
43
+ }
44
+
45
+ export default healthcheckInfo;
@@ -0,0 +1,105 @@
1
+ import {createRequestActionTypes, createApiRequest} from '../utils';
2
+ import '../../services/api';
3
+
4
+ const FETCH_TABLETS = createRequestActionTypes('heatmap', 'FETCH_TABLETS');
5
+ const SET_HEATMAP_OPTIONS = 'heatmap/SET_HEATMAP_OPTIONS';
6
+
7
+ export const initialState = {
8
+ loading: false,
9
+ wasLoaded: false,
10
+ currentMetric: undefined,
11
+ sort: false,
12
+ heatmap: false,
13
+ };
14
+
15
+ const tablets = function z(state = initialState, action) {
16
+ switch (action.type) {
17
+ case FETCH_TABLETS.REQUEST: {
18
+ return {
19
+ ...state,
20
+ loading: true,
21
+ };
22
+ }
23
+ case FETCH_TABLETS.SUCCESS: {
24
+ return {
25
+ ...state,
26
+ ...action.data,
27
+ loading: false,
28
+ wasLoaded: true,
29
+ error: undefined,
30
+ };
31
+ }
32
+ case FETCH_TABLETS.FAILURE: {
33
+ return {
34
+ ...state,
35
+ error: action.error,
36
+ loading: false,
37
+ wasLoaded: false,
38
+ };
39
+ }
40
+ case SET_HEATMAP_OPTIONS:
41
+ return {
42
+ ...state,
43
+ ...action.data,
44
+ };
45
+ default:
46
+ return state;
47
+ }
48
+ };
49
+
50
+ export function getTabletsInfo({nodes, path}) {
51
+ return createApiRequest({
52
+ request: Promise.all([
53
+ window.api.getTabletsInfo({nodes, path}),
54
+ window.api.getHeatmapData({path}),
55
+ ]),
56
+ actions: FETCH_TABLETS,
57
+ dataHandler: ([tabletsData = [], describe = {}]) => {
58
+ const {TabletStateInfo: tablets = []} = tabletsData;
59
+ const TabletsMap = new Map();
60
+ const {PathDescription = {}} = describe;
61
+ const {
62
+ TablePartitions = [],
63
+ TablePartitionStats = [],
64
+ TablePartitionMetrics = [],
65
+ } = PathDescription;
66
+
67
+ tablets.forEach((item) => {
68
+ TabletsMap.set(item.TabletId, item);
69
+ });
70
+
71
+ TablePartitions.forEach((item, index) => {
72
+ const metrics = Object.assign(
73
+ {},
74
+ TablePartitionStats[index],
75
+ TablePartitionMetrics[index],
76
+ );
77
+ TabletsMap.set(item.DatashardId, {
78
+ ...TabletsMap.get(item.DatashardId),
79
+ metrics,
80
+ });
81
+ });
82
+
83
+ const preparedTablets = Array.from(TabletsMap.values());
84
+ const selectMetrics =
85
+ preparedTablets[0] &&
86
+ Object.keys(preparedTablets[0].metrics).map((item) => {
87
+ return {
88
+ value: item,
89
+ content: item,
90
+ };
91
+ });
92
+
93
+ return {data: preparedTablets, metrics: selectMetrics};
94
+ },
95
+ });
96
+ }
97
+
98
+ export function setHeatmapOptions(options) {
99
+ return {
100
+ type: SET_HEATMAP_OPTIONS,
101
+ data: options,
102
+ };
103
+ }
104
+
105
+ export default tablets;
@@ -0,0 +1,44 @@
1
+ import {createRequestActionTypes, createApiRequest} from '../utils';
2
+ import '../../services/api';
3
+
4
+ const FETCH_HOST = createRequestActionTypes('host', 'FETCH_HOST');
5
+
6
+ const initialState = {loading: true, wasLoaded: false, data: {}};
7
+
8
+ const cluster = function (state = initialState, action) {
9
+ switch (action.type) {
10
+ case FETCH_HOST.REQUEST: {
11
+ return {
12
+ ...state,
13
+ loading: true,
14
+ };
15
+ }
16
+ case FETCH_HOST.SUCCESS: {
17
+ return {
18
+ ...state,
19
+ data: action.data.SystemStateInfo[0],
20
+ loading: false,
21
+ wasLoaded: true,
22
+ error: undefined,
23
+ };
24
+ }
25
+ case FETCH_HOST.FAILURE: {
26
+ return {
27
+ ...state,
28
+ error: action.error,
29
+ loading: false,
30
+ };
31
+ }
32
+ default:
33
+ return state;
34
+ }
35
+ };
36
+
37
+ export function getHostInfo() {
38
+ return createApiRequest({
39
+ request: window.api.getHostInfo(),
40
+ actions: FETCH_HOST,
41
+ });
42
+ }
43
+
44
+ export default cluster;
@@ -0,0 +1,57 @@
1
+ import {createRequestActionTypes, createApiRequest} from '../utils';
2
+ import '../../services/api';
3
+
4
+ const FETCH_HOT_KEYS = createRequestActionTypes('hot_keys', 'FETCH_HOT_KEYS');
5
+ const SET_HOT_KEYS_OPTIONS = createRequestActionTypes('hot_keys', 'SET_HOT_KEYS_OPTIONS');
6
+
7
+ const initialState = {loading: true, data: {}, wasLoaded: false};
8
+
9
+ const hotKeys = function (state = initialState, action) {
10
+ switch (action.type) {
11
+ case FETCH_HOT_KEYS.REQUEST: {
12
+ return {
13
+ ...state,
14
+ loading: true,
15
+ };
16
+ }
17
+ case FETCH_HOT_KEYS.SUCCESS: {
18
+ return {
19
+ ...state,
20
+ data: action.data.hotkeys,
21
+ loading: false,
22
+ error: undefined,
23
+ wasLoaded: true,
24
+ };
25
+ }
26
+ case FETCH_HOT_KEYS.FAILURE: {
27
+ return {
28
+ ...state,
29
+ error: action.error,
30
+ loading: false,
31
+ };
32
+ }
33
+ case SET_HOT_KEYS_OPTIONS:
34
+ return {
35
+ ...state,
36
+ ...action.data,
37
+ };
38
+ default:
39
+ return state;
40
+ }
41
+ };
42
+
43
+ export function getHotKeys(currentSchemaPath, enableSampling) {
44
+ return createApiRequest({
45
+ request: window.api.getHotKeys(currentSchemaPath, enableSampling),
46
+ actions: FETCH_HOT_KEYS,
47
+ });
48
+ }
49
+
50
+ export function setHotKeysOptions(options) {
51
+ return {
52
+ type: SET_HOT_KEYS_OPTIONS,
53
+ data: options,
54
+ };
55
+ }
56
+
57
+ export default hotKeys;