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,41 @@
1
+ .schema-node {
2
+ display: flex;
3
+ align-items: center;
4
+
5
+ .tree-view_item {
6
+ padding: 5px 0;
7
+ margin: 0;
8
+ flex-wrap: wrap;
9
+ }
10
+
11
+ .tree-view_children {
12
+ padding-left: 15px;
13
+ margin: 0;
14
+ }
15
+
16
+ &__label {
17
+ display: flex;
18
+ align-items: center;
19
+ overflow: hidden;
20
+ cursor: pointer;
21
+ padding: 0 5px;
22
+ border-radius: 3px;
23
+ height: 20px;
24
+
25
+ &:hover {
26
+ background-color: var(--yc-color-base-info-hover);
27
+ }
28
+ }
29
+
30
+ &_active > .tree-view > .tree-view_item &__label {
31
+ background-color: var(--yc-color-base-info);
32
+ }
33
+
34
+ &__name {
35
+ display: inline;
36
+ text-overflow: ellipsis;
37
+ white-space: nowrap;
38
+ overflow: hidden;
39
+ margin-left: 6px;
40
+ }
41
+ }
@@ -0,0 +1,56 @@
1
+ export const QUERY = 'Query';
2
+ export const INFO = 'Info';
3
+ export const PREVIEW = 'Preview';
4
+ export const TABLETS = 'Tablets';
5
+ export const GRAPH = 'Graph';
6
+ export const DESCRIBE = 'Describe';
7
+ export const ACL = 'ACL';
8
+ export const TOP_QUERIES = 'Top queries';
9
+ export const TOP_SHARDS = 'Top shards';
10
+ export const HOT_KEYS = 'Hot keys';
11
+
12
+ export const GENERAL_SCHEMA_PAGES = [
13
+ {
14
+ id: INFO,
15
+ name: 'Info',
16
+ },
17
+ {
18
+ id: PREVIEW,
19
+ name: 'Preview',
20
+ },
21
+ {
22
+ id: GRAPH,
23
+ name: 'Graph',
24
+ },
25
+ {
26
+ id: DESCRIBE,
27
+ name: DESCRIBE,
28
+ },
29
+ {
30
+ id: QUERY,
31
+ name: 'Query',
32
+ },
33
+ {
34
+ id: TABLETS,
35
+ name: 'Tablets',
36
+ },
37
+ {
38
+ id: ACL,
39
+ name: 'ACL',
40
+ },
41
+ {
42
+ id: TOP_QUERIES,
43
+ name: 'Top queries',
44
+ },
45
+ {
46
+ id: TOP_SHARDS,
47
+ name: 'Top shards',
48
+ },
49
+ ];
50
+
51
+ export const TABLE_SCHEMA_PAGES = [
52
+ {
53
+ id: HOT_KEYS,
54
+ name: 'Hot keys',
55
+ },
56
+ ];
@@ -0,0 +1,115 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import cn from 'bem-cn-lite';
4
+ import PropTypes from 'prop-types';
5
+ import {connect} from 'react-redux';
6
+ import {Loader} from '@yandex-cloud/uikit';
7
+ import {getSchema} from '../../../../store/reducers/schema';
8
+ import './SchemaTree.scss';
9
+
10
+ import SchemaNode from '../SchemaNode/SchemaNode';
11
+
12
+ const b = cn('schema');
13
+
14
+ class SchemaTree extends React.Component {
15
+ static propTypes = {
16
+ className: PropTypes.string,
17
+ loading: PropTypes.bool,
18
+ error: PropTypes.object,
19
+ schema: PropTypes.object,
20
+ wasLoaded: PropTypes.bool,
21
+ getSchema: PropTypes.func,
22
+ path: PropTypes.string.isRequired,
23
+ tenantPath: PropTypes.string,
24
+ };
25
+
26
+ componentDidMount() {
27
+ const {path: tenantPath, getSchema} = this.props;
28
+
29
+ getSchema({path: tenantPath});
30
+ }
31
+
32
+ emptySchema = React.createRef();
33
+
34
+ renderLoader() {
35
+ return (
36
+ <div className="loader">
37
+ <Loader size="l" />
38
+ </div>
39
+ );
40
+ }
41
+
42
+ removeArrow = () => {
43
+ // А как еще эту задачу решить, кроме как лезть в DOM?
44
+ const nodeWithArrow =
45
+ // eslint-disable-next-line react/no-find-dom-node
46
+ ReactDOM.findDOMNode(this)?.parentNode?.parentNode?.querySelector('.tree-view_arrow');
47
+ if (nodeWithArrow) {
48
+ nodeWithArrow.setAttribute('style', 'visibility: hidden');
49
+ }
50
+
51
+ return '';
52
+ };
53
+
54
+ showEmptyNode() {
55
+ const {tenantPath, schema} = this.props;
56
+ if (schema.Path === tenantPath) {
57
+ return 'no data';
58
+ } else {
59
+ return String(this.removeArrow());
60
+ }
61
+ }
62
+
63
+ renderContent = () => {
64
+ const {schema, path} = this.props;
65
+ if (schema && schema.Status === 'StatusSuccess') {
66
+ return (
67
+ <div className={b()}>
68
+ {schema && schema.PathDescription && schema.PathDescription.Children ? (
69
+ schema.PathDescription.Children.map((it, key) => (
70
+ <SchemaNode key={key} fullPath={path} data={it} />
71
+ ))
72
+ ) : (
73
+ <div ref={this.emptySchema}>{this.showEmptyNode()}</div>
74
+ )}
75
+ </div>
76
+ );
77
+ } else {
78
+ return this.renderLoader();
79
+ }
80
+ };
81
+
82
+ render() {
83
+ const {loading, wasLoaded, error, currentSchema: schema} = this.props;
84
+ if (loading && !wasLoaded) {
85
+ return this.renderLoader();
86
+ } else if (
87
+ (error && !error.isCancelled) ||
88
+ (schema && schema.Status === 'StatusAccessDenied')
89
+ ) {
90
+ return <div>{error?.statusText || 'Access denied'}</div>;
91
+ } else {
92
+ return this.renderContent();
93
+ }
94
+ }
95
+ }
96
+
97
+ function mapStateToProps(state, ownProps) {
98
+ const {data: schema = {}, loading, wasLoaded, error, currentSchema} = state.schema;
99
+ const tenantPath = state.tenant.tenant.Name;
100
+ const {path} = ownProps;
101
+ return {
102
+ tenantPath,
103
+ schema: schema[`${path}`],
104
+ loading,
105
+ wasLoaded,
106
+ error,
107
+ currentSchema,
108
+ };
109
+ }
110
+
111
+ const mapDispatchToProps = {
112
+ getSchema,
113
+ };
114
+
115
+ export default connect(mapStateToProps, mapDispatchToProps)(SchemaTree);
@@ -0,0 +1,13 @@
1
+ @import '../../../../styles/mixins.scss';
2
+
3
+ .schema {
4
+ .tree-view_item {
5
+ padding: 2px 0;
6
+ margin: 0;
7
+ }
8
+
9
+ .tree-view_children {
10
+ padding-left: 15px;
11
+ margin: 0;
12
+ }
13
+ }
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import cn from 'bem-cn-lite';
4
+ import './SchemaViewer.scss';
5
+
6
+ import find from 'lodash/find';
7
+
8
+ import Icon from '../../../../components/Icon/Icon';
9
+
10
+ const b = cn('schema-viewer');
11
+
12
+ class SchemaViewer extends React.Component {
13
+ static propTypes = {
14
+ data: PropTypes.arrayOf(PropTypes.object),
15
+ };
16
+ render() {
17
+ const {data = {}} = this.props;
18
+ const keyColumnsIds = data.KeyColumnIds ?? [];
19
+ const keyColumns = keyColumnsIds.map((key) => {
20
+ const keyColumn = find(data.Columns, {Id: key});
21
+ return keyColumn;
22
+ });
23
+ const restColumns = data.Columns?.filter((item) => !keyColumnsIds.includes(item.Id)) ?? [];
24
+
25
+ const columns = [...keyColumns, ...restColumns];
26
+
27
+ return (
28
+ <div className={b()}>
29
+ <div className={b('title')}>Schema</div>
30
+ {columns.length > 0 ? (
31
+ <table className={b('table')}>
32
+ {columns.map((info, key) => (
33
+ <tr key={key} className={b('row')}>
34
+ <td>
35
+ {keyColumnsIds.includes(info.Id) && (
36
+ <div className={b('key-icon')}>
37
+ <Icon
38
+ name="key"
39
+ viewBox="0 0 12 7"
40
+ width={12}
41
+ height={7}
42
+ />
43
+ </div>
44
+ )}
45
+ </td>
46
+ <td className={b('type')}>
47
+ <span>{info.Type}</span>
48
+ </td>
49
+ <td className={b('name')}>
50
+ <span>{info.Name}</span>
51
+ </td>
52
+ </tr>
53
+ ))}
54
+ </table>
55
+ ) : (
56
+ <div>no schema data</div>
57
+ )}
58
+ </div>
59
+ );
60
+ }
61
+ }
62
+
63
+ export default SchemaViewer;
@@ -0,0 +1,28 @@
1
+ .schema-viewer {
2
+ &__title {
3
+ font-weight: 500;
4
+ }
5
+ &__row {
6
+ position: relative;
7
+ margin-bottom: 5px;
8
+ }
9
+ &__key-icon {
10
+ display: flex;
11
+ align-items: center;
12
+ }
13
+ &__table {
14
+ background: none;
15
+ text-align: left;
16
+ margin-top: -6px;
17
+
18
+ td {
19
+ padding: 5px 2px;
20
+ }
21
+ }
22
+ &__type {
23
+ color: var(--yc-color-text-secondary);
24
+ }
25
+ &__name {
26
+ padding-left: 10px !important;
27
+ }
28
+ }
@@ -0,0 +1,199 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import {connect} from 'react-redux';
4
+ import {Link} from 'react-router-dom';
5
+ import cn from 'bem-cn-lite';
6
+ import qs from 'qs';
7
+
8
+ import {Loader, Tabs} from '@yandex-cloud/uikit';
9
+
10
+ import TenantOverview from '../../components/TenantOverview/TenantOverview';
11
+ import Storage from '../StorageV2/Storage';
12
+ import Compute from '../Tenant/Compute/Compute';
13
+ import SchemaMain from '../Tenant/Schema/SchemaMain/SchemaMain';
14
+ import Network from '../Tenant/Network/Network';
15
+ import EmptyState from '../../components/EmptyState/EmptyState';
16
+ import {INFO} from './Schema/SchemaPages';
17
+ import Healthcheck from './Healthcheck/Healthcheck';
18
+ import {HEALTHCHECK, STORAGE, COMPUTE, SCHEMA, TENANT_PAGES, NETWORK} from './TenantPages';
19
+
20
+ import Icon from '../../components/Icon/Icon';
21
+
22
+ import {hideTooltip, showTooltip} from '../../store/reducers/tooltip';
23
+ import {getTenantInfo, clearTenant} from '../../store/reducers/tenant';
24
+ import routes, {createHref} from '../../routes';
25
+
26
+ import './Tenant.scss';
27
+
28
+ const b = cn('tenant-page');
29
+
30
+ class Tenant extends React.Component {
31
+ static propTypes = {
32
+ history: PropTypes.object,
33
+ name: PropTypes.string,
34
+ getTenantInfo: PropTypes.func,
35
+ tenant: PropTypes.object,
36
+ loading: PropTypes.bool,
37
+ wasLoaded: PropTypes.bool,
38
+ error: PropTypes.bool,
39
+ clearTenant: PropTypes.func,
40
+ activeTab: PropTypes.string,
41
+ systemTablets: PropTypes.array,
42
+ hideTooltip: PropTypes.func,
43
+ showTooltip: PropTypes.func,
44
+ tenantName: PropTypes.string,
45
+ schemaTab: PropTypes.string,
46
+ additionalTenantInfo: PropTypes.func,
47
+ additionalNodesInfo: PropTypes.object,
48
+ getBackend: PropTypes.func,
49
+ };
50
+ componentDidMount() {
51
+ const {tenantName} = this.props;
52
+ if (tenantName) {
53
+ this.props.getTenantInfo({path: tenantName});
54
+ }
55
+ }
56
+ renderLoader() {
57
+ return (
58
+ <div className={b('loader')}>
59
+ <Loader size="l" />
60
+ </div>
61
+ );
62
+ }
63
+ renderTabs() {
64
+ const {activeTab, tenantName} = this.props;
65
+
66
+ const pages = TENANT_PAGES.map((page) => {
67
+ return {
68
+ ...page,
69
+ path: createHref(routes.tenant, {page: page.id}, {name: tenantName}),
70
+ title: (
71
+ <div className={b('tab-label')}>
72
+ {page.icon}
73
+ {page.name}
74
+ </div>
75
+ ),
76
+ };
77
+ });
78
+
79
+ return (
80
+ <div className={b('tabs')}>
81
+ <Tabs
82
+ items={pages}
83
+ activeTab={activeTab}
84
+ wrapTo={({path, id}, node) => (
85
+ <Link to={path} key={id} className={b('tab')}>
86
+ {node}
87
+ </Link>
88
+ )}
89
+ allowNotSelected={true}
90
+ />
91
+ </div>
92
+ );
93
+ }
94
+ renderTabContent() {
95
+ const {activeTab, tenantName, schemaTab, queryParams, getBackend} = this.props;
96
+
97
+ switch (activeTab) {
98
+ case HEALTHCHECK: {
99
+ return (
100
+ <Healthcheck
101
+ tenant={tenantName}
102
+ hideTooltip={this.props.hideTooltip}
103
+ showTooltip={this.props.showTooltip}
104
+ />
105
+ );
106
+ }
107
+ case STORAGE: {
108
+ return (
109
+ <div className={b('storage')}>
110
+ <Storage tenant={tenantName} />
111
+ </div>
112
+ );
113
+ }
114
+ case COMPUTE: {
115
+ return <Compute additionalNodesInfo={this.props.additionalNodesInfo} />;
116
+ }
117
+ case SCHEMA: {
118
+ return (
119
+ <SchemaMain
120
+ activeTab={schemaTab}
121
+ tenantName={tenantName}
122
+ tenantActiveTab={activeTab}
123
+ queryParams={queryParams}
124
+ getBackend={getBackend}
125
+ />
126
+ );
127
+ }
128
+ case NETWORK: {
129
+ return <Network path={tenantName} />;
130
+ }
131
+ default:
132
+ return false;
133
+ }
134
+ }
135
+ render() {
136
+ const {tenant, loading, status} = this.props;
137
+ const {SystemTablets} = tenant;
138
+ if (status === 403) {
139
+ return (
140
+ <EmptyState
141
+ title="403 Access denied"
142
+ image={
143
+ <Icon name="accessDenied" viewBox="0 0 240 240" width={240} height={240} />
144
+ }
145
+ />
146
+ );
147
+ }
148
+
149
+ return loading ? (
150
+ this.renderLoader()
151
+ ) : (
152
+ <div className={b()}>
153
+ <div className={b('info')}>
154
+ <TenantOverview
155
+ systemTablets={SystemTablets}
156
+ tenant={tenant}
157
+ hideTooltip={this.props.hideTooltip}
158
+ showTooltip={this.props.showTooltip}
159
+ additionalTenantInfo={this.props.additionalTenantInfo}
160
+ />
161
+ {this.renderTabs()}
162
+ </div>
163
+ <div className={b('content')}>{this.renderTabContent()}</div>
164
+ </div>
165
+ );
166
+ }
167
+ }
168
+
169
+ const mapStateToProps = (state, ownProps) => {
170
+ const queryParams = qs.parse(ownProps.location.search, {
171
+ ignoreQueryPrefix: true,
172
+ });
173
+ const {name: tenantName, schemaTab = INFO} = queryParams;
174
+
175
+ const {tenant = {}, systemTablets = [], loading, data: {status} = {}} = state.tenant;
176
+ const {page: activeTab} = ownProps.match.params;
177
+ const {NodeId: currentBackendId} = state.host.data;
178
+
179
+ return {
180
+ activeTab,
181
+ tenant,
182
+ systemTablets,
183
+ tenantName,
184
+ loading,
185
+ schemaTab,
186
+ currentBackendId,
187
+ status,
188
+ queryParams,
189
+ };
190
+ };
191
+
192
+ const mapDispatchToProps = {
193
+ getTenantInfo,
194
+ clearTenant,
195
+ hideTooltip,
196
+ showTooltip,
197
+ };
198
+
199
+ export default connect(mapStateToProps, mapDispatchToProps)(Tenant);
@@ -0,0 +1,94 @@
1
+ @import '../../styles/mixins.scss';
2
+
3
+ .tenant-page {
4
+ overflow: auto;
5
+
6
+ font-size: var(--yc-text-body2-font-size);
7
+ line-height: var(--yc-text-body2-line-height);
8
+
9
+ .yc-tabs {
10
+ overflow: initial;
11
+ }
12
+
13
+ &__tab-label {
14
+ display: flex;
15
+ align-items: center;
16
+ gap: 5px;
17
+ }
18
+
19
+ &__loader {
20
+ display: flex;
21
+ align-items: center;
22
+ flex: 1 1 auto;
23
+ justify-content: center;
24
+ }
25
+
26
+ &__content {
27
+ overflow: auto;
28
+ @include flex-container();
29
+ }
30
+
31
+ &__storage {
32
+ overflow: auto;
33
+
34
+ height: 100%;
35
+
36
+ padding-left: 20px;
37
+ }
38
+
39
+ &__tabs {
40
+ padding: 0 15px;
41
+
42
+ &_schema {
43
+ overflow: auto;
44
+
45
+ height: 100%;
46
+ padding: 0;
47
+ @include flex-container();
48
+ }
49
+ }
50
+
51
+ &__tab {
52
+ margin-right: 40px;
53
+
54
+ text-decoration: none;
55
+
56
+ &:first-letter {
57
+ text-transform: uppercase;
58
+ }
59
+ }
60
+
61
+ &__row {
62
+ display: flex;
63
+ align-items: flex-start;
64
+
65
+ &_schema {
66
+ height: 100%;
67
+ }
68
+
69
+ &_schema-tags {
70
+ align-items: center;
71
+ }
72
+ }
73
+
74
+ &__schema-wrapper {
75
+ overflow: auto;
76
+
77
+ min-width: 300px;
78
+ height: 100%;
79
+ padding-top: 15px;
80
+ padding-left: 8px;
81
+ }
82
+
83
+ &__schema-tabs-wrapper {
84
+ overflow: auto;
85
+
86
+ width: 100%;
87
+ height: 100%;
88
+ padding: 15px 0 0 15px;
89
+
90
+ border-left: 1px solid rgba(0, 0, 0, 0.07);
91
+ @include flex-container();
92
+ }
93
+ @include flex-container();
94
+ }
@@ -0,0 +1,35 @@
1
+ import Icon from '../../components/Icon/Icon';
2
+
3
+ export const HEALTHCHECK = 'healthcheck';
4
+ export const STORAGE = 'storage';
5
+ export const COMPUTE = 'compute';
6
+ export const SCHEMA = 'schema';
7
+ export const NETWORK = 'network';
8
+
9
+ export const TENANT_PAGES = [
10
+ {
11
+ id: SCHEMA,
12
+ name: 'Schema',
13
+ icon: <Icon name="schema" viewBox="0 0 576 512" />,
14
+ },
15
+ {
16
+ id: STORAGE,
17
+ name: 'Storage',
18
+ icon: <Icon name="storage" viewBox="0 0 448 512" />,
19
+ },
20
+ {
21
+ id: COMPUTE,
22
+ name: 'Compute',
23
+ icon: <Icon name="compute" viewBox="0 0 384 512" />,
24
+ },
25
+ {
26
+ id: NETWORK,
27
+ name: 'Network',
28
+ icon: <Icon name="network" viewBox="0 0 640 512" />,
29
+ },
30
+ {
31
+ id: HEALTHCHECK,
32
+ name: 'Healthcheck',
33
+ icon: <Icon name="healthcheck" viewBox="0 0 512 512" />,
34
+ },
35
+ ];