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,528 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import cn from 'bem-cn-lite';
4
+ import {connect} from 'react-redux';
5
+ import _ from 'lodash';
6
+
7
+ import {Link} from 'react-router-dom';
8
+ import {Loader} from '@yandex-cloud/uikit';
9
+
10
+ import InfoViewer from '../../components/InfoViewer/InfoViewer';
11
+ import EntityStatus from '../../components/EntityStatus/EntityStatus';
12
+ import ProgressViewer from '../../components/ProgressViewer/ProgressViewer';
13
+ import PoolsGraph from '../../components/PoolsGraph/PoolsGraph';
14
+ import {AutoFetcher} from '../Cluster/Cluster';
15
+
16
+ import {getVdiskInfo, clearStore as clearStoreVDisk} from '../../store/reducers/vdisk';
17
+ import {getPdiskInfo, clearStore as clearStorePDisk} from '../../store/reducers/pdisk';
18
+ import {hideTooltip, showTooltip} from '../../store/reducers/tooltip';
19
+ import {getNodeInfo} from '../../store/reducers/node';
20
+ import {calcUptime, stringifyVdiskId, formatStorageValuesToGb} from '../../utils';
21
+ import routes, {createHref} from '../../routes';
22
+ import {bytesToSpeed, bytesToGB} from '../../utils/utils';
23
+
24
+ import './VdiskPdiskNode.scss';
25
+
26
+ const b = cn('vdisk-pdisk-node');
27
+
28
+ function valueIsDefined(value) {
29
+ return value !== null && value !== undefined;
30
+ }
31
+
32
+ function Vdisk({
33
+ AllocatedSize,
34
+ DiskSpace,
35
+ FrontQueues,
36
+ Guid,
37
+ Replicated,
38
+ VDiskState,
39
+ VDiskId,
40
+ VDiskSlotId,
41
+ Kind,
42
+ SatisfactionRank,
43
+ AvailableSize,
44
+ HasUnreadableBlobs,
45
+ IncarnationGuid,
46
+ InstanceGuid,
47
+ StoragePoolName,
48
+ ReadThroughput,
49
+ WriteThroughput,
50
+ }) {
51
+ const vdiskInfo = [];
52
+
53
+ if (valueIsDefined(VDiskSlotId)) {
54
+ vdiskInfo.push({label: 'VDisk Slot Id', value: VDiskSlotId});
55
+ }
56
+ if (valueIsDefined(Guid)) {
57
+ vdiskInfo.push({label: 'GUID', value: Guid});
58
+ }
59
+ if (valueIsDefined(Kind)) {
60
+ vdiskInfo.push({label: 'Kind', value: Kind});
61
+ }
62
+ if (valueIsDefined(VDiskState)) {
63
+ vdiskInfo.push({
64
+ label: 'VDisk State',
65
+ value: VDiskState,
66
+ });
67
+ }
68
+ if (valueIsDefined(DiskSpace)) {
69
+ vdiskInfo.push({
70
+ label: 'Disk Space',
71
+ value: <EntityStatus status={DiskSpace} />,
72
+ });
73
+ }
74
+ if (valueIsDefined(SatisfactionRank?.FreshRank.Flag)) {
75
+ vdiskInfo.push({
76
+ label: 'Fresh Rank Satisfaction',
77
+ value: <EntityStatus status={SatisfactionRank.FreshRank.Flag} />,
78
+ });
79
+ }
80
+ if (valueIsDefined(SatisfactionRank?.LevelRank.Flag)) {
81
+ vdiskInfo.push({
82
+ label: 'Level Rank Satisfaction',
83
+ value: <EntityStatus status={SatisfactionRank.LevelRank.Flag} />,
84
+ });
85
+ }
86
+ vdiskInfo.push({label: 'Replicated', value: Replicated ? '✓' : '☓'});
87
+ vdiskInfo.push({label: 'Allocated Size', value: bytesToGB(AllocatedSize)});
88
+ vdiskInfo.push({label: 'Available Size', value: bytesToGB(AvailableSize)});
89
+ if (Number(AllocatedSize) >= 0 && Number(AvailableSize) >= 0) {
90
+ vdiskInfo.push({
91
+ label: 'Size',
92
+ value: (
93
+ <ProgressViewer
94
+ value={AllocatedSize}
95
+ capacity={Number(AllocatedSize) + Number(AvailableSize)}
96
+ formatValues={formatStorageValuesToGb}
97
+ colorizeProgress={true}
98
+ className={b('size')}
99
+ />
100
+ ),
101
+ });
102
+ }
103
+
104
+ vdiskInfo.push({
105
+ label: 'Has Unreadable Blobs',
106
+ value: HasUnreadableBlobs ? 'Yes' : 'No',
107
+ });
108
+ if (valueIsDefined(IncarnationGuid)) {
109
+ vdiskInfo.push({label: 'Incarnation GUID', value: IncarnationGuid});
110
+ }
111
+ if (valueIsDefined(InstanceGuid)) {
112
+ vdiskInfo.push({label: 'Instance GUID', value: InstanceGuid});
113
+ }
114
+ if (valueIsDefined(FrontQueues)) {
115
+ vdiskInfo.push({
116
+ label: 'Front Queues',
117
+ value: <EntityStatus status={FrontQueues} />,
118
+ });
119
+ }
120
+ if (valueIsDefined(StoragePoolName)) {
121
+ vdiskInfo.push({label: 'Storage Pool Name', value: StoragePoolName});
122
+ }
123
+ vdiskInfo.push({
124
+ label: 'Read Throughput',
125
+ value: bytesToSpeed(ReadThroughput),
126
+ });
127
+ vdiskInfo.push({
128
+ label: 'Write Throughput',
129
+ value: bytesToSpeed(WriteThroughput),
130
+ });
131
+
132
+ return (
133
+ <React.Fragment>
134
+ <div className={b('row')}>
135
+ <span className={b('title')}>VDisk </span>
136
+ <EntityStatus
137
+ status={VDiskState === 'OK' ? 'green' : 'red'}
138
+ name={stringifyVdiskId(VDiskId)}
139
+ />
140
+ </div>
141
+
142
+ <div className={b('column')}>
143
+ <InfoViewer className={b('section')} info={vdiskInfo} />
144
+ </div>
145
+ </React.Fragment>
146
+ );
147
+ }
148
+
149
+ class VdiskPdiskNode extends React.Component {
150
+ // если не завести три функции, то отрисуется только один лоадер, а мне надо чтобы отрисовывался в каждой колонке
151
+ renderLoader = () => {
152
+ return (
153
+ <div className={b('loader')}>
154
+ <Loader size="l" />
155
+ </div>
156
+ );
157
+ };
158
+
159
+ static propTypes = {
160
+ className: PropTypes.string,
161
+ loading: PropTypes.bool,
162
+ wasLoaded: PropTypes.bool,
163
+ error: PropTypes.bool,
164
+ getVdiskInfo: PropTypes.func,
165
+ clearStore: PropTypes.func,
166
+ vdisks: PropTypes.array,
167
+ location: PropTypes.object,
168
+ };
169
+
170
+ static defaultProps = {
171
+ className: '',
172
+ };
173
+
174
+ componentDidMount() {
175
+ const params = new URLSearchParams(this.props.location.search);
176
+ const nodeId = params.get('nodeId');
177
+ const pdiskId = params.get('pdiskId');
178
+ const vdiskId = params.get('vdiskId');
179
+
180
+ this.props.getVdiskInfo({vdiskId, pdiskId, nodeId});
181
+ this.vDiskAutofetcher = new AutoFetcher();
182
+ this.vDiskAutofetcher.fetch(() => this.props.getVdiskInfo({vdiskId, pdiskId, nodeId}));
183
+
184
+ if (nodeId && pdiskId) {
185
+ this.props.getPdiskInfo(nodeId, pdiskId);
186
+ this.pDiskAutofetcher = new AutoFetcher();
187
+ this.pDiskAutofetcher.fetch(() => this.props.getPdiskInfo(nodeId, pdiskId));
188
+ }
189
+ if (nodeId) {
190
+ this.props.getNodeInfo(nodeId);
191
+ this.nodeAutofetcher = new AutoFetcher();
192
+ this.nodeAutofetcher.fetch(() => this.props.getNodeInfo(nodeId));
193
+ }
194
+ }
195
+
196
+ componentWillUnmount() {
197
+ this.props.clearStoreVDisk();
198
+ this.props.clearStorePDisk();
199
+ this.vDiskAutofetcher.stop();
200
+ this.pDiskAutofetcher.stop();
201
+ this.nodeAutofetcher.stop();
202
+ }
203
+
204
+ renderVdisks = () => {
205
+ return _.map(this.props.vdisks, (v) => {
206
+ if (_.isEmpty(v)) {
207
+ return <div>No information about VDisk</div>;
208
+ }
209
+ return <Vdisk {...v} />;
210
+ });
211
+ };
212
+
213
+ renderPDisk = () => {
214
+ if (_.isEmpty(this.props.pdisk)) {
215
+ return <div>No information about PDisk</div>;
216
+ }
217
+ const {
218
+ TotalSize,
219
+ AvailableSize,
220
+ Device,
221
+ Guid,
222
+ NodeId,
223
+ PDiskId,
224
+ Path,
225
+ Realtime,
226
+ State,
227
+ Category,
228
+ SerialNumber,
229
+ } = this.props.pdisk;
230
+
231
+ const pdiskInfo = [
232
+ {
233
+ label: 'PDisk Id',
234
+ value: (
235
+ <Link
236
+ className={b('link')}
237
+ to={createHref(routes.pdisk, {id: PDiskId}, {node_id: NodeId})}
238
+ >
239
+ {PDiskId}
240
+ </Link>
241
+ ),
242
+ },
243
+ ];
244
+ if (valueIsDefined(Path)) {
245
+ pdiskInfo.push({label: 'Path', value: Path});
246
+ }
247
+ if (valueIsDefined(Guid)) {
248
+ pdiskInfo.push({label: 'GUID', value: Guid});
249
+ }
250
+ if (valueIsDefined(Category)) {
251
+ pdiskInfo.push({label: 'Category', value: Category});
252
+ }
253
+ pdiskInfo.push({
254
+ label: 'Allocated Size',
255
+ value: bytesToGB(TotalSize - AvailableSize),
256
+ });
257
+ pdiskInfo.push({
258
+ label: 'Available Size',
259
+ value: bytesToGB(AvailableSize),
260
+ });
261
+ if (Number(TotalSize) >= 0 && Number(AvailableSize) >= 0) {
262
+ pdiskInfo.push({
263
+ label: 'Size',
264
+ value: (
265
+ <ProgressViewer
266
+ value={TotalSize - AvailableSize}
267
+ capacity={TotalSize}
268
+ formatValues={formatStorageValuesToGb}
269
+ colorizeProgress={true}
270
+ className={b('size')}
271
+ />
272
+ ),
273
+ });
274
+ }
275
+ if (valueIsDefined(State)) {
276
+ pdiskInfo.push({label: 'State', value: State});
277
+ }
278
+ if (valueIsDefined(Device)) {
279
+ pdiskInfo.push({
280
+ label: 'Device',
281
+ value: <EntityStatus status={Device} />,
282
+ });
283
+ }
284
+ if (valueIsDefined(Realtime)) {
285
+ pdiskInfo.push({
286
+ label: 'Realtime',
287
+ value: <EntityStatus status={Realtime} />,
288
+ });
289
+ }
290
+ if (valueIsDefined(SerialNumber)) {
291
+ pdiskInfo.push({label: 'SerialNumber', value: SerialNumber});
292
+ }
293
+
294
+ return (
295
+ <React.Fragment>
296
+ <div className={b('row')}>
297
+ <span className={b('title')}>PDisk </span>
298
+ <EntityStatus status={Device} name={`${NodeId}-${PDiskId}`} />
299
+ </div>
300
+
301
+ <div className={b('column')}>
302
+ <InfoViewer className={b('section')} info={pdiskInfo} />
303
+ </div>
304
+ </React.Fragment>
305
+ );
306
+ };
307
+
308
+ renderNode = () => {
309
+ if (_.isEmpty(this.props.node)) {
310
+ return <div>No information about Node</div>;
311
+ }
312
+ const {
313
+ NodeId,
314
+ SystemState,
315
+ StartTime,
316
+ Host,
317
+ DataCenterDescription,
318
+ DataCenter,
319
+ Rack,
320
+ Version,
321
+ LoadAverage,
322
+ NumberOfCpus,
323
+ MemoryUsed,
324
+ MemoryLimit,
325
+ PoolStats,
326
+ } = this.props.node;
327
+
328
+ const nodeInfo = [
329
+ {
330
+ label: 'Node Id',
331
+ value: (
332
+ <Link
333
+ className={b('link')}
334
+ to={createHref(routes.node, {id: NodeId, activeTab: 'storage'})}
335
+ >
336
+ {NodeId}
337
+ </Link>
338
+ ),
339
+ },
340
+ ];
341
+
342
+ if (valueIsDefined(Host)) {
343
+ nodeInfo.push({label: 'Host', value: Host});
344
+ }
345
+ if (valueIsDefined(PoolStats)) {
346
+ nodeInfo.push({
347
+ label: 'Pool stats',
348
+ value: (
349
+ <PoolsGraph
350
+ onMouseEnter={this.props.showTooltip}
351
+ onMouseLeave={this.props.hideTooltip}
352
+ pools={PoolStats}
353
+ />
354
+ ),
355
+ });
356
+ }
357
+ if (!_.isEmpty(LoadAverage) && valueIsDefined(NumberOfCpus)) {
358
+ nodeInfo.push({
359
+ label: 'Load Average',
360
+ value: (
361
+ <ProgressViewer
362
+ value={
363
+ (LoadAverage[0] * 100) / NumberOfCpus < 100
364
+ ? (LoadAverage[0] * 100) / NumberOfCpus
365
+ : 100
366
+ }
367
+ capacity={100}
368
+ percents={true}
369
+ colorizeProgress={true}
370
+ className={b('size')}
371
+ />
372
+ ),
373
+ });
374
+ nodeInfo.push({
375
+ label: 'Load Average',
376
+ value: `${LoadAverage[0]} / ${NumberOfCpus} Cpus`,
377
+ });
378
+ }
379
+ if (valueIsDefined(StartTime)) {
380
+ nodeInfo.push({label: 'Uptime', value: calcUptime(StartTime)});
381
+ }
382
+ if (valueIsDefined(SystemState)) {
383
+ nodeInfo.push({
384
+ label: 'System State',
385
+ value: <EntityStatus status={SystemState} />,
386
+ });
387
+ }
388
+ if (valueIsDefined(DataCenter)) {
389
+ nodeInfo.push({label: 'DataCenter', value: DataCenter.toUpperCase()});
390
+ }
391
+ if (valueIsDefined(DataCenterDescription)) {
392
+ nodeInfo.push({
393
+ label: 'DataCenter Description',
394
+ value: DataCenterDescription,
395
+ });
396
+ }
397
+ if (valueIsDefined(Rack)) {
398
+ nodeInfo.push({label: 'Rack', value: Rack});
399
+ }
400
+ if (valueIsDefined(Version)) {
401
+ nodeInfo.push({label: 'Version', value: Version});
402
+ }
403
+ if (valueIsDefined(MemoryUsed)) {
404
+ nodeInfo.push({label: 'Memory used', value: bytesToGB(MemoryUsed)});
405
+ }
406
+ if (valueIsDefined(MemoryLimit)) {
407
+ nodeInfo.push({label: 'Memory limit', value: bytesToGB(MemoryLimit)});
408
+ }
409
+ if (valueIsDefined(MemoryLimit) && valueIsDefined(MemoryUsed)) {
410
+ nodeInfo.push({
411
+ label: 'Memory used',
412
+ value: (
413
+ <ProgressViewer
414
+ value={MemoryUsed || 0}
415
+ capacity={MemoryLimit || 0}
416
+ formatValues={formatStorageValuesToGb}
417
+ colorizeProgress={true}
418
+ className={b('size')}
419
+ />
420
+ ),
421
+ });
422
+ }
423
+
424
+ return (
425
+ <React.Fragment>
426
+ <div className={b('row')}>
427
+ <span className={b('title')}>Node </span>
428
+ <EntityStatus status={SystemState} name={`${NodeId}-${Host}`} />
429
+ </div>
430
+
431
+ <div className={b('column')}>
432
+ <InfoViewer className={b('section')} info={nodeInfo} />
433
+ </div>
434
+ </React.Fragment>
435
+ );
436
+ };
437
+
438
+ render() {
439
+ const {
440
+ loadingVDisk,
441
+ wasLoadedVDisk,
442
+ errorVDisk,
443
+ loadingPDisk,
444
+ wasLoadedPDisk,
445
+ errorPDisk,
446
+ loadingNode,
447
+ wasLoadedNode,
448
+ errorNode,
449
+ } = this.props;
450
+
451
+ return (
452
+ <div className={b()}>
453
+ <div>
454
+ {(loadingVDisk && !wasLoadedVDisk && this.renderLoader()) ||
455
+ (errorVDisk && errorVDisk.statusText) ||
456
+ this.renderVdisks()}
457
+ </div>
458
+ <div>
459
+ {(loadingPDisk && !wasLoadedPDisk && this.renderLoader()) ||
460
+ (errorPDisk && errorPDisk.statusText) ||
461
+ this.renderPDisk()}
462
+ </div>
463
+ <div>
464
+ {(loadingNode && !wasLoadedNode && this.renderLoader()) ||
465
+ (errorNode && errorNode.statusText) ||
466
+ this.renderNode()}
467
+ </div>
468
+ </div>
469
+ );
470
+ }
471
+ }
472
+
473
+ const mapStateToProps = (state) => {
474
+ const {
475
+ data: vdiskData,
476
+ wasLoaded: wasLoadedVDisk,
477
+ loading: loadingVDisk,
478
+ error: errorVDisk,
479
+ } = state.vdisk;
480
+ const {
481
+ data: pdiskData,
482
+ wasLoaded: wasLoadedPDisk,
483
+ loading: loadingPDisk,
484
+ error: errorPDisk,
485
+ } = state.pdisk;
486
+ const {
487
+ data: nodeData,
488
+ wasLoaded: wasLoadedNode,
489
+ loading: loadingNode,
490
+ error: errorNode,
491
+ } = state.node;
492
+
493
+ let pdisk = {};
494
+ let node = {};
495
+ if (pdiskData && pdiskData.PDiskStateInfo) {
496
+ pdisk = pdiskData.PDiskStateInfo[0];
497
+ }
498
+ if (nodeData && nodeData.SystemStateInfo) {
499
+ node = nodeData.SystemStateInfo[0];
500
+ }
501
+
502
+ return {
503
+ vdisks: vdiskData?.VDiskStateInfo,
504
+ wasLoadedVDisk,
505
+ loadingVDisk,
506
+ errorVDisk,
507
+ pdisk,
508
+ wasLoadedPDisk,
509
+ loadingPDisk,
510
+ errorPDisk,
511
+ node,
512
+ wasLoadedNode,
513
+ loadingNode,
514
+ errorNode,
515
+ };
516
+ };
517
+
518
+ const mapDispatchToProps = {
519
+ getVdiskInfo,
520
+ getPdiskInfo,
521
+ getNodeInfo,
522
+ clearStoreVDisk,
523
+ clearStorePDisk,
524
+ hideTooltip,
525
+ showTooltip,
526
+ };
527
+
528
+ export default connect(mapStateToProps, mapDispatchToProps)(VdiskPdiskNode);
@@ -0,0 +1,60 @@
1
+ @import '../../styles/mixins.scss';
2
+
3
+ .vdisk-pdisk-node {
4
+ display: grid;
5
+ grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
6
+ grid-gap: 20px;
7
+
8
+ padding: 20px;
9
+
10
+ .info-viewer__items {
11
+ grid-template-columns: max-content;
12
+ }
13
+
14
+ &__row {
15
+ display: flex;
16
+ }
17
+
18
+ &__column {
19
+ display: flex;
20
+ flex-direction: column;
21
+
22
+ margin-bottom: 15px;
23
+ }
24
+
25
+ &__title {
26
+ margin-right: 16px;
27
+
28
+ text-transform: uppercase;
29
+
30
+ font-size: var(--yc-text-body2-font-size);
31
+ font-weight: 500;
32
+ line-height: var(--yc-text-body2-line-height);
33
+ }
34
+
35
+ &__section {
36
+ padding: 15px 0;
37
+
38
+ .info-viewer__label {
39
+ min-width: 205px;
40
+ }
41
+ }
42
+
43
+ &__link {
44
+ text-decoration: none;
45
+
46
+ color: var(--yc-color-base-special);
47
+ }
48
+ &__loader {
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+
53
+ width: 100%;
54
+ margin-top: 50px;
55
+ }
56
+ .info-viewer__row {
57
+ align-items: flex-end;
58
+ }
59
+ @include container-fluid();
60
+ }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import {createBrowserHistory} from 'history';
3
+
4
+ const HistoryContext = React.createContext(createBrowserHistory());
5
+ HistoryContext.displayName = 'HistoryContext';
6
+ export default HistoryContext;
package/dist/index.css ADDED
@@ -0,0 +1,11 @@
1
+ body {
2
+ margin: 0;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
4
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
5
+ -webkit-font-smoothing: antialiased;
6
+ -moz-osx-font-smoothing: grayscale;
7
+ }
8
+
9
+ code {
10
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
11
+ }
package/dist/index.js ADDED
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import './index.css';
4
+ import App from './containers/App/App';
5
+ import {Provider} from 'react-redux';
6
+ import configureStore from './store';
7
+ import reportWebVitals from './reportWebVitals';
8
+ import '@yandex-cloud/uikit/styles/styles.scss';
9
+ import HistoryContext from './contexts/HistoryContext';
10
+
11
+ const {store, history} = configureStore();
12
+ window.store = store;
13
+
14
+ ReactDOM.render(
15
+ <React.StrictMode>
16
+ <Provider store={store}>
17
+ <HistoryContext.Provider value={history}>
18
+ <App />
19
+ </HistoryContext.Provider>
20
+ </Provider>
21
+ </React.StrictMode>,
22
+ document.getElementById('root'),
23
+ );
24
+
25
+ // If you want to start measuring performance in your app, pass a function
26
+ // to log results (for example: reportWebVitals(console.log))
27
+ // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
28
+ reportWebVitals();
@@ -0,0 +1,5 @@
1
+ describe('Fake tests', () => {
2
+ it('A fake test', () => {
3
+ expect(true).toBe(true);
4
+ });
5
+ });
@@ -0,0 +1 @@
1
+ /// <reference types="react-scripts" />
@@ -0,0 +1,13 @@
1
+ const reportWebVitals = (onPerfEntry) => {
2
+ if (onPerfEntry && onPerfEntry instanceof Function) {
3
+ import('web-vitals').then(({getCLS, getFID, getFCP, getLCP, getTTFB}) => {
4
+ getCLS(onPerfEntry);
5
+ getFID(onPerfEntry);
6
+ getFCP(onPerfEntry);
7
+ getLCP(onPerfEntry);
8
+ getTTFB(onPerfEntry);
9
+ });
10
+ }
11
+ };
12
+
13
+ export default reportWebVitals;
package/dist/routes.js ADDED
@@ -0,0 +1,40 @@
1
+ import qs from 'qs';
2
+ import {compile} from 'path-to-regexp';
3
+ import isEmpty from 'lodash/isEmpty';
4
+ import {backend, clusterName, webVersion} from './store';
5
+
6
+ const routes = {
7
+ viewer: '/viewer',
8
+ cluster: '/cluster/:activeTab?',
9
+ tenant: '/tenant/:page',
10
+ tenantInfo: '/tenantInfo',
11
+ node: '/node/:id/:activeTab?',
12
+ pdisk: '/pdisk/:id',
13
+ group: '/group/:id',
14
+ vdisk: '/vdisk',
15
+ network: '/network',
16
+ pool: '/pool/:poolName',
17
+ tablet: '/tablet/:id',
18
+ tabletsFilters: '/tabletsFilters',
19
+ clusterPage: '/clusters/:name',
20
+ };
21
+
22
+ export function createHref(route, params, query = {}) {
23
+ let extendedQuery = query;
24
+
25
+ const isBackendInQuery = Boolean(query.backend);
26
+ if (backend && !isBackendInQuery && webVersion) {
27
+ extendedQuery = {...query, backend};
28
+ }
29
+
30
+ const isClusterNameInQuery = Boolean(query.clusterName);
31
+ if (clusterName && !isClusterNameInQuery && webVersion) {
32
+ extendedQuery = {...extendedQuery, clusterName};
33
+ }
34
+
35
+ const search = isEmpty(extendedQuery) ? '' : `?${qs.stringify(extendedQuery, {encode: false})}`;
36
+
37
+ return `${compile(route)(params)}${search}`;
38
+ }
39
+
40
+ export default routes;