ydb-embedded-ui 6.3.0 → 6.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. package/README.md +39 -17
  2. package/dist/assets/icons/disableFullscreen.svg +4 -0
  3. package/dist/assets/icons/emptyState.svg +13 -0
  4. package/dist/assets/icons/key.svg +6 -0
  5. package/dist/assets/icons/monitoring.svg +9 -0
  6. package/dist/assets/icons/network.svg +21 -0
  7. package/dist/components/AsyncReplicationState/AsyncReplicationState.d.ts +6 -0
  8. package/dist/components/AsyncReplicationState/AsyncReplicationState.js +20 -0
  9. package/dist/components/AsyncReplicationState/index.d.ts +1 -0
  10. package/dist/components/AsyncReplicationState/index.js +1 -0
  11. package/dist/components/BasicNodeViewer/BasicNodeViewer.js +11 -5
  12. package/dist/components/ButtonWithConfirmDialog/ButtonWithConfirmDialog.d.ts +6 -2
  13. package/dist/components/ButtonWithConfirmDialog/ButtonWithConfirmDialog.js +12 -3
  14. package/dist/components/CriticalActionDialog/CriticalActionDialog.js +3 -4
  15. package/dist/components/CriticalActionDialog/CriticalActionDialog.scss +2 -0
  16. package/dist/components/EmptyState/EmptyState.js +3 -2
  17. package/dist/components/EnableFullscreenButton/EnableFullscreenButton.js +3 -3
  18. package/dist/components/Errors/ResponseError/ResponseError.js +3 -0
  19. package/dist/components/Fullscreen/Fullscreen.js +3 -3
  20. package/dist/components/MonitoringButton/MonitoringButton.js +3 -3
  21. package/dist/components/NodeHostWrapper/NodeHostWrapper.js +3 -3
  22. package/dist/components/PDiskInfo/i18n/index.d.ts +1 -1
  23. package/dist/components/QueryExecutionStatus/QueryExecutionStatus.d.ts +1 -2
  24. package/dist/components/QueryExecutionStatus/QueryExecutionStatus.js +6 -6
  25. package/dist/components/StatusIcon/StatusIcon.js +5 -7
  26. package/dist/components/VDiskInfo/i18n/index.d.ts +1 -1
  27. package/dist/containers/App/App.js +1 -2
  28. package/dist/containers/AsideNavigation/AsideNavigation.js +4 -9
  29. package/dist/containers/AsideNavigation/YdbInternalUser/YdbInternalUser.js +2 -3
  30. package/dist/containers/AsideNavigation/useNavigationMenuItems.js +5 -6
  31. package/dist/containers/Authentication/Authentication.js +2 -4
  32. package/dist/containers/Clusters/Clusters.js +7 -2
  33. package/dist/containers/Clusters/constants.d.ts +1 -3
  34. package/dist/containers/Clusters/constants.js +0 -18
  35. package/dist/containers/Node/NodeStructure/Pdisk.js +4 -4
  36. package/dist/containers/Nodes/Nodes.js +19 -15
  37. package/dist/containers/Nodes/VirtualNodes.js +23 -6
  38. package/dist/containers/PDiskPage/PDiskPage.js +3 -2
  39. package/dist/containers/PDiskPage/i18n/en.json +2 -1
  40. package/dist/containers/PDiskPage/i18n/index.d.ts +1 -1
  41. package/dist/containers/Storage/Storage.js +50 -22
  42. package/dist/containers/Storage/StorageGroups/getStorageGroupsColumns.js +2 -2
  43. package/dist/containers/Storage/VirtualStorage.js +32 -10
  44. package/dist/containers/Storage/utils/index.d.ts +4 -1
  45. package/dist/containers/Storage/utils/index.js +29 -0
  46. package/dist/containers/Tablet/Tablet.js +3 -3
  47. package/dist/containers/Tablet/TabletControls/TabletControls.js +3 -1
  48. package/dist/containers/Tablet/i18n/en.json +3 -0
  49. package/dist/containers/Tablet/i18n/index.d.ts +1 -1
  50. package/dist/containers/Tablet/i18n/index.js +1 -2
  51. package/dist/containers/Tablets/Tablets.d.ts +1 -2
  52. package/dist/containers/Tablets/Tablets.js +113 -53
  53. package/dist/containers/Tablets/i18n/en.json +10 -4
  54. package/dist/containers/Tablets/i18n/index.d.ts +1 -1
  55. package/dist/containers/Tablets/i18n/index.js +1 -2
  56. package/dist/containers/Tenant/Diagnostics/Diagnostics.js +5 -5
  57. package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.d.ts +7 -0
  58. package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.js +2 -0
  59. package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.js +31 -19
  60. package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.scss +14 -4
  61. package/dist/containers/Tenant/Diagnostics/HotKeys/i18n/en.json +2 -1
  62. package/dist/containers/Tenant/Diagnostics/HotKeys/i18n/index.d.ts +1 -1
  63. package/dist/containers/Tenant/Diagnostics/Network/Network.js +3 -3
  64. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationInfo/AsyncReplicationInfo.d.ts +7 -0
  65. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationInfo/AsyncReplicationInfo.js +39 -0
  66. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationInfo/Credentials.d.ts +6 -0
  67. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationInfo/Credentials.js +14 -0
  68. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationInfo/i18n/en.json +7 -0
  69. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationInfo/i18n/index.d.ts +2 -0
  70. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationInfo/i18n/index.js +4 -0
  71. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationInfo/index.d.ts +1 -0
  72. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationInfo/index.js +1 -0
  73. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationPaths/AsyncReplicationPaths.d.ts +7 -0
  74. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationPaths/AsyncReplicationPaths.js +34 -0
  75. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationPaths/AsyncReplicationPaths.scss +7 -0
  76. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationPaths/i18n/en.json +7 -0
  77. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationPaths/i18n/index.d.ts +2 -0
  78. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationPaths/i18n/index.js +4 -0
  79. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationPaths/index.d.ts +1 -0
  80. package/dist/containers/Tenant/Diagnostics/Overview/AsyncReplicationPaths/index.js +1 -0
  81. package/dist/containers/Tenant/Diagnostics/Overview/Overview.js +2 -0
  82. package/dist/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/HealthcheckPreview.js +2 -2
  83. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopQueries.js +2 -1
  84. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopShards.js +2 -1
  85. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TopTables.js +2 -1
  86. package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/index.d.ts +1 -1
  87. package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.js +3 -3
  88. package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.js +3 -3
  89. package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.js +2 -8
  90. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.js +23 -9
  91. package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.d.ts +2 -2
  92. package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.js +5 -6
  93. package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.js +6 -14
  94. package/dist/containers/Tenant/Query/Issues/Issues.js +6 -9
  95. package/dist/containers/Tenant/Query/Preview/Preview.js +5 -5
  96. package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.d.ts +2 -8
  97. package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +18 -19
  98. package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.js +4 -4
  99. package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.js +3 -3
  100. package/dist/containers/Tenant/Schema/SchemaViewer/helpers.js +3 -2
  101. package/dist/containers/Tenant/Tenant.js +3 -2
  102. package/dist/containers/Tenant/utils/ToggleButton.scss +0 -2
  103. package/dist/containers/Tenant/utils/paneVisibilityToggleHelpers.js +4 -4
  104. package/dist/containers/Tenant/utils/schema.js +8 -0
  105. package/dist/containers/Tenant/utils/schemaActions.js +1 -0
  106. package/dist/containers/Tenant/utils/schemaControls.js +4 -3
  107. package/dist/containers/VDiskPage/VDiskPage.js +3 -2
  108. package/dist/containers/VDiskPage/i18n/en.json +2 -1
  109. package/dist/containers/VDiskPage/i18n/index.d.ts +1 -1
  110. package/dist/routes.d.ts +1 -1
  111. package/dist/services/api.d.ts +3 -3
  112. package/dist/services/settings.d.ts +19 -1
  113. package/dist/services/settings.js +2 -1
  114. package/dist/store/configureStore.d.ts +0 -12
  115. package/dist/store/defaultStore.d.ts +0 -6
  116. package/dist/store/reducers/authentication/authentication.d.ts +187 -13
  117. package/dist/store/reducers/authentication/authentication.js +12 -3
  118. package/dist/store/reducers/authentication/types.d.ts +5 -1
  119. package/dist/store/reducers/cluster/cluster.js +4 -0
  120. package/dist/store/reducers/executeQuery.d.ts +4 -65
  121. package/dist/store/reducers/executeQuery.js +38 -34
  122. package/dist/store/reducers/executeTopQueries/executeTopQueries.js +4 -1
  123. package/dist/store/reducers/explainQuery/explainQuery.d.ts +9 -0
  124. package/dist/store/reducers/explainQuery/explainQuery.js +32 -0
  125. package/dist/store/reducers/explainQuery/types.d.ts +12 -0
  126. package/dist/store/reducers/explainQuery/utils.d.ts +6 -0
  127. package/dist/store/reducers/explainQuery/utils.js +40 -0
  128. package/dist/store/reducers/healthcheckInfo/healthcheckInfo.d.ts +0 -60
  129. package/dist/store/reducers/host.d.ts +61 -4
  130. package/dist/store/reducers/index.d.ts +0 -9
  131. package/dist/store/reducers/index.js +0 -6
  132. package/dist/store/reducers/node/selectors.d.ts +0 -3
  133. package/dist/store/reducers/nodes/nodes.d.ts +1 -5
  134. package/dist/store/reducers/nodes/nodes.js +0 -27
  135. package/dist/store/reducers/nodes/types.d.ts +4 -13
  136. package/dist/store/reducers/nodesList.d.ts +0 -3
  137. package/dist/store/reducers/olapStats.js +4 -1
  138. package/dist/store/reducers/preview.js +4 -1
  139. package/dist/store/reducers/schema/schema.d.ts +61 -4
  140. package/dist/store/reducers/schemaAcl/schemaAcl.d.ts +61 -4
  141. package/dist/store/reducers/shardsWorkload/shardsWorkload.js +4 -1
  142. package/dist/store/reducers/storage/selectors.d.ts +2 -17
  143. package/dist/store/reducers/storage/selectors.js +1 -36
  144. package/dist/store/reducers/storage/storage.d.ts +2 -6
  145. package/dist/store/reducers/storage/storage.js +0 -44
  146. package/dist/store/reducers/storage/types.d.ts +15 -22
  147. package/dist/store/reducers/storage/types.js +4 -1
  148. package/dist/store/reducers/tablets.d.ts +91 -1
  149. package/dist/store/reducers/tablets.js +16 -1
  150. package/dist/store/reducers/tabletsFilters.d.ts +61 -4
  151. package/dist/store/reducers/tenant/tenant.d.ts +2 -2
  152. package/dist/store/reducers/tenant/tenant.js +10 -1
  153. package/dist/store/reducers/tenant/types.d.ts +8 -3
  154. package/dist/store/reducers/tenant/types.js +3 -1
  155. package/dist/store/reducers/tenantOverview/executeTopTables/executeTopTables.js +6 -3
  156. package/dist/store/reducers/tenantOverview/topQueries/tenantOverviewTopQueries.js +6 -3
  157. package/dist/store/reducers/tenantOverview/topShards/tenantOverviewTopShards.js +6 -3
  158. package/dist/store/reducers/tenants/selectors.d.ts +0 -27
  159. package/dist/store/reducers/tenants/utils.d.ts +4 -4
  160. package/dist/store/reducers/tenants/utils.js +8 -8
  161. package/dist/store/reducers/topic.d.ts +0 -45
  162. package/dist/store/state-url-mapping.js +0 -22
  163. package/dist/store/utils.d.ts +2 -3
  164. package/dist/store/utils.js +1 -1
  165. package/dist/types/api/schema/replication.d.ts +74 -0
  166. package/dist/types/api/schema/replication.js +7 -0
  167. package/dist/types/api/schema/schema.d.ts +4 -1
  168. package/dist/types/api/schema/schema.js +1 -0
  169. package/dist/types/api/whoami.d.ts +6 -0
  170. package/dist/types/store/executeQuery.d.ts +2 -9
  171. package/dist/utils/constants.d.ts +1 -0
  172. package/dist/utils/constants.js +1 -0
  173. package/dist/utils/monaco/yql/constants.d.ts +2 -0
  174. package/dist/utils/monaco/yql/constants.js +33 -0
  175. package/dist/utils/monaco/yql/generateSuggestions.d.ts +1 -0
  176. package/dist/utils/monaco/yql/generateSuggestions.js +28 -11
  177. package/dist/utils/monaco/yql/yqlSuggestions.js +6 -1
  178. package/dist/utils/nodes.d.ts +2 -0
  179. package/dist/utils/nodes.js +4 -0
  180. package/dist/utils/query.d.ts +5 -3
  181. package/dist/utils/query.js +27 -4
  182. package/dist/utils/response.d.ts +4 -0
  183. package/dist/utils/response.js +9 -0
  184. package/dist/utils/tablet.d.ts +2 -0
  185. package/dist/utils/tablet.js +14 -0
  186. package/package.json +4 -3
  187. package/dist/assets/icons/bug.svg +0 -1
  188. package/dist/assets/icons/circle-exclamation.svg +0 -1
  189. package/dist/assets/icons/circle-info.svg +0 -1
  190. package/dist/assets/icons/circle-xmark.svg +0 -1
  191. package/dist/assets/icons/close.svg +0 -1
  192. package/dist/assets/icons/control-menu-button.svg +0 -1
  193. package/dist/assets/icons/dots.svg +0 -1
  194. package/dist/assets/icons/hide.svg +0 -1
  195. package/dist/assets/icons/question.svg +0 -1
  196. package/dist/assets/icons/server.svg +0 -1
  197. package/dist/assets/icons/settings-with-dot.svg +0 -1
  198. package/dist/assets/icons/settings.svg +0 -1
  199. package/dist/assets/icons/shield.svg +0 -3
  200. package/dist/assets/icons/show.svg +0 -1
  201. package/dist/assets/icons/signIn.svg +0 -1
  202. package/dist/assets/icons/signOut.svg +0 -1
  203. package/dist/assets/icons/storage.svg +0 -1
  204. package/dist/assets/icons/support.svg +0 -1
  205. package/dist/assets/icons/triangle-exclamation.svg +0 -1
  206. package/dist/assets/icons/update-arrow.svg +0 -6
  207. package/dist/components/Icon/Icon.d.ts +0 -14
  208. package/dist/components/Icon/Icon.js +0 -16
  209. package/dist/components/Icon/index.d.ts +0 -1
  210. package/dist/components/Icon/index.js +0 -1
  211. package/dist/containers/AppIcons/AppIcons.d.ts +0 -2
  212. package/dist/containers/AppIcons/AppIcons.js +0 -9
  213. package/dist/containers/Tablet/i18n/ru.json +0 -10
  214. package/dist/containers/Tablets/Tablets.scss +0 -35
  215. package/dist/containers/Tablets/i18n/ru.json +0 -6
  216. package/dist/store/reducers/explainQuery.d.ts +0 -149
  217. package/dist/store/reducers/explainQuery.js +0 -94
  218. package/dist/types/store/explainQuery.d.ts +0 -27
  219. package/dist/utils/error.d.ts +0 -2
  220. package/dist/utils/error.js +0 -13
  221. /package/dist/{types/store/explainQuery.js → store/reducers/explainQuery/types.js} +0 -0
@@ -1,149 +0,0 @@
1
- import type { Reducer } from '@reduxjs/toolkit';
2
- import type { ExplainQueryAction, ExplainQueryState, PreparedExplainResponse } from '../../types/store/explainQuery';
3
- import type { QueryMode, QueryRequestParams } from '../../types/store/query';
4
- export declare const GET_EXPLAIN_QUERY: {
5
- readonly REQUEST: "query/GET_EXPLAIN_QUERY_REQUEST";
6
- readonly SUCCESS: "query/GET_EXPLAIN_QUERY_SUCCESS";
7
- readonly FAILURE: "query/GET_EXPLAIN_QUERY_FAILURE";
8
- };
9
- export declare const GET_EXPLAIN_QUERY_AST: {
10
- readonly REQUEST: "query/GET_EXPLAIN_QUERY_AST_REQUEST";
11
- readonly SUCCESS: "query/GET_EXPLAIN_QUERY_AST_SUCCESS";
12
- readonly FAILURE: "query/GET_EXPLAIN_QUERY_AST_FAILURE";
13
- };
14
- declare const explainQuery: Reducer<ExplainQueryState, ExplainQueryAction>;
15
- export declare const getExplainQueryAst: ({ query, database }: QueryRequestParams) => (dispatch: import("redux").Dispatch<import("redux").UnknownAction>, getState: () => {
16
- api: import("@reduxjs/toolkit/query").CombinedState<{}, "All", "api">;
17
- singleClusterMode: boolean;
18
- nodes: import("./nodes/types").NodesState;
19
- cluster: import("./cluster/types").ClusterState;
20
- tenant: import("./tenant/types").TenantState;
21
- storage: import("./storage/types").StorageState;
22
- tooltip: import("../../types/store/tooltip").ITooltipState;
23
- tablets: import("../../types/store/tablets").TabletsState;
24
- schema: import("./schema/types").SchemaState;
25
- host: import("../../types/store/host").IHostState;
26
- tenants: import("./tenants/types").TenantsState;
27
- partitions: import("./partitions/types").PartitionsState;
28
- executeQuery: import("../../types/store/executeQuery").ExecuteQueryState;
29
- explainQuery: ExplainQueryState;
30
- tabletsFilters: {
31
- loading: boolean;
32
- requestTime: number;
33
- data: undefined;
34
- wasLoaded: boolean;
35
- stateFilter: never[];
36
- typeFilter: never[];
37
- } | {
38
- tabletsData: any;
39
- nodes: any;
40
- loading: boolean;
41
- wasLoaded: boolean;
42
- timeoutForRequest: number;
43
- error: undefined;
44
- data: undefined;
45
- stateFilter: never[];
46
- typeFilter: never[];
47
- } | {
48
- error: any;
49
- loading: boolean;
50
- data: undefined;
51
- wasLoaded: boolean;
52
- stateFilter: never[];
53
- typeFilter: never[];
54
- } | {
55
- stateFilter: any;
56
- data: undefined;
57
- loading: boolean;
58
- wasLoaded: boolean;
59
- typeFilter: never[];
60
- } | {
61
- typeFilter: any;
62
- data: undefined;
63
- loading: boolean;
64
- wasLoaded: boolean;
65
- stateFilter: never[];
66
- };
67
- heatmap: import("../../types/store/heatmap").IHeatmapState;
68
- settings: import("./settings/types").SettingsState;
69
- schemaAcl: import("./schemaAcl/types").SchemaAclState;
70
- executeTopQueries: import("./executeTopQueries/types").TopQueriesFilters;
71
- shardsWorkload: import("./shardsWorkload/types").ShardsWorkloadFilters;
72
- hotKeys: import("./hotKeys/types").HotKeysState;
73
- authentication: import("./authentication/types").AuthenticationState;
74
- header: import("./header/types").HeaderState;
75
- saveQuery: string | null;
76
- fullscreen: boolean;
77
- clusters: import("./clusters/types").ClustersFilters;
78
- }) => Promise<import("../../types/store/query").IQueryResult | undefined>;
79
- export declare const explainVersions: {
80
- v2: string;
81
- };
82
- interface ExplainQueryParams extends QueryRequestParams {
83
- mode?: QueryMode;
84
- }
85
- export declare const getExplainQuery: ({ query, database, mode }: ExplainQueryParams) => (dispatch: import("redux").Dispatch<import("redux").UnknownAction>, getState: () => {
86
- api: import("@reduxjs/toolkit/query").CombinedState<{}, "All", "api">;
87
- singleClusterMode: boolean;
88
- nodes: import("./nodes/types").NodesState;
89
- cluster: import("./cluster/types").ClusterState;
90
- tenant: import("./tenant/types").TenantState;
91
- storage: import("./storage/types").StorageState;
92
- tooltip: import("../../types/store/tooltip").ITooltipState;
93
- tablets: import("../../types/store/tablets").TabletsState;
94
- schema: import("./schema/types").SchemaState;
95
- host: import("../../types/store/host").IHostState;
96
- tenants: import("./tenants/types").TenantsState;
97
- partitions: import("./partitions/types").PartitionsState;
98
- executeQuery: import("../../types/store/executeQuery").ExecuteQueryState;
99
- explainQuery: ExplainQueryState;
100
- tabletsFilters: {
101
- loading: boolean;
102
- requestTime: number;
103
- data: undefined;
104
- wasLoaded: boolean;
105
- stateFilter: never[];
106
- typeFilter: never[];
107
- } | {
108
- tabletsData: any;
109
- nodes: any;
110
- loading: boolean;
111
- wasLoaded: boolean;
112
- timeoutForRequest: number;
113
- error: undefined;
114
- data: undefined;
115
- stateFilter: never[];
116
- typeFilter: never[];
117
- } | {
118
- error: any;
119
- loading: boolean;
120
- data: undefined;
121
- wasLoaded: boolean;
122
- stateFilter: never[];
123
- typeFilter: never[];
124
- } | {
125
- stateFilter: any;
126
- data: undefined;
127
- loading: boolean;
128
- wasLoaded: boolean;
129
- typeFilter: never[];
130
- } | {
131
- typeFilter: any;
132
- data: undefined;
133
- loading: boolean;
134
- wasLoaded: boolean;
135
- stateFilter: never[];
136
- };
137
- heatmap: import("../../types/store/heatmap").IHeatmapState;
138
- settings: import("./settings/types").SettingsState;
139
- schemaAcl: import("./schemaAcl/types").SchemaAclState;
140
- executeTopQueries: import("./executeTopQueries/types").TopQueriesFilters;
141
- shardsWorkload: import("./shardsWorkload/types").ShardsWorkloadFilters;
142
- hotKeys: import("./hotKeys/types").HotKeysState;
143
- authentication: import("./authentication/types").AuthenticationState;
144
- header: import("./header/types").HeaderState;
145
- saveQuery: string | null;
146
- fullscreen: boolean;
147
- clusters: import("./clusters/types").ClustersFilters;
148
- }) => Promise<PreparedExplainResponse | undefined>;
149
- export default explainQuery;
@@ -1,94 +0,0 @@
1
- import { parseQueryError } from '../../utils/error';
2
- import { preparePlan } from '../../utils/prepareQueryExplain';
3
- import { QUERY_SYNTAX, parseQueryAPIExplainResponse, parseQueryExplainPlan } from '../../utils/query';
4
- import { createApiRequest, createRequestActionTypes } from '../utils';
5
- export const GET_EXPLAIN_QUERY = createRequestActionTypes('query', 'GET_EXPLAIN_QUERY');
6
- export const GET_EXPLAIN_QUERY_AST = createRequestActionTypes('query', 'GET_EXPLAIN_QUERY_AST');
7
- const initialState = {
8
- loading: false,
9
- };
10
- const explainQuery = (state = initialState, action) => {
11
- switch (action.type) {
12
- case GET_EXPLAIN_QUERY.REQUEST: {
13
- return Object.assign(Object.assign({}, state), { loading: true, data: undefined, error: undefined, dataAst: undefined, errorAst: undefined });
14
- }
15
- case GET_EXPLAIN_QUERY.SUCCESS: {
16
- return Object.assign(Object.assign({}, state), { data: action.data.plan, dataAst: action.data.ast, loading: false, error: undefined });
17
- }
18
- case GET_EXPLAIN_QUERY.FAILURE: {
19
- return Object.assign(Object.assign({}, state), { error: parseQueryError(action.error), loading: false });
20
- }
21
- case GET_EXPLAIN_QUERY_AST.REQUEST: {
22
- return Object.assign(Object.assign({}, state), { loadingAst: true, dataAst: undefined, errorAst: undefined });
23
- }
24
- case GET_EXPLAIN_QUERY_AST.SUCCESS: {
25
- return Object.assign(Object.assign({}, state), { dataAst: action.data.ast, loadingAst: false, error: undefined });
26
- }
27
- case GET_EXPLAIN_QUERY_AST.FAILURE: {
28
- return Object.assign(Object.assign({}, state), { errorAst: parseQueryError(action.error), loadingAst: false });
29
- }
30
- default:
31
- return state;
32
- }
33
- };
34
- export const getExplainQueryAst = ({ query, database }) => {
35
- return createApiRequest({
36
- request: window.api.getExplainQueryAst(query, database),
37
- actions: GET_EXPLAIN_QUERY_AST,
38
- dataHandler: parseQueryAPIExplainResponse,
39
- });
40
- };
41
- export const explainVersions = {
42
- v2: '0.2',
43
- };
44
- const supportedExplainQueryVersions = Object.values(explainVersions);
45
- export const getExplainQuery = ({ query, database, mode }) => {
46
- let action = 'explain';
47
- let syntax = QUERY_SYNTAX.yql;
48
- if (mode === 'pg') {
49
- action = 'explain-query';
50
- syntax = QUERY_SYNTAX.pg;
51
- }
52
- else if (mode) {
53
- action = `explain-${mode}`;
54
- }
55
- return createApiRequest({
56
- request: window.api.getExplainQuery(query, database, action, syntax),
57
- actions: GET_EXPLAIN_QUERY,
58
- dataHandler: (response) => {
59
- const { plan: rawPlan, ast } = parseQueryAPIExplainResponse(response);
60
- if (!rawPlan) {
61
- return { ast };
62
- }
63
- const { tables, meta, Plan } = parseQueryExplainPlan(rawPlan);
64
- if (supportedExplainQueryVersions.indexOf(meta.version) === -1) {
65
- // Do not prepare plan for not supported versions
66
- return {
67
- plan: {
68
- pristine: rawPlan,
69
- version: meta.version,
70
- },
71
- ast,
72
- };
73
- }
74
- let links = [];
75
- let nodes = [];
76
- if (Plan) {
77
- const preparedPlan = preparePlan(Plan);
78
- links = preparedPlan.links;
79
- nodes = preparedPlan.nodes;
80
- }
81
- return {
82
- plan: {
83
- links,
84
- nodes,
85
- tables,
86
- version: meta.version,
87
- pristine: rawPlan,
88
- },
89
- ast,
90
- };
91
- },
92
- });
93
- };
94
- export default explainQuery;
@@ -1,27 +0,0 @@
1
- import type { ExplainPlanNodeData, GraphNode, Link } from '@gravity-ui/paranoid';
2
- import type { GET_EXPLAIN_QUERY, GET_EXPLAIN_QUERY_AST } from '../../store/reducers/explainQuery';
3
- import type { ApiRequestAction } from '../../store/utils';
4
- import type { PlanTable, QueryPlan, ScriptPlan } from '../api/query';
5
- import type { IQueryResult, QueryError, QueryErrorResponse } from './query';
6
- export interface PreparedExplainResponse {
7
- plan?: {
8
- links?: Link[];
9
- nodes?: GraphNode<ExplainPlanNodeData>[];
10
- tables?: PlanTable[];
11
- version?: string;
12
- pristine?: QueryPlan | ScriptPlan;
13
- };
14
- ast?: string;
15
- }
16
- export interface ExplainQueryState {
17
- loading: boolean;
18
- loadingAst?: boolean;
19
- data?: PreparedExplainResponse['plan'];
20
- dataAst?: PreparedExplainResponse['ast'];
21
- error?: string | QueryErrorResponse;
22
- errorAst?: string | QueryErrorResponse;
23
- }
24
- type GetExplainQueryAstAction = ApiRequestAction<typeof GET_EXPLAIN_QUERY_AST, IQueryResult, QueryError>;
25
- type GetExplainQueryAction = ApiRequestAction<typeof GET_EXPLAIN_QUERY, PreparedExplainResponse, QueryError>;
26
- export type ExplainQueryAction = GetExplainQueryAstAction | GetExplainQueryAction;
27
- export {};
@@ -1,2 +0,0 @@
1
- import type { QueryError, QueryErrorResponse } from '../types/store/query';
2
- export declare const parseQueryError: (error: QueryError) => QueryErrorResponse | string | undefined;
@@ -1,13 +0,0 @@
1
- const isNetworkError = (error) => {
2
- return Boolean(error &&
3
- typeof error === 'object' &&
4
- 'message' in error &&
5
- error.message === 'Network Error');
6
- };
7
- export const parseQueryError = (error) => {
8
- if (isNetworkError(error)) {
9
- return error.message;
10
- }
11
- // 401 Unauthorized error is handled by GenericAPI
12
- return error !== null && error !== void 0 ? error : 'Unauthorized';
13
- };