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,368 @@
1
+ import * as React from 'react';
2
+ import cn from 'bem-cn-lite';
3
+
4
+ import {useMeasure} from 'react-use';
5
+ const block = cn('split');
6
+
7
+ import './SplitPane.scss';
8
+
9
+ const animationDuration = 200;
10
+
11
+ function Pane({className, children, size, split, style, hide, innerRef}) {
12
+ const [animate, setAnimate] = React.useState(hide === true);
13
+ const [hideInner, setHide] = React.useState(hide === true);
14
+
15
+ const secondary = size === undefined;
16
+
17
+ React.useLayoutEffect(() => {
18
+ setAnimate(true);
19
+ setHide(hide === true);
20
+ const timerId = window.setTimeout(() => setAnimate(false), animationDuration);
21
+ return () => {
22
+ clearTimeout(timerId);
23
+ };
24
+ }, [hide]);
25
+
26
+ const PaneStyle = {
27
+ ...style,
28
+ ...(secondary
29
+ ? undefined
30
+ : {
31
+ [split === 'vertical' ? 'width' : 'height']: hideInner ? 0 : size,
32
+ opacity: hideInner ? 0 : 1,
33
+ }),
34
+ ...(animate
35
+ ? {
36
+ overflow: 'hidden',
37
+ transition: `${
38
+ split === 'vertical' ? 'width' : 'height'
39
+ } ${animationDuration}ms, opacity ${animationDuration}ms`,
40
+ }
41
+ : undefined),
42
+ };
43
+ return (
44
+ <div
45
+ ref={innerRef}
46
+ className={block(
47
+ 'pane',
48
+ {secondary, hide: !secondary && hide},
49
+ classes(className, split),
50
+ )}
51
+ style={PaneStyle}
52
+ >
53
+ {children}
54
+ </div>
55
+ );
56
+ }
57
+
58
+ function Resizer({
59
+ className,
60
+ split,
61
+ style,
62
+ onClick,
63
+ onDoubleClick,
64
+ onMouseDown,
65
+ onTouchEnd,
66
+ onTouchStart,
67
+ allowResize,
68
+ active,
69
+ }) {
70
+ return (
71
+ <span
72
+ role="presentation"
73
+ className={block(
74
+ 'resizer',
75
+ classes(className, split, allowResize ? '' : 'disabled', active ? 'active' : ''),
76
+ )}
77
+ style={style}
78
+ onMouseDown={(event) => onMouseDown(event)}
79
+ onTouchStart={(event) => {
80
+ event.preventDefault();
81
+ onTouchStart(event);
82
+ }}
83
+ onTouchEnd={(event) => {
84
+ event.preventDefault();
85
+ onTouchEnd(event);
86
+ }}
87
+ onClick={(event) => {
88
+ if (onClick) {
89
+ event.preventDefault();
90
+ onClick(event);
91
+ }
92
+ }}
93
+ onDoubleClick={(event) => {
94
+ if (onDoubleClick) {
95
+ event.preventDefault();
96
+ onDoubleClick(event);
97
+ }
98
+ }}
99
+ />
100
+ );
101
+ }
102
+
103
+ export default function SplitPane({
104
+ className,
105
+ children,
106
+ split = 'vertical',
107
+ style,
108
+ size,
109
+ minSize = 50,
110
+ maxSize = -8,
111
+ defaultSize,
112
+ step,
113
+ primary = 'first',
114
+ allowResize = true,
115
+ hidePane,
116
+ onResizerClick,
117
+ onResizerDoubleClick,
118
+ onChange,
119
+ onDragStarted,
120
+ onDragFinished,
121
+ paneStyle,
122
+ pane1Style,
123
+ pane2Style,
124
+ paneClassName,
125
+ pane1ClassName,
126
+ pane2ClassName,
127
+ resizerClassName,
128
+ resizerStyle,
129
+ }) {
130
+ const [containerRef, {width, height}] = useMeasure();
131
+ const pane1Ref = React.useRef(null);
132
+ const pane2Ref = React.useRef(null);
133
+ const [paneSize, setPaneSize] = React.useState(() =>
134
+ size === undefined
135
+ ? getDefaultSize(split, {width, height}, defaultSize, minSize, maxSize)
136
+ : size,
137
+ );
138
+ const [active, setActive] = React.useState(false);
139
+ const draggedSizeRef = React.useRef();
140
+ const defaultSizeRef = React.useRef();
141
+ const minSizeRef = React.useRef();
142
+ const maxSizeRef = React.useRef();
143
+ const positionRef = React.useRef(0);
144
+ const slackRef = React.useRef(0);
145
+
146
+ defaultSizeRef.current = defaultSize;
147
+ minSizeRef.current = minSize;
148
+ maxSizeRef.current = maxSize;
149
+
150
+ React.useLayoutEffect(() => {
151
+ if (!active) {
152
+ const newSize =
153
+ size === undefined
154
+ ? getDefaultSize(
155
+ split,
156
+ {width, height},
157
+ defaultSizeRef.current,
158
+ minSizeRef.current,
159
+ maxSizeRef.current,
160
+ draggedSizeRef.current,
161
+ )
162
+ : size;
163
+
164
+ if (size !== undefined) {
165
+ draggedSizeRef.current = size;
166
+ }
167
+
168
+ setPaneSize(newSize);
169
+ }
170
+ }, [size, defaultSize, split, width, height, active]);
171
+
172
+ function onTouchStart(event) {
173
+ if (allowResize) {
174
+ unFocus(window);
175
+ positionRef.current =
176
+ split === 'vertical' ? event.touches[0].clientX : event.touches[0].clientY;
177
+ slackRef.current = 0;
178
+
179
+ if (typeof onDragStarted === 'function') {
180
+ onDragStarted();
181
+ }
182
+ setActive(true);
183
+ }
184
+ }
185
+
186
+ function onTouchMove(event) {
187
+ if (allowResize && active) {
188
+ unFocus(window);
189
+ const isPrimaryFirst = primary === 'first';
190
+ const node = isPrimaryFirst ? pane1Ref.current : pane2Ref.current;
191
+ const node2 = isPrimaryFirst ? pane2Ref.current : pane1Ref.current;
192
+ if (node && node2) {
193
+ if (node.getBoundingClientRect) {
194
+ const newPosition =
195
+ split === 'vertical' ? event.touches[0].clientX : event.touches[0].clientY;
196
+ let positionDelta = positionRef.current - newPosition;
197
+ if (step) {
198
+ if (Math.abs(positionDelta) < step) {
199
+ return;
200
+ }
201
+ positionDelta = Math.floor(positionDelta / step) * step;
202
+ }
203
+ let sizeDelta = isPrimaryFirst ? positionDelta : -positionDelta;
204
+
205
+ const pane1Order = parseInt(window.getComputedStyle(node).order, 10);
206
+ const pane2Order = parseInt(window.getComputedStyle(node2).order, 10);
207
+ if (pane1Order > pane2Order) {
208
+ sizeDelta = -sizeDelta;
209
+ }
210
+
211
+ const effectiveMaxSize = getEffectiveMaxSize(split, {width, height}, maxSize);
212
+
213
+ const {width: currentWidth, height: currentHeight} =
214
+ node.getBoundingClientRect();
215
+ const currentSize = split === 'vertical' ? currentWidth : currentHeight;
216
+ let newSize = slackRef.current + currentSize - sizeDelta;
217
+ positionRef.current = positionRef.current - positionDelta;
218
+
219
+ if (newSize < minSize) {
220
+ slackRef.current = newSize - minSize;
221
+ newSize = minSize;
222
+ } else if (effectiveMaxSize !== undefined && newSize > effectiveMaxSize) {
223
+ slackRef.current = newSize - effectiveMaxSize;
224
+ newSize = effectiveMaxSize;
225
+ } else {
226
+ slackRef.current = 0;
227
+ }
228
+
229
+ if (onChange) onChange(newSize);
230
+
231
+ draggedSizeRef.current = newSize;
232
+ setPaneSize(newSize);
233
+ }
234
+ }
235
+ }
236
+ }
237
+ const onTouchMoveRef = React.useRef(onTouchMove);
238
+ onTouchMoveRef.current = onTouchMove;
239
+
240
+ function onMouseMove(event) {
241
+ const eventWithTouches = Object.assign({}, event, {
242
+ touches: [{clientX: event.clientX, clientY: event.clientY}],
243
+ });
244
+ //@ts-ignore
245
+ onTouchMove(eventWithTouches);
246
+ }
247
+ const onMouseMoveRef = React.useRef(onMouseMove);
248
+ onMouseMoveRef.current = onMouseMove;
249
+
250
+ function onTouchEnd() {
251
+ if (allowResize && active) {
252
+ if (typeof onDragFinished === 'function') {
253
+ if (typeof paneSize === 'number') {
254
+ onDragFinished(paneSize);
255
+ }
256
+ }
257
+ setActive(false);
258
+ }
259
+ }
260
+ const onTouchEndRef = React.useRef(onTouchEnd);
261
+ onTouchEndRef.current = onTouchEnd;
262
+
263
+ function onMouseDown(event) {
264
+ const eventWithTouches = Object.assign({}, event, {
265
+ touches: [{clientX: event.clientX, clientY: event.clientY}],
266
+ });
267
+ //@ts-ignore
268
+ onTouchStart(eventWithTouches);
269
+ }
270
+
271
+ React.useEffect(() => {
272
+ function onTouchEndInner() {
273
+ // eslint-disable-next-line no-unused-expressions
274
+ onTouchEndRef.current?.();
275
+ }
276
+ function onMouseMoveInner(e) {
277
+ // eslint-disable-next-line no-unused-expressions
278
+ onMouseMoveRef.current?.(e);
279
+ }
280
+ function onTouchMoveInner(e) {
281
+ // eslint-disable-next-line no-unused-expressions
282
+ onTouchMoveRef.current?.(e);
283
+ }
284
+ document.addEventListener('mouseup', onTouchEndInner);
285
+ document.addEventListener('mousemove', onMouseMoveInner);
286
+ document.addEventListener('touchmove', onTouchMoveInner);
287
+ return () => {
288
+ document.removeEventListener('mouseup', onTouchEndInner);
289
+ document.removeEventListener('mousemove', onMouseMoveInner);
290
+ document.removeEventListener('touchmove', onTouchMoveInner);
291
+ };
292
+ }, []);
293
+ const notNullChildren = React.Children.toArray(children).filter(Boolean);
294
+
295
+ return (
296
+ <div
297
+ className={block(null, classes(className, split, allowResize ? '' : 'disabled'))}
298
+ ref={containerRef}
299
+ style={style}
300
+ >
301
+ <Pane
302
+ innerRef={pane1Ref}
303
+ className={classes(paneClassName, pane1ClassName)}
304
+ split={split}
305
+ style={{...paneStyle, ...pane1Style}}
306
+ size={primary === 'first' ? paneSize : undefined}
307
+ hide={hidePane}
308
+ >
309
+ {notNullChildren[0]}
310
+ </Pane>
311
+ <Resizer
312
+ className={resizerClassName}
313
+ style={resizerStyle}
314
+ onClick={onResizerClick}
315
+ onDoubleClick={onResizerDoubleClick}
316
+ onMouseDown={onMouseDown}
317
+ onTouchEnd={onTouchEnd}
318
+ onTouchStart={onTouchStart}
319
+ split={split}
320
+ allowResize={allowResize && !hidePane}
321
+ active={active}
322
+ />
323
+ <Pane
324
+ innerRef={pane2Ref}
325
+ className={classes(paneClassName, pane2ClassName)}
326
+ split={split}
327
+ style={{...paneStyle, ...pane2Style}}
328
+ size={primary === 'second' ? paneSize : undefined}
329
+ hide={hidePane}
330
+ >
331
+ {notNullChildren[1]}
332
+ </Pane>
333
+ </div>
334
+ );
335
+ }
336
+
337
+ function classes(...classList) {
338
+ return classList.filter(Boolean).join(' ');
339
+ }
340
+
341
+ function unFocus(window) {
342
+ // eslint-disable-next-line no-unused-expressions
343
+ window.getSelection()?.removeAllRanges();
344
+ }
345
+
346
+ function getDefaultSize(split, bound, defaultSize, minSize = 50, maxSize, draggedSize) {
347
+ const min = minSize;
348
+ const max = getEffectiveMaxSize(split, bound, maxSize);
349
+ if (typeof draggedSize === 'number') {
350
+ return Math.max(min, Math.min(max, draggedSize));
351
+ }
352
+ if (defaultSize !== undefined) {
353
+ if (typeof defaultSize === 'number') {
354
+ return Math.max(min, Math.min(max, defaultSize));
355
+ }
356
+ return defaultSize;
357
+ }
358
+ return min;
359
+ }
360
+
361
+ function getEffectiveMaxSize(split, bound, maxSize) {
362
+ const boundSize = split === 'vertical' ? bound.width : bound.height;
363
+ let effectiveMaxSize = boundSize;
364
+ if (typeof maxSize === 'number') {
365
+ effectiveMaxSize = maxSize >= 0 ? maxSize : boundSize + maxSize;
366
+ }
367
+ return Math.min(effectiveMaxSize, boundSize);
368
+ }
@@ -0,0 +1,107 @@
1
+ .split {
2
+ position: absolute;
3
+ z-index: 0;
4
+ display: flex;
5
+ height: 100%;
6
+ outline: none;
7
+ user-select: text;
8
+
9
+ &.vertical {
10
+ right: 0;
11
+ left: 0;
12
+ flex-direction: row;
13
+ }
14
+
15
+ &.horizontal {
16
+ top: 0;
17
+ bottom: 0;
18
+ flex-direction: column;
19
+ width: 100%;
20
+ min-height: 100%;
21
+ }
22
+
23
+ &__pane {
24
+ position: relative;
25
+ outline: none;
26
+
27
+ &_secondary {
28
+ flex: 1;
29
+
30
+ &.vertical {
31
+ min-width: 0;
32
+ }
33
+
34
+ &.horizontal {
35
+ min-height: 0;
36
+ }
37
+ }
38
+
39
+ &_hide {
40
+ overflow: hidden;
41
+ }
42
+ }
43
+
44
+ &__resizer {
45
+ position: relative;
46
+ z-index: 10;
47
+ background: var(--yc-color-base-background);
48
+
49
+ &::after {
50
+ position: absolute;
51
+ top: 0;
52
+ right: 0;
53
+ bottom: 0;
54
+ left: 0;
55
+ background-color: var(--yc-color-base-generic-ultralight);
56
+ content: '';
57
+ }
58
+
59
+ &.active::after,
60
+ &:hover::after {
61
+ background-color: var(--yc-color-line-generic-hover);
62
+ transition: background-color 1s ease;
63
+ }
64
+
65
+ &.disabled {
66
+ display: none;
67
+ }
68
+
69
+ &.horizontal {
70
+ width: 100%;
71
+ height: 8px;
72
+ cursor: row-resize;
73
+
74
+ &::before {
75
+ position: absolute;
76
+ top: 50%;
77
+ left: 50%;
78
+ width: 16px;
79
+ height: 4px;
80
+ border-color: var(--yc-color-base-generic-hover);
81
+ border-style: solid;
82
+ border-width: 1px 0;
83
+ transform: translate(-50%, -50%);
84
+ content: '';
85
+ }
86
+ }
87
+
88
+ &.vertical {
89
+ width: 8px;
90
+ height: 100%;
91
+ cursor: col-resize;
92
+
93
+ &::before {
94
+ position: absolute;
95
+ top: 50%;
96
+ left: 50%;
97
+ width: 4px;
98
+ height: 16px;
99
+ border-color: var(--yc-color-base-generic-hover);
100
+ border-style: solid;
101
+ border-width: 0 1px;
102
+ transform: translate(-50%, -50%);
103
+ content: '';
104
+ }
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,3 @@
1
+ import SplitPane from './SplitPane';
2
+
3
+ export default SplitPane;
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import cn from 'bem-cn-lite';
4
+
5
+ import InternalLink from '../InternalLink/InternalLink';
6
+
7
+ import {getTabletLabel} from '../../utils/constants';
8
+ import routes, {createHref} from '../../routes';
9
+
10
+ import './Tablet.scss';
11
+
12
+ const b = cn('tablet');
13
+
14
+ class Tablet extends React.PureComponent {
15
+ static propTypes = {
16
+ className: PropTypes.string,
17
+ tablet: PropTypes.object,
18
+ onMouseEnter: PropTypes.func,
19
+ onMouseLeave: PropTypes.func,
20
+ };
21
+ static defaultProps = {
22
+ onMouseEnter: () => {},
23
+ onMouseLeave: () => {},
24
+ };
25
+ ref = React.createRef();
26
+ _onTabletMouseEnter = () => {
27
+ const {tablet} = this.props;
28
+ this.props.onMouseEnter(this.ref.current, tablet, 'tablet');
29
+ };
30
+ _onTabletClick = () => {
31
+ const {tablet = {}} = this.props;
32
+ const {TabletId: id} = tablet;
33
+
34
+ if (id) {
35
+ this.props.onMouseLeave();
36
+ }
37
+ };
38
+ render() {
39
+ const {tablet = {}} = this.props;
40
+ const {TabletId: id} = tablet;
41
+ const status = tablet.Overall?.toLowerCase();
42
+
43
+ return (
44
+ <InternalLink
45
+ onClick={this._onTabletClick}
46
+ to={id && createHref(routes.tablet, {id})}
47
+ className={b('wrapper')}
48
+ >
49
+ <div
50
+ ref={this.ref}
51
+ className={b({status})}
52
+ onMouseEnter={this._onTabletMouseEnter}
53
+ onMouseLeave={this.props.onMouseLeave}
54
+ >
55
+ <div className={b('type')}>{[getTabletLabel(tablet.Type)]}</div>
56
+ </div>
57
+ </InternalLink>
58
+ );
59
+ }
60
+ }
61
+ export default Tablet;
@@ -0,0 +1,49 @@
1
+ .tablet {
2
+ width: 18px;
3
+ height: 18px;
4
+ border-radius: 4px;
5
+ display: flex;
6
+ align-items: center;
7
+ justify-content: center;
8
+ color: var(--yc-color-text-complementary);
9
+ text-transform: uppercase;
10
+ font-size: 10px;
11
+ cursor: pointer;
12
+
13
+ border: 1px solid var(--yc-color-base-generic-medium-hover);
14
+
15
+ &__wrapper {
16
+ margin-right: 2px;
17
+ margin-bottom: 2px;
18
+ &:last-child {
19
+ margin-right: 0;
20
+ }
21
+ }
22
+
23
+ &__type {
24
+ line-height: 17px;
25
+ color: var(--yc-color-text-complementary);
26
+ }
27
+
28
+ &_status_gray {
29
+ background-color: var(--yc-color-text-complementary);
30
+ }
31
+ &_status_yellow {
32
+ background-color: var(--yc-color-base-warning-heavy);
33
+ }
34
+ &_status_orange {
35
+ background-color: var(--yc-color-text-warning-heavy);
36
+ }
37
+ &_status_red {
38
+ background-color: var(--yc-color-base-danger-heavy);
39
+ }
40
+ &_status_green {
41
+ background-color: var(--yc-color-base-positive-heavy);
42
+ }
43
+ &_state_blue {
44
+ background-color: var(--yc-color-base-info-heavy);
45
+ }
46
+ &_status_black {
47
+ background-color: var(--yc-color-text-secondary);
48
+ }
49
+ }
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import cn from 'bem-cn-lite';
3
+ import PropTypes from 'prop-types';
4
+ import {Link} from 'react-router-dom';
5
+
6
+ import {getTabletLabel} from '../../utils/constants';
7
+ import routes, {createHref} from '../../routes';
8
+
9
+ import './TabletsStatistic.scss';
10
+
11
+ const b = cn('tablets-statistic');
12
+
13
+ const prepareTablets = (tablets) => {
14
+ const res = tablets.map((tablet) => {
15
+ return {
16
+ label: getTabletLabel(tablet.Type),
17
+ type: tablet.Type,
18
+ count: tablet.Count,
19
+ state: tablet.State,
20
+ };
21
+ });
22
+
23
+ return res.sort((a, b) => a.label.localeCompare(b.label));
24
+ };
25
+
26
+ class TabletStatistic extends React.Component {
27
+ static propTypes = {
28
+ tablets: PropTypes.array,
29
+ path: PropTypes.string,
30
+ nodeIds: PropTypes.array,
31
+ };
32
+ renderTabletInfo = (item, index) => {
33
+ const {path, nodeIds} = this.props;
34
+
35
+ return (
36
+ <Link
37
+ to={createHref(routes.tabletsFilters, null, {
38
+ nodeIds,
39
+ state: item.state,
40
+ type: item.type,
41
+ path,
42
+ })}
43
+ key={index}
44
+ className={b('tablet', {state: item.state?.toLowerCase()})}
45
+ >
46
+ {item.label}: {item.count}
47
+ </Link>
48
+ );
49
+ };
50
+ render() {
51
+ const {tablets = []} = this.props;
52
+ const preparedTablets = prepareTablets(tablets);
53
+
54
+ return <div className={b()}>{preparedTablets.map(this.renderTabletInfo)}</div>;
55
+ }
56
+ }
57
+
58
+ export default TabletStatistic;
@@ -0,0 +1,41 @@
1
+ .tablets-statistic {
2
+ display: flex;
3
+ align-items: center;
4
+
5
+ &__tablet {
6
+ // min-width: 20px;
7
+ padding: 2px 4px;
8
+ height: 20px;
9
+ display: inline-block;
10
+ border-radius: 4px;
11
+ text-align: center;
12
+ line-height: 14px;
13
+ color: var(--yc-color-text-complementary);
14
+ text-transform: uppercase;
15
+ font-size: 10px;
16
+ margin-right: 4px;
17
+ text-decoration: none;
18
+ border: 1px solid var(--yc-color-base-generic-medium-hover);
19
+
20
+ &_state_green {
21
+ background-color: var(--yc-color-base-positive-heavy);
22
+ }
23
+ &_state_yellow {
24
+ background-color: var(--yc-color-base-warning-heavy);
25
+ }
26
+ &_state_blue {
27
+ background-color: var(--yc-color-base-info-heavy);
28
+ }
29
+ &_state_orange {
30
+ background: var(--yc-color-text-warning-heavy);
31
+ }
32
+ &_state_red {
33
+ background: var(--yc-color-base-danger-heavy);
34
+ color: var(--yc-color-text-light-primary);
35
+ }
36
+ &_state_gray {
37
+ background: var(--yc-color-text-complementary);
38
+ color: var(--yc-color-text-light-primary);
39
+ }
40
+ }
41
+ }