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,88 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import {connect} from 'react-redux';
4
+ import cn from 'bem-cn-lite';
5
+ import {withRouter} from 'react-router-dom';
6
+
7
+ import Host from '../../containers/Header/Host/Host';
8
+
9
+ import {backend, clusterName as clusterNameLocation} from '../../store';
10
+ import {getHostInfo} from '../../store/reducers/host';
11
+ import {getClusterInfo} from '../../store/reducers/cluster';
12
+ import {setSettingValue, getSettingValue} from '../../store/reducers/settings';
13
+ import {THEME_KEY} from '../../utils/constants';
14
+
15
+ import './Header.scss';
16
+
17
+ const b = cn('header');
18
+
19
+ const ClusterName = ({name}) => (
20
+ <div className={b('cluster-info')}>
21
+ <div className={b('cluster-info-title')}>cluster</div>
22
+ <div className={b('cluster-info-name')}>{name}</div>
23
+ </div>
24
+ );
25
+ ClusterName.propTypes = {
26
+ name: PropTypes.string,
27
+ };
28
+
29
+ class Header extends React.Component {
30
+ static propTypes = {
31
+ getHostInfo: PropTypes.func,
32
+ host: PropTypes.object,
33
+ pathname: PropTypes.string,
34
+ clusterName: PropTypes.string,
35
+ theme: PropTypes.string,
36
+ setSettingValue: PropTypes.func,
37
+ getSettingValue: PropTypes.func,
38
+ getClusterInfo: PropTypes.func,
39
+ singleClusterMode: PropTypes.bool,
40
+ };
41
+ componentDidMount() {
42
+ const {pathname, clusterName, singleClusterMode} = this.props;
43
+ const isClustersPage = pathname.includes('/clusters');
44
+
45
+ if (!isClustersPage && !clusterName && !singleClusterMode) {
46
+ this.props.getClusterInfo(clusterNameLocation);
47
+ }
48
+ this.props.getHostInfo();
49
+ }
50
+ render() {
51
+ const {host, clusterName: clusterNameWeb, singleClusterMode} = this.props;
52
+ const clusterName = singleClusterMode ? host.ClusterName : clusterNameWeb;
53
+
54
+ return (
55
+ <header className={b()}>
56
+ <div className={b('content')}>
57
+ {clusterName && <ClusterName name={clusterName} />}
58
+ </div>
59
+ {host.Host && (
60
+ <Host host={host} backend={backend} singleClusterMode={singleClusterMode} />
61
+ )}
62
+ </header>
63
+ );
64
+ }
65
+ }
66
+
67
+ const mapStateToProps = (state, ownProps) => {
68
+ const {singleClusterMode} = state;
69
+ const {data: host} = state.host;
70
+ const {pathname} = ownProps.location;
71
+
72
+ return {
73
+ singleClusterMode,
74
+ host,
75
+ pathname,
76
+ theme: getSettingValue(state, THEME_KEY),
77
+ clusterName: state.cluster.data?.Name || state.clusterInfo.title,
78
+ };
79
+ };
80
+
81
+ const mapDispatchToProps = {
82
+ getHostInfo,
83
+ setSettingValue,
84
+ getClusterInfo,
85
+ };
86
+
87
+ const ConnectedHeader = connect(mapStateToProps, mapDispatchToProps)(Header);
88
+ export default withRouter(ConnectedHeader);
@@ -0,0 +1,72 @@
1
+ .header {
2
+ height: 60px;
3
+ flex: 0 0 auto;
4
+ padding: 0 15px;
5
+ display: flex;
6
+ align-items: center;
7
+ justify-content: space-between;
8
+ border-bottom: 1px solid var(--yc-color-base-generic);
9
+
10
+ &__logo {
11
+ margin-right: 40px;
12
+ color: var(--yc-color-text-dark-primary);
13
+ .yc-root_theme_dark & {
14
+ color: var(--yc-color-text-light-primary);
15
+ }
16
+ .yc-root_theme_light & {
17
+ color: var(--yc-color-text-dark-primary);
18
+ }
19
+ user-select: none;
20
+ height: 38px;
21
+ width: 143px;
22
+ }
23
+ &__cluster-info {
24
+ }
25
+ &__cluster-info-title {
26
+ color: var(--yc-color-text-secondary);
27
+ text-transform: uppercase;
28
+ font-size: 12px;
29
+ margin-bottom: 3px;
30
+ }
31
+ &__cluster-info-name {
32
+ font-size: 17px;
33
+ font-weight: 500;
34
+ }
35
+
36
+ &__theme-toggle {
37
+ display: flex;
38
+ align-items: center;
39
+ margin-right: 15px;
40
+ margin-left: auto;
41
+ color: var(--yc-color-text-primary);
42
+
43
+ .yc-button {
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ }
48
+
49
+ .yc-button__text {
50
+ margin: 0;
51
+ }
52
+ }
53
+
54
+ &__theme-toggle + .host {
55
+ margin-left: 25px;
56
+ }
57
+
58
+ &__space-divider {
59
+ width: 100%;
60
+ }
61
+
62
+ &__theme-button {
63
+ width: 36px;
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ }
68
+
69
+ &__help-center {
70
+ margin-right: 15px;
71
+ }
72
+ }
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import cn from 'bem-cn-lite';
4
+
5
+ import {Link as ExternalLink} from '@yandex-cloud/uikit';
6
+
7
+ import EntityStatus from '../../../components/EntityStatus/EntityStatus';
8
+ import {Tag} from '../../../components/Tag/Tag';
9
+
10
+ import {calcUptime} from '../../../utils';
11
+ import {customBackend} from '../../../store';
12
+
13
+ import './Host.scss';
14
+
15
+ const b = cn('host');
16
+
17
+ export default class Host extends React.Component {
18
+ static propTypes = {
19
+ host: PropTypes.object,
20
+ singleClusterMode: PropTypes.bool,
21
+ };
22
+
23
+ renderStatus = () => {
24
+ const {host} = this.props;
25
+
26
+ return (
27
+ <div className={b('status')}>
28
+ <EntityStatus size="m" status={host.SystemState} name={'Internal viewer'} />
29
+ </div>
30
+ );
31
+ };
32
+
33
+ render() {
34
+ const {host, backend, singleClusterMode} = this.props;
35
+ const uptime = calcUptime(host.StartTime);
36
+
37
+ let link = backend + '/internal';
38
+
39
+ if (singleClusterMode && !customBackend) {
40
+ link = `/internal`;
41
+ }
42
+
43
+ return (
44
+ <div className={b()}>
45
+ <div className={b('common')}>
46
+ {link ? (
47
+ <ExternalLink href={link}>{this.renderStatus()}</ExternalLink>
48
+ ) : (
49
+ this.renderStatus()
50
+ )}
51
+ <Tag text={host.DataCenter} />
52
+ </div>
53
+ <div className={b('info')}>
54
+ <div className={b('info-item')}>
55
+ <div className={b('label')}>Uptime</div>
56
+ <div className={b('value')}>{uptime}</div>
57
+ </div>
58
+ <div className={b('info-item')}>
59
+ <div className={b('label')}>Version</div>
60
+ <div className={b('value')}>{host.Version}</div>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ );
65
+ }
66
+ }
@@ -0,0 +1,43 @@
1
+ .host {
2
+ display: flex;
3
+ flex-direction: column;
4
+
5
+ &__common {
6
+ display: flex;
7
+ align-items: center;
8
+ margin-bottom: 4px;
9
+ }
10
+ &__status {
11
+ display: flex;
12
+ margin-right: 15px;
13
+ font-size: var(--yc-text-body2-font-size);
14
+ line-height: var(--yc-text-body2-line-height);
15
+ }
16
+ &__info {
17
+ display: flex;
18
+ align-items: center;
19
+ }
20
+ &__info-item {
21
+ display: flex;
22
+ margin-right: 20px;
23
+
24
+ &:last-child {
25
+ margin-right: 0;
26
+ }
27
+ }
28
+ &__label {
29
+ color: var(--yc-color-text-hint);
30
+ font-size: var(--yc-text-body-font-size);
31
+ line-height: var(--yc-text-body-line-height);
32
+ margin-right: 10px;
33
+
34
+ .yc-root_theme_dark & {
35
+ color: var(--yc-color-text-hint);
36
+ }
37
+ }
38
+ &__value {
39
+ color: var(--yc-color-text-primary);
40
+ font-size: var(--yc-text-body-font-size);
41
+ line-height: var(--yc-text-body-line-height);
42
+ }
43
+ }
@@ -0,0 +1,246 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import {connect} from 'react-redux';
4
+ import cn from 'bem-cn-lite';
5
+
6
+ import {getTabletsInfo, setHeatmapOptions} from '../../store/reducers/heatmap';
7
+ import {showTooltip, hideTooltip} from '../../store/reducers/tooltip';
8
+ import {COLORS_RANGE_SIZE, getColorRange, getColorIndex, getCurrentMetricLimits} from './util';
9
+ import {formatNumber} from '../../utils';
10
+
11
+ import {Loader, Checkbox} from '@yandex-cloud/uikit';
12
+ import {Select} from '@yandex-cloud/uikit/build/esm/components/unstable/Select';
13
+ import {HeatmapCanvas} from './HeatmapCanvas/HeatmapCanvas';
14
+ import {Histogram} from './Histogram/Histogram';
15
+ import {AutoFetcher} from '../Cluster/Cluster';
16
+
17
+ import './Heatmap.scss';
18
+
19
+ const b = cn('heatmap');
20
+ const COLORS_RANGE = getColorRange(COLORS_RANGE_SIZE);
21
+
22
+ const PageLoader = () => (
23
+ <div className={b('loader')}>
24
+ <Loader size="m" />
25
+ </div>
26
+ );
27
+
28
+ class Heatmap extends React.Component {
29
+ static propTypes = {
30
+ tablets: PropTypes.array,
31
+ error: PropTypes.bool,
32
+ wasLoaded: PropTypes.bool,
33
+ loading: PropTypes.bool,
34
+ showTooltip: PropTypes.func,
35
+ hideTooltip: PropTypes.func,
36
+ getTabletsInfo: PropTypes.func,
37
+ nodeId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
38
+ timeoutForRequest: PropTypes.number,
39
+ path: PropTypes.string,
40
+ clearWasLoadingFlag: PropTypes.func,
41
+ metrics: PropTypes.array,
42
+ sort: PropTypes.bool,
43
+ heatmap: PropTypes.bool,
44
+ currentMetric: PropTypes.string,
45
+ setHeatmapOptions: PropTypes.func,
46
+ };
47
+ autofetcher;
48
+
49
+ componentDidMount() {
50
+ this.getTablets();
51
+ this.autofetcher = new AutoFetcher();
52
+ this.setInitialMetric();
53
+ if (this.props.autorefresh) {
54
+ this.autofetcher.start();
55
+ this.autofetcher.fetch(() => this.getTablets());
56
+ }
57
+ }
58
+ componentDidUpdate(prevProps) {
59
+ const {path, autorefresh} = this.props;
60
+
61
+ if (path && prevProps.path !== path) {
62
+ this.props.setHeatmapOptions({
63
+ wasLoaded: false,
64
+ });
65
+ this.getTablets();
66
+ }
67
+
68
+ if (autorefresh && !prevProps.autorefresh) {
69
+ this.getTablets();
70
+ this.autofetcher.start();
71
+ this.autofetcher.fetch(() => this.getTablets());
72
+ }
73
+ if (!autorefresh && prevProps.autorefresh) {
74
+ this.autofetcher.stop();
75
+ }
76
+
77
+ this.setInitialMetric();
78
+ }
79
+ componentWillUnmount() {
80
+ this.autofetcher.stop();
81
+ }
82
+
83
+ itemsContainer = React.createRef();
84
+
85
+ setInitialMetric = () => {
86
+ const {metrics, currentMetric} = this.props;
87
+
88
+ if (!currentMetric && metrics && metrics.length) {
89
+ this.props.setHeatmapOptions({
90
+ currentMetric: metrics[0].value,
91
+ });
92
+ }
93
+ };
94
+ getTablets = () => {
95
+ const {path} = this.props;
96
+
97
+ this.props.getTabletsInfo({path});
98
+ };
99
+ _onMetricChange = (value) => {
100
+ this.props.setHeatmapOptions({
101
+ currentMetric: value,
102
+ });
103
+ };
104
+ _onCheckboxChange = () => {
105
+ this.props.setHeatmapOptions({
106
+ sort: !this.props.sort,
107
+ });
108
+ };
109
+ _onHeatmapChange = () => {
110
+ this.props.setHeatmapOptions({
111
+ heatmap: !this.props.heatmap,
112
+ });
113
+ };
114
+ renderHistogram() {
115
+ const {tablets, currentMetric} = this.props;
116
+
117
+ return (
118
+ <Histogram
119
+ tablets={tablets}
120
+ currentMetric={currentMetric}
121
+ showTooltip={this.props.showTooltip}
122
+ hideTooltip={this.props.hideTooltip}
123
+ />
124
+ );
125
+ }
126
+ renderHeatmapCanvas() {
127
+ const {tablets, currentMetric, sort} = this.props;
128
+
129
+ const {min, max} = getCurrentMetricLimits(currentMetric, tablets);
130
+
131
+ const preparedTablets = tablets.map((tablet) => {
132
+ const value = currentMetric && Number(tablet.metrics[currentMetric]);
133
+ const colorIndex = getColorIndex(value, min, max);
134
+ const color = COLORS_RANGE[colorIndex];
135
+
136
+ return {
137
+ ...tablet,
138
+ color,
139
+ value,
140
+ formattedValue: formatNumber(value),
141
+ currentMetric,
142
+ };
143
+ });
144
+ const sortedTablets = sort
145
+ ? preparedTablets.sort((a, b) => b.value - a.value)
146
+ : preparedTablets;
147
+
148
+ return (
149
+ <div ref={this.itemsContainer} className={b('items')}>
150
+ <HeatmapCanvas
151
+ tablets={sortedTablets}
152
+ parentRef={this.itemsContainer}
153
+ showTooltip={this.props.showTooltip}
154
+ hideTooltip={this.props.hideTooltip}
155
+ currentMetric={currentMetric}
156
+ />
157
+ </div>
158
+ );
159
+ }
160
+ renderContent() {
161
+ const {tablets, metrics, currentMetric, heatmap, sort} = this.props;
162
+
163
+ const {min, max} = getCurrentMetricLimits(currentMetric, tablets);
164
+
165
+ return (
166
+ <div className={b()}>
167
+ <div className={b('filters')}>
168
+ <Select
169
+ className={b('heatmap-select')}
170
+ value={currentMetric}
171
+ options={metrics}
172
+ onUpdate={this._onMetricChange}
173
+ width={200}
174
+ />
175
+ <div className={b('sort-checkbox')}>
176
+ <Checkbox onUpdate={this._onCheckboxChange} checked={sort}>
177
+ Sort
178
+ </Checkbox>
179
+ </div>
180
+ <div className={b('histogram-checkbox')}>
181
+ <Checkbox onUpdate={this._onHeatmapChange} checked={heatmap}>
182
+ Heatmap
183
+ </Checkbox>
184
+ </div>
185
+ <div className={b('limits')}>
186
+ <div className={b('limits-block')}>
187
+ <div className={b('limits-title')}>min:</div>
188
+ <div className={b('limits-value')}>
189
+ {Number.isInteger(min) ? formatNumber(min) : '—'}
190
+ </div>
191
+ </div>
192
+ <div className={b('limits-block')}>
193
+ <div className={b('limits-title')}>max:</div>
194
+ <div className={b('limits-value')}>
195
+ {Number.isInteger(max) ? formatNumber(max) : '—'}
196
+ </div>
197
+ </div>
198
+ <div className={b('limits-block')}>
199
+ <div className={b('limits-title')}>count:</div>
200
+ <div className={b('limits-value')}>{formatNumber(tablets.length)}</div>
201
+ </div>
202
+ </div>
203
+ </div>
204
+ {heatmap ? this.renderHeatmapCanvas() : this.renderHistogram()}
205
+ </div>
206
+ );
207
+ }
208
+ render() {
209
+ const {loading, wasLoaded} = this.props;
210
+
211
+ return loading && !wasLoaded ? <PageLoader /> : this.renderContent();
212
+ }
213
+ }
214
+
215
+ const mapStateToProps = (state) => {
216
+ const {
217
+ loading,
218
+ data: tablets = [],
219
+ metrics,
220
+ sort,
221
+ heatmap,
222
+ currentMetric,
223
+ wasLoaded,
224
+ } = state.heatmap;
225
+ const {autorefresh} = state.schema;
226
+
227
+ return {
228
+ tablets,
229
+ loading,
230
+ metrics,
231
+ sort,
232
+ heatmap,
233
+ currentMetric,
234
+ wasLoaded,
235
+ autorefresh,
236
+ };
237
+ };
238
+
239
+ const mapDispatchToProps = {
240
+ getTabletsInfo,
241
+ hideTooltip,
242
+ showTooltip,
243
+ setHeatmapOptions,
244
+ };
245
+
246
+ export default connect(mapStateToProps, mapDispatchToProps)(Heatmap);
@@ -0,0 +1,94 @@
1
+ @import '../../styles/mixins';
2
+
3
+ .heatmap {
4
+ @include flex-container();
5
+ overflow: auto;
6
+
7
+ &__loader {
8
+ display: flex;
9
+ flex: 1 1 auto;
10
+ align-items: center;
11
+ justify-content: center;
12
+ }
13
+
14
+ &__limits {
15
+ display: flex;
16
+ align-items: center;
17
+ margin-left: 20px;
18
+ }
19
+ &__limits-block {
20
+ display: flex;
21
+ margin-right: 10px;
22
+ }
23
+ &__limits-title {
24
+ color: var(--yc-color-text-secondary);
25
+ margin-right: 5px;
26
+ }
27
+ &__limits-value {
28
+ }
29
+
30
+ &__row {
31
+ display: flex;
32
+ align-items: center;
33
+
34
+ &_overall {
35
+ margin: 15px 20px;
36
+
37
+ .yc-progress {
38
+ width: 300px;
39
+ margin: 0;
40
+ }
41
+ }
42
+ }
43
+
44
+ &__label {
45
+ font-size: var(--yc-text-body2-font-size);
46
+ line-height: var(--yc-text-body2-line-height);
47
+ font-weight: 500;
48
+ text-transform: uppercase;
49
+ margin-right: 16px;
50
+
51
+ &_overall {
52
+ margin-right: 15px;
53
+ }
54
+ }
55
+
56
+ &__items {
57
+ overflow: auto;
58
+ }
59
+ &__canvas-container {
60
+ overflow: auto;
61
+ cursor: pointer;
62
+ }
63
+
64
+ &__filters {
65
+ display: flex;
66
+ align-items: center;
67
+ margin: 10px 0;
68
+ }
69
+
70
+ &__filter-control {
71
+ margin-right: 10px;
72
+ min-width: 100px;
73
+ max-width: 200px;
74
+
75
+ &:last-child {
76
+ margin-right: 0;
77
+ }
78
+ }
79
+ &__sort-checkbox {
80
+ margin-left: 10px;
81
+ }
82
+ &__histogram-checkbox {
83
+ margin-left: 10px;
84
+ }
85
+
86
+ &__row {
87
+ display: flex;
88
+ margin-bottom: 2px;
89
+ }
90
+
91
+ .tablet {
92
+ margin-bottom: 2px;
93
+ }
94
+ }