ydb-embedded-ui 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,439 @@
1
+ import React from 'react';
2
+ import cn from 'bem-cn-lite';
3
+ import PropTypes from 'prop-types';
4
+ import {connect} from 'react-redux';
5
+ import _ from 'lodash';
6
+
7
+ import {
8
+ Link as ExternalLink,
9
+ Tabs,
10
+ ClipboardButton,
11
+ HelpTooltip,
12
+ Switch,
13
+ } from '@yandex-cloud/uikit';
14
+ import SplitPane from '../../../../components/SplitPane';
15
+
16
+ import Info from '../Info/Info';
17
+ import {
18
+ GENERAL_SCHEMA_PAGES,
19
+ TABLETS,
20
+ INFO,
21
+ QUERY,
22
+ GRAPH,
23
+ PREVIEW,
24
+ DESCRIBE,
25
+ ACL,
26
+ TOP_QUERIES,
27
+ TOP_SHARDS,
28
+ HOT_KEYS,
29
+ TABLE_SCHEMA_PAGES,
30
+ } from '../SchemaPages';
31
+ import QueryEditor from '../../../Tenant/QueryEditor/QueryEditor';
32
+ import Preview from '../../../Tenant/Preview/Preview';
33
+ import Tablets from '../../../Tablets/Tablets';
34
+ import Heatmap from '../../../Heatmap/Heatmap';
35
+ import Describe from '../../../Tenant/Describe/Describe';
36
+ import Acl from '../../../Tenant/Acl/Acl';
37
+ import TopQueries from '../../../Tenant/TopQueries/TopQueries';
38
+ import TopShards from '../../../Tenant/TopShards/TopShards';
39
+ import SchemaNode from '../SchemaNode/SchemaNode';
40
+ import HotKeys from '../HotKeys/HotKeys';
41
+
42
+ import {getDescribe} from '../../../../store/reducers/describe';
43
+ import {getSchemaAcl} from '../../../../store/reducers/schemaAcl';
44
+ import {getSchema, enableAutorefresh, disableAutorefresh} from '../../../../store/reducers/schema';
45
+ import {getOlapStats} from '../../../../store/reducers/olapStats';
46
+ import {DEFAULT_SIZE_SHEMA_TREE_PANE_KEY} from '../../../../utils/constants';
47
+ import routes, {createHref} from '../../../../routes';
48
+
49
+ import {AutoFetcher} from '../../../Cluster/Cluster';
50
+
51
+ import './SchemaMain.scss';
52
+ import HistoryContext from '../../../../contexts/HistoryContext';
53
+ const b = cn('schema-main');
54
+
55
+ export const TABLE_TYPE = 'Table';
56
+ export const OLAP_TABLE_TYPE = 'OlapTable';
57
+ export const OLAP_STORE_TYPE = 'OlapStore';
58
+
59
+ class SchemaMain extends React.Component {
60
+ static propTypes = {
61
+ tenantName: PropTypes.string,
62
+ activeTab: PropTypes.string,
63
+ currentItem: PropTypes.object,
64
+ tenant: PropTypes.object,
65
+ tenantNodes: PropTypes.array,
66
+ tenantActiveTab: PropTypes.string,
67
+ host: PropTypes.object,
68
+ singleClusterMode: PropTypes.bool,
69
+ getBackend: PropTypes.func,
70
+ };
71
+
72
+ autofetcher;
73
+
74
+ state = {
75
+ entityType: '',
76
+ };
77
+
78
+ componentDidMount() {
79
+ this.autofetcher = new AutoFetcher();
80
+ this.autofetcher.active = false;
81
+ this.fetchData();
82
+ this.setState({entityType: this.getEntityType()});
83
+ }
84
+
85
+ componentDidUpdate(prevProps) {
86
+ const {
87
+ autorefresh,
88
+ schemaPath,
89
+ disableAutorefresh,
90
+ activeTab,
91
+ getOlapStats,
92
+ schemaPath: path,
93
+ } = this.props;
94
+
95
+ const entityType = this.getEntityType();
96
+
97
+ if (entityType !== this.state.entityType) {
98
+ this.setState({entityType});
99
+ if (entityType === OLAP_TABLE_TYPE) {
100
+ getOlapStats({path});
101
+ }
102
+ }
103
+
104
+ if (schemaPath !== prevProps.schemaPath) {
105
+ this.fetchData();
106
+ if (autorefresh) {
107
+ disableAutorefresh();
108
+ this.autofetcher.stop();
109
+ }
110
+ }
111
+ switch (activeTab) {
112
+ case INFO:
113
+ case DESCRIBE:
114
+ case ACL:
115
+ if (!this.autofetcher.active && autorefresh) {
116
+ this.fetchData();
117
+ this.autofetcher.start();
118
+ this.autofetcher.fetch(() => this.fetchData());
119
+ }
120
+ break;
121
+
122
+ default:
123
+ if (this.autofetcher.active) {
124
+ this.autofetcher.stop();
125
+ }
126
+ }
127
+
128
+ if (!autorefresh && prevProps.autorefresh) {
129
+ this.autofetcher.stop();
130
+ }
131
+ }
132
+ componentWillUnmount() {
133
+ this.autofetcher.stop();
134
+ }
135
+
136
+ fetchData = () => {
137
+ const {
138
+ getSchema,
139
+ getDescribe,
140
+ getSchemaAcl,
141
+ schemaPath: path,
142
+ tenantName,
143
+ getOlapStats,
144
+ } = this.props;
145
+
146
+ const entityType = this.getEntityType();
147
+
148
+ if (entityType === OLAP_TABLE_TYPE) {
149
+ getOlapStats({path});
150
+ }
151
+
152
+ getSchema({path: tenantName});
153
+ getSchema({path});
154
+ getDescribe({path});
155
+ getSchemaAcl({path});
156
+ };
157
+
158
+ changeSchemaTab = (tab) => {
159
+ const {tenantName, tenantActiveTab, queryParams} = this.props;
160
+ this.history.push(
161
+ createHref(
162
+ routes.tenant,
163
+ {page: tenantActiveTab},
164
+ {...queryParams, name: tenantName, schemaTab: tab},
165
+ ),
166
+ );
167
+ };
168
+ renderSchemaTab() {
169
+ const {currentItem, tenantName, activeTab, tenant, theme, olapStats} = this.props;
170
+ const entityType = this.getEntityType();
171
+ const tableSchema =
172
+ currentItem?.PathDescription?.Table ||
173
+ currentItem?.PathDescription?.OlapTableDescription;
174
+
175
+ if (currentItem.Status !== 'StatusSuccess') {
176
+ return <div>no data</div>;
177
+ }
178
+
179
+ switch (activeTab) {
180
+ case QUERY: {
181
+ return <QueryEditor path={tenantName} theme={theme} />;
182
+ }
183
+ case TABLETS: {
184
+ return (
185
+ <Tablets
186
+ tenant={tenant}
187
+ currentSchemaItem={currentItem}
188
+ path={currentItem.Path}
189
+ />
190
+ );
191
+ }
192
+ case INFO: {
193
+ return (
194
+ <Info
195
+ tableSchema={tableSchema}
196
+ currentItem={currentItem}
197
+ type={entityType}
198
+ olapStats={olapStats}
199
+ />
200
+ );
201
+ }
202
+ case GRAPH: {
203
+ return (
204
+ <Heatmap
205
+ tenant={tenant}
206
+ currentSchemaItem={currentItem}
207
+ path={currentItem.Path}
208
+ />
209
+ );
210
+ }
211
+ case PREVIEW: {
212
+ const partCount = currentItem?.PathDescription?.TableStats?.PartCount;
213
+
214
+ return (
215
+ <Preview
216
+ database={tenantName}
217
+ table={currentItem.Path}
218
+ type={entityType}
219
+ partCount={partCount}
220
+ />
221
+ );
222
+ }
223
+ case DESCRIBE: {
224
+ return <Describe />;
225
+ }
226
+ case ACL: {
227
+ return <Acl />;
228
+ }
229
+ case TOP_QUERIES: {
230
+ return (
231
+ <TopQueries
232
+ path={tenantName}
233
+ changeSchemaTab={this.changeSchemaTab}
234
+ type={entityType}
235
+ />
236
+ );
237
+ }
238
+ case TOP_SHARDS: {
239
+ return <TopShards path={tenantName} type={entityType} />;
240
+ }
241
+ case HOT_KEYS: {
242
+ if (entityType === TABLE_TYPE) {
243
+ return <HotKeys path={tenantName} />;
244
+ }
245
+ return this.changeSchemaTab(INFO);
246
+ }
247
+ default:
248
+ return false;
249
+ }
250
+ }
251
+ getEntityType = () => {
252
+ const {currentItem} = this.props;
253
+ const pathType = currentItem?.PathDescription?.Self?.PathType;
254
+
255
+ return pathType && pathType.replace('EPathType', '');
256
+ };
257
+
258
+ setAutorefresh = () => {
259
+ const {autorefresh, enableAutorefresh, disableAutorefresh} = this.props;
260
+ if (autorefresh) {
261
+ disableAutorefresh();
262
+ } else {
263
+ enableAutorefresh();
264
+ }
265
+ };
266
+
267
+ renderInfo = () => {
268
+ const {
269
+ currentItem: {Path, Status, Reason},
270
+ autorefresh,
271
+ } = this.props;
272
+ const entityType = this.getEntityType();
273
+
274
+ let message;
275
+ if (!entityType && Status && Reason) {
276
+ message = `${Status}: ${Reason}`;
277
+ }
278
+
279
+ return (
280
+ <div className={b('info-wrapper')}>
281
+ <div className={b('info')}>
282
+ {entityType ? (
283
+ <div className={b('entity-type')}>{entityType}</div>
284
+ ) : (
285
+ <div className={b('entity-type', {error: true})}>
286
+ <HelpTooltip content={message} offset={{left: 0}} />
287
+ </div>
288
+ )}
289
+ <div>{Path}</div>
290
+ <span className={b('clipboard-button')}>
291
+ <ClipboardButton text={Path} size={16} />
292
+ </span>
293
+ </div>
294
+ <Switch
295
+ onUpdate={this.setAutorefresh}
296
+ checked={autorefresh}
297
+ content="Autorefresh"
298
+ />
299
+ </div>
300
+ );
301
+ };
302
+
303
+ onChange = (size) => {
304
+ this.setDefaultSizePane(size);
305
+ };
306
+ setDefaultSizePane = (size) => {
307
+ localStorage.setItem(DEFAULT_SIZE_SHEMA_TREE_PANE_KEY, size);
308
+ };
309
+ getDefaultSizePane = () => {
310
+ let size = localStorage.getItem(DEFAULT_SIZE_SHEMA_TREE_PANE_KEY) || 250;
311
+ size = `${size}px`;
312
+
313
+ return size;
314
+ };
315
+
316
+ renderContent() {
317
+ const {tenantName, tenantData = null, activeTab} = this.props;
318
+ const entityType = this.getEntityType();
319
+
320
+ const pages =
321
+ entityType === TABLE_TYPE
322
+ ? [...GENERAL_SCHEMA_PAGES, ...TABLE_SCHEMA_PAGES]
323
+ : GENERAL_SCHEMA_PAGES;
324
+
325
+ return (
326
+ <div className={b()}>
327
+ <SplitPane
328
+ split="vertical"
329
+ defaultSize={this.getDefaultSizePane()}
330
+ maxSize={500}
331
+ minSize={250}
332
+ onChange={this.onChange}
333
+ >
334
+ <div className={b('tree')}>
335
+ <SchemaNode fullPath={tenantName} data={tenantData} isRoot />
336
+ </div>
337
+ <div className={b('content')}>
338
+ {this.renderInfo()}
339
+ <div className={b('tabs')}>
340
+ <Tabs
341
+ items={pages}
342
+ activeTab={activeTab}
343
+ wrapTo={({id}, node) => (
344
+ <span
345
+ onClick={() => this.changeSchemaTab(id)}
346
+ key={id}
347
+ className={b('tab')}
348
+ >
349
+ {node}
350
+ </span>
351
+ )}
352
+ allowNotSelected={true}
353
+ />
354
+ </div>
355
+ <div className={b('tab-content')}>{this.renderSchemaTab()}</div>
356
+ </div>
357
+ </SplitPane>
358
+ </div>
359
+ );
360
+ }
361
+ renderHost = (item, index) => {
362
+ const {tenantActiveTab, tenant, activeTab, getBackend} = this.props;
363
+ const {Name: name} = tenant;
364
+ const {backend} = item;
365
+ const href = createHref(
366
+ routes.tenant,
367
+ {page: tenantActiveTab},
368
+ {
369
+ name,
370
+ schemaTab: activeTab,
371
+ backend: getBackend ? getBackend(backend) : undefined,
372
+ },
373
+ );
374
+
375
+ return (
376
+ <li className={b('host-link')}>
377
+ <ExternalLink key={index} href={href} target="_self">
378
+ {backend}
379
+ </ExternalLink>
380
+ </li>
381
+ );
382
+ };
383
+ renderHosts() {
384
+ const {tenantNodes} = this.props;
385
+
386
+ return (
387
+ <div className={b('hosts')}>
388
+ <div className={b('hosts-message')}>Select endpoint to browse schema</div>
389
+ <ul className={b('hosts-list')}>{tenantNodes.map(this.renderHost)}</ul>
390
+ </div>
391
+ );
392
+ }
393
+ render() {
394
+ const {tenantNodes = [], host, singleClusterMode} = this.props;
395
+ const correctHost = tenantNodes.map((node) => node.id).includes(host.NodeId);
396
+
397
+ return (
398
+ <HistoryContext.Consumer>
399
+ {(history) => {
400
+ this.history = history;
401
+ return singleClusterMode || correctHost || !tenantNodes.length
402
+ ? this.renderContent()
403
+ : this.renderHosts();
404
+ }}
405
+ </HistoryContext.Consumer>
406
+ );
407
+ }
408
+ }
409
+
410
+ function mapStateToProps(state, ownProps) {
411
+ const {currentSchema = {}, currentSchemaPath, data, autorefresh} = state.schema;
412
+ const {data: olapStats} = state.olapStats;
413
+ const {tenant = {}, tenantNodes} = state.tenant;
414
+ const {data: host} = state.host;
415
+ const {singleClusterMode} = state;
416
+
417
+ return {
418
+ singleClusterMode,
419
+ currentItem: currentSchema,
420
+ tenant,
421
+ tenantNodes,
422
+ tenantData: _.get(data[ownProps.tenantName], 'PathDescription.Self'),
423
+ host,
424
+ schemaPath: currentSchemaPath || ownProps.tenantName,
425
+ autorefresh,
426
+ olapStats,
427
+ };
428
+ }
429
+
430
+ const mapDispatchToProps = {
431
+ getDescribe,
432
+ getSchemaAcl,
433
+ getSchema,
434
+ enableAutorefresh,
435
+ disableAutorefresh,
436
+ getOlapStats,
437
+ };
438
+
439
+ export default connect(mapStateToProps, mapDispatchToProps)(SchemaMain);
@@ -0,0 +1,90 @@
1
+ @import '../../../../styles/mixins';
2
+
3
+ .schema-main {
4
+ display: flex;
5
+ flex: 1 1 auto;
6
+ overflow: auto;
7
+ position: relative;
8
+
9
+ &__tree {
10
+ display: flex;
11
+ flex: 0 0 auto;
12
+ padding-left: 15px;
13
+ padding-top: 15px;
14
+ overflow: auto;
15
+ height: 100%;
16
+
17
+ .tree-view_item {
18
+ padding: 2px 0;
19
+ margin: 0;
20
+ }
21
+
22
+ & > div > .tree-view {
23
+ padding-bottom: 15px;
24
+ }
25
+ }
26
+ &__content {
27
+ display: flex;
28
+ flex-direction: column;
29
+ flex: 1 1 auto;
30
+ overflow: auto;
31
+ height: 100%;
32
+ }
33
+ &__info-wrapper {
34
+ display: flex;
35
+ justify-content: space-between;
36
+ align-items: center;
37
+ padding: 15px 15px 5px;
38
+ }
39
+ &__info {
40
+ display: flex;
41
+ align-items: center;
42
+ }
43
+ &__entity-type {
44
+ padding: 3px 8px;
45
+ margin-right: 5px;
46
+ border-radius: 3px;
47
+ background-color: var(--yc-color-base-generic);
48
+ text-transform: lowercase;
49
+
50
+ &_error {
51
+ padding: 3px 0;
52
+ background-color: transparent;
53
+ }
54
+ }
55
+
56
+ &__tabs {
57
+ padding: 0 15px;
58
+ }
59
+
60
+ &__tab-content {
61
+ display: flex;
62
+ flex-direction: column;
63
+ flex: 1 1 auto;
64
+ padding: 0 15px;
65
+ overflow-y: auto;
66
+ }
67
+
68
+ &__hosts {
69
+ padding: 15px;
70
+ }
71
+ &__hosts-message {
72
+ @include body2-typography();
73
+ margin-bottom: 10px;
74
+ }
75
+ &__hosts-list {
76
+ margin: 10px 0;
77
+ padding-left: 7px;
78
+ list-style-type: none;
79
+ }
80
+ &__host-link {
81
+ font-size: var(--yc-text-body2-font-size);
82
+ line-height: var(--yc-text-body2-line-height);
83
+ margin-bottom: 3px;
84
+ }
85
+
86
+ &__clipboard-button {
87
+ margin-left: 5px;
88
+ color: var(--yc-color-text-secondary);
89
+ }
90
+ }
@@ -0,0 +1,150 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import {connect} from 'react-redux';
4
+ import PropTypes from 'prop-types';
5
+ import cn from 'bem-cn-lite';
6
+
7
+ import TreeView from '../../../../components/TreeView/TreeView';
8
+ import SchemaTree from '../../../Tenant/Schema/SchemaTree/SchemaTree';
9
+ import Icon from '../../../../components/Icon/Icon';
10
+
11
+ import {getSchema, setCurrentSchemaPath} from '../../../../store/reducers/schema';
12
+ import {getDescribe} from '../../../../store/reducers/describe';
13
+ import {getSchemaAcl} from '../../../../store/reducers/schemaAcl';
14
+
15
+ import './SchemaNode.scss';
16
+
17
+ const b = cn('schema-node');
18
+
19
+ export const FOLDERS_TYPE = [
20
+ 'EPathTypeDir',
21
+ 'EPathTypeSubDomain',
22
+ 'EPathTypeExtSubDomain',
23
+ 'EPathTypeOlapStore',
24
+ ];
25
+
26
+ class SchemaNode extends React.Component {
27
+ static propTypes = {
28
+ data: PropTypes.object.isRequired,
29
+ fullPath: PropTypes.string.isRequired,
30
+ getSchema: PropTypes.func.isRequired,
31
+ setCurrentSchemaPath: PropTypes.func,
32
+ currentSchemaPath: PropTypes.string,
33
+ };
34
+
35
+ state = {
36
+ collapsed: true,
37
+ };
38
+
39
+ schemaNodeRef = React.createRef();
40
+
41
+ componentDidMount() {
42
+ const {currentSchemaPath, isRoot} = this.props;
43
+ const schemaPath = this.getSchemaPath();
44
+
45
+ if (schemaPath === currentSchemaPath) {
46
+ this.addActiveClass();
47
+ }
48
+
49
+ if (
50
+ (currentSchemaPath &&
51
+ currentSchemaPath.startsWith(schemaPath) &&
52
+ currentSchemaPath !== schemaPath) ||
53
+ isRoot
54
+ ) {
55
+ this.setState({collapsed: false});
56
+ }
57
+ }
58
+
59
+ getSchemaPath = () => {
60
+ const {data, fullPath, isRoot} = this.props;
61
+
62
+ return isRoot ? fullPath : `${fullPath}/${data.Name}`;
63
+ };
64
+
65
+ invertCollapsed = () => {
66
+ this.setState({collapsed: !this.state.collapsed});
67
+ };
68
+
69
+ setIcon = (data) => {
70
+ const {collapsed} = this.state;
71
+ if (FOLDERS_TYPE.indexOf(data.PathType) !== -1) {
72
+ return collapsed ? (
73
+ <Icon name="folder" viewBox="0 0 13 10" width={14} height={14} />
74
+ ) : (
75
+ <Icon name="openFolder" viewBox="0 0 13 10" width={14} height={14} />
76
+ );
77
+ } else if (data.PathType === 'EPathTypeTable' || data.PathType === 'EPathTypeOlapTable') {
78
+ return <Icon name="table" viewBox="0 0 13 10" width={14} height={14} />;
79
+ }
80
+ };
81
+
82
+ addActiveClass = () => {
83
+ const activeClass = 'schema-node_active';
84
+ const currentActiveSchemaNode = document.querySelector(`.${activeClass}`);
85
+ if (currentActiveSchemaNode) {
86
+ currentActiveSchemaNode.classList.remove(activeClass);
87
+ }
88
+ // eslint-disable-next-line react/no-find-dom-node
89
+ const activeNode = ReactDOM.findDOMNode(this);
90
+ if (activeNode) {
91
+ activeNode.classList.add(activeClass);
92
+ }
93
+ };
94
+
95
+ handleClick = (e) => {
96
+ const {getSchema, getDescribe, getSchemaAcl, setCurrentSchemaPath} = this.props;
97
+ e.stopPropagation();
98
+ this.addActiveClass();
99
+
100
+ const schemaPath = this.getSchemaPath();
101
+ setCurrentSchemaPath(schemaPath);
102
+ getSchema({path: schemaPath});
103
+ getDescribe({path: schemaPath});
104
+ getSchemaAcl({path: schemaPath});
105
+ };
106
+
107
+ render() {
108
+ const {data, fullPath, isRoot = false} = this.props;
109
+ const {collapsed} = this.state;
110
+
111
+ if (!data) {
112
+ return null;
113
+ }
114
+
115
+ const hasArrow = data.PathType !== 'EPathTypeTable';
116
+ const label = (
117
+ <div className={b('label')}>
118
+ {this.setIcon(data)}
119
+ <div className={b('name')}>{data.Name}</div>
120
+ </div>
121
+ );
122
+ return (
123
+ <div onClick={this.handleClick} ref={this.schemaNodeRef}>
124
+ <TreeView
125
+ nodeLabel={label}
126
+ collapsed={collapsed}
127
+ onClick={this.invertCollapsed}
128
+ hasArrow={hasArrow}
129
+ >
130
+ <SchemaTree path={isRoot ? fullPath : `${fullPath}/${data.Name}`} />
131
+ </TreeView>
132
+ </div>
133
+ );
134
+ }
135
+ }
136
+
137
+ function mapStateToProps(state) {
138
+ return {
139
+ currentSchemaPath: state.schema.currentSchemaPath,
140
+ };
141
+ }
142
+
143
+ const mapDispatchToProps = {
144
+ getSchema,
145
+ getDescribe,
146
+ getSchemaAcl,
147
+ setCurrentSchemaPath,
148
+ };
149
+
150
+ export default connect(mapStateToProps, mapDispatchToProps)(SchemaNode);