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,65 @@
1
+ @import '../../styles/mixins';
2
+
3
+ .cluster-info {
4
+ margin: 15px 0 0;
5
+ padding-bottom: 15px;
6
+
7
+ &__common {
8
+ display: flex;
9
+ align-items: center;
10
+ margin-bottom: 20px;
11
+ }
12
+
13
+ &__title {
14
+ font-size: var(--yc-text-body2-font-size);
15
+ line-height: var(--yc-text-body2-line-height);
16
+ font-weight: 500;
17
+ text-transform: uppercase;
18
+ margin-right: 16px;
19
+ }
20
+
21
+ &__url {
22
+ margin-right: 14px;
23
+ }
24
+
25
+ &__metric-field {
26
+ margin-top: -8px;
27
+ }
28
+
29
+ &__system-tablets {
30
+ margin-left: 15px;
31
+ display: flex;
32
+ align-items: center;
33
+ flex-wrap: wrap;
34
+
35
+ & .tablet {
36
+ margin-bottom: 2px;
37
+ }
38
+ }
39
+
40
+ &__metrics {
41
+ padding: 0 15px !important;
42
+ margin: 0 -15px;
43
+
44
+ .info-viewer__items {
45
+ grid-template-columns: repeat(2, minmax(auto, 250px));
46
+ }
47
+
48
+ .info-viewer__label {
49
+ width: 50px;
50
+ }
51
+ .info-viewer__value {
52
+ width: 130px;
53
+ }
54
+ }
55
+
56
+ &__tablets {
57
+ padding: 0 !important;
58
+ margin-left: 15px;
59
+ }
60
+ &__clipboard-button {
61
+ margin-left: 5px;
62
+ display: flex;
63
+ align-items: center;
64
+ }
65
+ }
@@ -0,0 +1,157 @@
1
+ import React, {ReactNode} from 'react';
2
+ import cn from 'bem-cn-lite';
3
+
4
+ import EntityStatus from '../EntityStatus/EntityStatus';
5
+ import ProgressViewer from '../ProgressViewer/ProgressViewer';
6
+ import InfoViewer from '../InfoViewer/InfoViewer';
7
+ import Tags from '../Tags/Tags';
8
+ import Tablet from '../Tablet/Tablet';
9
+
10
+ import {formatStorageValues} from '../../utils';
11
+ import {TxAllocator} from '../../utils/constants';
12
+
13
+ import './ClusterInfo.scss';
14
+
15
+ const b = cn('cluster-info');
16
+
17
+ export interface IClusterInfoItem {
18
+ label: string;
19
+ value: ReactNode;
20
+ }
21
+
22
+ interface ICluster {
23
+ StorageTotal: string;
24
+ StorageUsed: string;
25
+ NodesAlive: number;
26
+ NodesTotal: number;
27
+ LoadAverage: number;
28
+ NumberOfCpus: number;
29
+ Versions: string[];
30
+ Name?: string;
31
+ Overall: string;
32
+ DataCenters?: string[];
33
+ SystemTablets?: ITablet[];
34
+ }
35
+
36
+ interface ClusterInfoProps {
37
+ className: string;
38
+ cluster?: ICluster;
39
+ hideTooltip: VoidFunction;
40
+ showTooltip: VoidFunction;
41
+ clusterTitle: string;
42
+ additionalInfo?: IClusterInfoItem[];
43
+ }
44
+
45
+ interface ITablet {
46
+ Type: string;
47
+ }
48
+
49
+ class ClusterInfo extends React.Component<ClusterInfoProps> {
50
+ static compareTablets(tablet1: ITablet, tablet2: ITablet) {
51
+ if (tablet1.Type === TxAllocator) {
52
+ return 1;
53
+ }
54
+
55
+ if (tablet2.Type === TxAllocator) {
56
+ return -1;
57
+ }
58
+
59
+ return 0;
60
+ }
61
+
62
+ shouldComponentUpdate(nextProps: ClusterInfoProps) {
63
+ const {cluster = {}} = nextProps;
64
+ return !(Object.keys(cluster).length === 0);
65
+ }
66
+
67
+ render() {
68
+ return this.renderContent();
69
+ }
70
+
71
+ private getInfo() {
72
+ const {cluster = {} as ICluster, additionalInfo = []} = this.props;
73
+ const {StorageTotal, StorageUsed} = cluster;
74
+
75
+ const info: IClusterInfoItem[] = [
76
+ {
77
+ label: 'Nodes',
78
+ value: (
79
+ <ProgressViewer
80
+ className={b('metric-field')}
81
+ value={cluster.NodesAlive}
82
+ capacity={cluster.NodesTotal}
83
+ />
84
+ ),
85
+ },
86
+ {
87
+ label: 'Load',
88
+ value: (
89
+ <ProgressViewer
90
+ className={b('metric-field')}
91
+ value={cluster.LoadAverage}
92
+ capacity={cluster.NumberOfCpus}
93
+ />
94
+ ),
95
+ },
96
+ {
97
+ label: 'Storage',
98
+ value: (
99
+ <ProgressViewer
100
+ className={b('metric-field')}
101
+ value={StorageUsed}
102
+ capacity={StorageTotal}
103
+ formatValues={formatStorageValues}
104
+ />
105
+ ),
106
+ },
107
+ {
108
+ label: 'Versions',
109
+ value: <div>{cluster.Versions?.join(', ')}</div>,
110
+ },
111
+ ...additionalInfo,
112
+ ];
113
+
114
+ return info;
115
+ }
116
+
117
+ private renderContent = () => {
118
+ const {cluster = {} as ICluster, showTooltip, hideTooltip, clusterTitle} = this.props;
119
+ const {Name: clusterName = 'Unknown cluster'} = cluster;
120
+
121
+ const info = this.getInfo();
122
+
123
+ return (
124
+ <div className={b()}>
125
+ <div className={b('common')}>
126
+ <span className={b('title')}>cluster</span>
127
+ <div className={b('url')}>
128
+ <EntityStatus
129
+ size="m"
130
+ status={cluster.Overall}
131
+ name={clusterTitle ?? clusterName}
132
+ />
133
+ </div>
134
+
135
+ {cluster.DataCenters && <Tags tags={cluster.DataCenters} />}
136
+
137
+ <div className={b('system-tablets')}>
138
+ {cluster.SystemTablets &&
139
+ cluster.SystemTablets.sort(ClusterInfo.compareTablets).map(
140
+ (tablet, tabletIndex) => (
141
+ <Tablet
142
+ onMouseEnter={showTooltip}
143
+ onMouseLeave={hideTooltip}
144
+ key={tabletIndex}
145
+ tablet={tablet}
146
+ />
147
+ ),
148
+ )}
149
+ </div>
150
+ </div>
151
+ <InfoViewer dots={true} info={info} />
152
+ </div>
153
+ );
154
+ };
155
+ }
156
+
157
+ export default ClusterInfo;
@@ -0,0 +1,84 @@
1
+ import {useState, useEffect, useRef} from 'react';
2
+ import block from 'bem-cn-lite';
3
+ import {ArrowToggle, Button} from '@yandex-cloud/uikit';
4
+
5
+ import './Collapse.scss';
6
+
7
+ const b = block('yc-collapse');
8
+
9
+ function useEffectSkipFirst(fn, arr) {
10
+ const isFirst = useRef(true);
11
+
12
+ useEffect(() => {
13
+ if (isFirst.current) {
14
+ isFirst.current = false;
15
+ return;
16
+ }
17
+
18
+ return fn();
19
+ }, arr);
20
+ }
21
+
22
+ export const Collapse = ({
23
+ title,
24
+ children,
25
+ arrowView = 'icon',
26
+ emptyState = 'No data',
27
+ titleSize = 'l',
28
+ contentMarginTop = 12,
29
+ defaultIsExpand,
30
+ onChange,
31
+ }) => {
32
+ const [isExpand, setIsExpand] = useState(defaultIsExpand);
33
+
34
+ const arrowDirection = isExpand ? 'top' : 'bottom';
35
+
36
+ const arrowComponent =
37
+ arrowView === 'button' ? (
38
+ <Button view="flat" className={b('arrow-button')}>
39
+ <ArrowToggle className={b('arrow')} direction={arrowDirection} size={20} />
40
+ </Button>
41
+ ) : (
42
+ <ArrowToggle className={b('arrow')} direction={arrowDirection} size={20} />
43
+ );
44
+
45
+ useEffectSkipFirst(onChange, [isExpand]);
46
+
47
+ return (
48
+ <div className={b()}>
49
+ <div
50
+ className={b('panel', {
51
+ 'no-data': !children,
52
+ })}
53
+ onClick={() => {
54
+ setIsExpand(!isExpand);
55
+ }}
56
+ >
57
+ {typeof title === 'string' ? (
58
+ <h2
59
+ className={b('title', {
60
+ size: titleSize,
61
+ })}
62
+ >
63
+ {title}
64
+ </h2>
65
+ ) : (
66
+ title
67
+ )}
68
+
69
+ {children && <div className={b('arrow-wrapper')}>{arrowComponent}</div>}
70
+ </div>
71
+
72
+ {!children && <h4 className={b('empty-state-title')}>{emptyState}</h4>}
73
+
74
+ {children && (
75
+ <div
76
+ className={b('content', {visible: isExpand})}
77
+ style={{marginTop: contentMarginTop}}
78
+ >
79
+ {children}
80
+ </div>
81
+ )}
82
+ </div>
83
+ );
84
+ };
@@ -0,0 +1,70 @@
1
+ .yc-collapse {
2
+ &__panel {
3
+ display: inline-flex;
4
+ align-items: center;
5
+
6
+ cursor: pointer;
7
+
8
+ &_no-data {
9
+ cursor: default;
10
+ }
11
+ }
12
+
13
+ &__title {
14
+ margin: 0;
15
+ }
16
+
17
+ &__title_secondary {
18
+ color: var(--yc-color-text-secondary);
19
+ }
20
+
21
+ &__title_size {
22
+ &_s {
23
+ font-size: var(--yc-text-body-font-size);
24
+ line-height: var(--yc-text-body-line-height);
25
+ }
26
+
27
+ &_m {
28
+ font-size: var(--yc-text-body2-font-size);
29
+ line-height: var(--yc-text-body2-line-height);
30
+ }
31
+
32
+ &_l {
33
+ font-size: var(--yc-text-body3-font-size);
34
+ line-height: var(--yc-text-body3-line-height);
35
+ }
36
+ }
37
+
38
+ &__arrow-wrapper {
39
+ margin-left: 8px;
40
+ }
41
+
42
+ &__arrow-wrapper_secondary {
43
+ color: var(--yc-color-text-secondary);
44
+ .button2__text {
45
+ color: var(--yc-color-text-secondary);
46
+ }
47
+ }
48
+
49
+ &__content {
50
+ display: none;
51
+
52
+ &_visible {
53
+ display: block;
54
+ }
55
+ }
56
+
57
+ &__empty-state-title {
58
+ font-size: var(--yc-text-body-font-size);
59
+ font-weight: normal;
60
+ line-height: var(--yc-text-body-line-height);
61
+
62
+ opacity: 0.5;
63
+ }
64
+
65
+ &__arrow-button {
66
+ .button2__text {
67
+ margin: 0 4px;
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,53 @@
1
+ import {useState} from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import cn from 'bem-cn-lite';
4
+ import {Dialog} from '@yandex-cloud/uikit';
5
+ import Icon from '../Icon/Icon';
6
+
7
+ import './CriticalActionDialog.scss';
8
+
9
+ const b = cn('km-critical-dialog');
10
+
11
+ export default function CriticalActionDialog({visible, onClose, onConfirm, text}) {
12
+ const [progress, setProgress] = useState(false);
13
+
14
+ const onSubmit = (e) => {
15
+ e.preventDefault();
16
+ setProgress(true);
17
+
18
+ return onConfirm().then(() => {
19
+ setProgress(false);
20
+ onClose();
21
+ });
22
+ };
23
+
24
+ return (
25
+ <Dialog open={visible} hasCloseButton={false} className={b()} size="s" onClose={onClose}>
26
+ <form onSubmit={onSubmit}>
27
+ <Dialog.Body className={b('body')}>
28
+ <span className={b('warning-icon')}>
29
+ <Icon name="dialog-warning" width="24" height="22" viewBox="0 0 24 22" />
30
+ </span>
31
+ {text}
32
+ </Dialog.Body>
33
+
34
+ <Dialog.Footer
35
+ progress={progress}
36
+ preset="default"
37
+ textButtonApply="Confirm"
38
+ textButtonCancel="Cancel"
39
+ propsButtonApply={{type: 'submit'}}
40
+ onClickButtonCancel={onClose}
41
+ onClickButtonApply={() => {}}
42
+ />
43
+ </form>
44
+ </Dialog>
45
+ );
46
+ }
47
+
48
+ CriticalActionDialog.propTypes = {
49
+ visible: PropTypes.bool,
50
+ onClose: PropTypes.func,
51
+ onConfirm: PropTypes.func,
52
+ text: PropTypes.string,
53
+ };
@@ -0,0 +1,31 @@
1
+ .km-critical-dialog {
2
+ width: 252px !important;
3
+
4
+ &__warning-icon {
5
+ margin-right: 16px;
6
+ }
7
+
8
+ &__body {
9
+ display: flex;
10
+ align-items: center;
11
+ padding: 16px 16px 0 16px;
12
+ }
13
+
14
+ & .yc-dialog-footer {
15
+ padding: 20px 4px 4px 4px;
16
+ }
17
+
18
+ & .yc-dialog-footer__children {
19
+ display: none;
20
+ }
21
+
22
+ & .yc-dialog-footer__button {
23
+ margin: 0;
24
+ min-width: 120px;
25
+ box-sizing: border-box;
26
+ }
27
+
28
+ & .yc-dialog-footer__button_action_cancel {
29
+ margin-right: 4px;
30
+ }
31
+ }
@@ -0,0 +1,48 @@
1
+ import PropTypes from 'prop-types';
2
+ import cn from 'bem-cn-lite';
3
+ import Icon from '../Icon/Icon';
4
+
5
+ import './EmptyState.scss';
6
+
7
+ const block = cn('empty-state');
8
+
9
+ const sizes = {
10
+ s: 150,
11
+ m: 250,
12
+ l: 350,
13
+ };
14
+
15
+ export default function EmptyState({image, title, description, actions, size}) {
16
+ return (
17
+ <div className={block({size})}>
18
+ <div className={block('wrapper', {size})}>
19
+ {image ? (
20
+ image
21
+ ) : (
22
+ <Icon
23
+ viewBox="0 0 383 396"
24
+ name="emptyState"
25
+ width={sizes[size]}
26
+ height={sizes[size]}
27
+ />
28
+ )}
29
+
30
+ <div className={block('title', {size})}>{title}</div>
31
+ <div className={block('description')}>{description}</div>
32
+ <div className={block('actions')}>{actions}</div>
33
+ </div>
34
+ </div>
35
+ );
36
+ }
37
+
38
+ EmptyState.propTypes = {
39
+ title: PropTypes.string.isRequired,
40
+ image: PropTypes.node,
41
+ description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
42
+ actions: PropTypes.arrayOf(PropTypes.node),
43
+ size: PropTypes.string,
44
+ };
45
+
46
+ EmptyState.defaultProps = {
47
+ size: 'm',
48
+ };
@@ -0,0 +1,70 @@
1
+ .empty-state {
2
+ padding: 20px;
3
+
4
+ &_size_m {
5
+ height: 400px;
6
+ }
7
+
8
+ &__wrapper {
9
+ &_size_s {
10
+ width: 460px;
11
+ height: 120px;
12
+ }
13
+
14
+ &_size_m {
15
+ width: 800px;
16
+ height: 240px;
17
+ margin: 0 auto;
18
+ position: relative;
19
+ top: 20%;
20
+ }
21
+
22
+ display: grid;
23
+ grid-template-areas:
24
+ 'image title'
25
+ 'image description'
26
+ 'image description'
27
+ 'image actions';
28
+ }
29
+
30
+ &__image {
31
+ grid-area: image;
32
+ justify-self: end;
33
+ margin-right: 60px;
34
+ color: var(--yc-color-base-info-hover);
35
+
36
+ .yc-root_theme_dark & {
37
+ color: var(--yc-color-base-generic);
38
+ }
39
+ }
40
+
41
+ &__title {
42
+ grid-area: title;
43
+ align-self: center;
44
+ font-weight: 500;
45
+
46
+ &_size_s {
47
+ font-size: var(--yc-text-lead-font-size);
48
+ line-height: var(--yc-text-lead-line-height);
49
+ }
50
+
51
+ &_size_m {
52
+ font-size: var(--yc-text-title-font-size);
53
+ line-height: var(--yc-text-title-line-height);
54
+ }
55
+ }
56
+
57
+ &__description {
58
+ grid-area: description;
59
+ font-size: var(--yc-text-body2-font-size);
60
+ line-height: var(--yc-text-body2-line-height);
61
+ }
62
+
63
+ &__actions {
64
+ grid-area: actions;
65
+
66
+ & > * {
67
+ margin-right: 8px;
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,96 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import cn from 'bem-cn-lite';
4
+ import {Link} from 'react-router-dom';
5
+ import {ClipboardButton, Link as ExternalLink} from '@yandex-cloud/uikit';
6
+
7
+ import './EntityStatus.scss';
8
+
9
+ const b = cn('entity-status');
10
+
11
+ class EntityStatus extends React.Component {
12
+ static propTypes = {
13
+ status: PropTypes.string,
14
+ name: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
15
+ path: PropTypes.string,
16
+ size: PropTypes.string,
17
+ label: PropTypes.string,
18
+ iconPath: PropTypes.string,
19
+ hasClipboardButton: PropTypes.bool,
20
+ showStatus: PropTypes.bool,
21
+ externalLink: PropTypes.bool,
22
+ className: PropTypes.string,
23
+ };
24
+
25
+ static defaultProps = {
26
+ status: 'gray',
27
+ text: '',
28
+ size: 'm',
29
+ label: '',
30
+ showStatus: true,
31
+ externalLink: false,
32
+ };
33
+ renderIcon() {
34
+ const {status, size, showStatus} = this.props;
35
+
36
+ if (!showStatus) {
37
+ return null;
38
+ }
39
+
40
+ return <div className={b('status-icon', {state: status.toLowerCase(), size})} />;
41
+ }
42
+ renderStatusLink() {
43
+ const {iconPath} = this.props;
44
+
45
+ return (
46
+ <ExternalLink target="_blank" href={iconPath}>
47
+ {this.renderIcon()}
48
+ </ExternalLink>
49
+ );
50
+ }
51
+ renderLink() {
52
+ const {externalLink, name, path} = this.props;
53
+
54
+ if (externalLink) {
55
+ return <ExternalLink href={path}>{name}</ExternalLink>;
56
+ }
57
+
58
+ return path ? (
59
+ <Link title={name} to={path}>
60
+ {name}
61
+ </Link>
62
+ ) : (
63
+ name && (
64
+ <span className={b('name')} title={name}>
65
+ {name}
66
+ </span>
67
+ )
68
+ );
69
+ }
70
+ render() {
71
+ const {name, label, iconPath, hasClipboardButton, className} = this.props;
72
+
73
+ return (
74
+ <div className={b(null, className)}>
75
+ {iconPath ? this.renderStatusLink() : this.renderIcon()}
76
+ {label && (
77
+ <span title={label} className={b('label')}>
78
+ {label}
79
+ </span>
80
+ )}
81
+ {this.renderLink()}
82
+ {hasClipboardButton && (
83
+ <span
84
+ className={b('clipboard-button', {
85
+ visible: false,
86
+ })}
87
+ >
88
+ <ClipboardButton text={name} size={16} />
89
+ </span>
90
+ )}
91
+ </div>
92
+ );
93
+ }
94
+ }
95
+
96
+ export default EntityStatus;