ydb-embedded-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,45 @@
1
+ /* the tree node's style */
2
+
3
+ .tree-view {
4
+ overflow-y: hidden;
5
+ }
6
+
7
+ .tree-view_item {
8
+ display: flex;
9
+ align-items: center;
10
+
11
+ margin: 10px 0;
12
+
13
+ cursor: pointer;
14
+ white-space: nowrap;
15
+ }
16
+
17
+ .tree-view_children {
18
+ margin-left: 35px;
19
+
20
+ cursor: pointer;
21
+ white-space: nowrap;
22
+ }
23
+
24
+ .tree-view_children-collapsed {
25
+ height: 0px;
26
+ }
27
+
28
+ .tree-view_arrow {
29
+ display: inline-block;
30
+
31
+ margin-right: 6px;
32
+
33
+ cursor: pointer;
34
+ user-select: none;
35
+ }
36
+
37
+ .tree-view_arrow:after {
38
+ content: '▾';
39
+ }
40
+
41
+ /* rotate the triangle to close it */
42
+
43
+ .tree-view_arrow-collapsed {
44
+ transform: rotate(-90deg);
45
+ }
@@ -0,0 +1,12 @@
1
+ declare module '*.svg' {
2
+ const content: SVGIconData;
3
+ export default content;
4
+ }
5
+
6
+ declare module '*.png';
7
+ declare module '*.jpg';
8
+ declare module '*.jpeg';
9
+ declare module '*.ico';
10
+
11
+ declare type SVGIconData =
12
+ import('@yandex-cloud/uikit/build/esm/components/Icon/types').SVGIconData;
@@ -0,0 +1,4 @@
1
+ declare module 'react-list' {
2
+ const ReactList: any;
3
+ export default ReactList;
4
+ }
@@ -0,0 +1,33 @@
1
+ enum RumErrorLevel {
2
+ DEBUG = 'debug',
3
+ ERROR = 'error',
4
+ FATAL = 'fatal',
5
+ INFO = 'info',
6
+ WARN = 'warn',
7
+ }
8
+
9
+ interface RumLogData {
10
+ message?: string;
11
+ block?: string;
12
+ method?: string;
13
+ source?: string;
14
+ sourceMethod?: string;
15
+ type?: string;
16
+ page?: string;
17
+ service?: string;
18
+ level?: RumErrorLevel;
19
+ additional?: {
20
+ [key: string]: string;
21
+ };
22
+ }
23
+
24
+ interface RumCounter {
25
+ ERROR_LEVEL: typeof RumErrorLevel;
26
+ logError: (data: RumLogData, error?: Error) => void;
27
+ }
28
+
29
+ interface Window {
30
+ Ya?: {
31
+ Rum?: RumCounter;
32
+ };
33
+ }
@@ -0,0 +1,4 @@
1
+ export const toolTipConstants = {
2
+ UPDATE_REF: 'UPDATE_REF',
3
+ HIDE_TOOLTIP: 'HIDE_TOOLTIP',
4
+ };
@@ -0,0 +1,126 @@
1
+ const SECOND = 1000;
2
+
3
+ export const CLUSTER_AUTO_RELOAD_INTERVAL = 10 * SECOND;
4
+ export const TENANT_AUTO_RELOAD_INTERVAL = 10 * SECOND;
5
+ export const TENANTS_AUTO_RELOAD_INTERVAL = 10 * SECOND;
6
+ export const STORAGE_AUTO_RELOAD_INTERVAL = 10 * SECOND;
7
+ export const GROUP_AUTO_RELOAD_INTERVAL = 10 * SECOND;
8
+ export const NODE_AUTO_RELOAD_INTERVAL = 10 * SECOND;
9
+ export const PDISK_AUTO_RELOAD_INTERVAL = 10 * SECOND;
10
+ export const VDISK_AUTO_RELOAD_INTERVAL = 10 * SECOND;
11
+ export const AUTO_RELOAD_INTERVAL = 10 * SECOND;
12
+ export const HEALTHCHECK_RELOAD_INTERVAL = 10 * SECOND;
13
+ export const MEGABYTE = 1000000;
14
+ export const TERABYTE = 1000000000000;
15
+ export const GROUP = 'group';
16
+
17
+ export const DAY_IN_SECONDS = 24 * 60 * 60;
18
+
19
+ export const TABLET_STATES = {
20
+ TABLET_VOLATILE_STATE_UNKNOWN: 'unknown',
21
+ TABLET_VOLATILE_STATE_STOPPED: 'stopped',
22
+ TABLET_VOLATILE_STATE_BOOTING: 'booting',
23
+ TABLET_VOLATILE_STATE_STARTING: 'starting',
24
+ TABLET_VOLATILE_STATE_RUNNING: 'running',
25
+ TABLET_VOLATILE_STATE_BLOCKED: 'blocked',
26
+ };
27
+
28
+ export const TABLET_COLORS = {
29
+ Created: 'gray',
30
+ ResolveStateStorage: 'lightgray',
31
+ Candidate: 'lightgray',
32
+ BlockBlobStorage: 'lightgray',
33
+ RebuildGraph: 'yellow',
34
+ Restored: 'yellow',
35
+ Discover: 'orange',
36
+ Lock: 'lightblue',
37
+ Dead: 'black',
38
+ Active: 'lightgreen',
39
+ };
40
+
41
+ export const TABLET_COLOR_TO_STATES = {
42
+ Red: [
43
+ 'Created',
44
+ 'ResolveStateStorage',
45
+ 'Candidate',
46
+ 'BlockBlobStorage',
47
+ 'WriteZeroEntry',
48
+ 'Restored',
49
+ 'Discover',
50
+ 'Lock',
51
+ 'Dead',
52
+ ],
53
+ Orange: ['RebuildGraph'],
54
+ Yellow: ['ResolveMaster', 'ResolveLeader'],
55
+ Green: ['Deleted', 'Active'],
56
+ };
57
+
58
+ export const TABLETS_STATES = [
59
+ 'Active',
60
+ 'Deleted',
61
+ 'Created',
62
+ 'ResolveStateStorage',
63
+ 'Candidate',
64
+ 'BlockBlobStorage',
65
+ 'WriteZeroEntry',
66
+ 'Restored',
67
+ 'Discover',
68
+ 'Lock',
69
+ 'Dead',
70
+ 'RebuildGraph',
71
+ 'ResolveLeader',
72
+ ];
73
+
74
+ export const TxAllocator = 'TxAllocator';
75
+
76
+ export const TABLET_SYMBOLS = {
77
+ OldTxProxy: 'P',
78
+ TxProxy: 'P',
79
+ BSController: 'BS',
80
+ Dummy: 'DY',
81
+ RTMRPartition: 'RP',
82
+ PersQueueReadBalancer: 'PB',
83
+ Cms: 'CM',
84
+ BlockStorePartition: 'BP',
85
+ BlockStoreVolume: 'BV',
86
+ Console: 'CN',
87
+ TenantSlotBroker: 'TB',
88
+ };
89
+
90
+ export const getTabletLabel = (type) => {
91
+ if (!type) {
92
+ return;
93
+ }
94
+ const defaultValue = type.match(/[A-Z]/g).join('');
95
+
96
+ return TABLET_SYMBOLS[type] || defaultValue;
97
+ };
98
+
99
+ export const LOAD_AVERAGE_TIME_INTERVALS = ['1 min', '5 min', '15 min'];
100
+
101
+ export const PDISK_CATEGORIES = {
102
+ 0: 'HDD',
103
+ 1: 'SSD',
104
+ };
105
+
106
+ export const COLORS_PRIORITY = {
107
+ green: 5,
108
+ yellow: 4,
109
+ orange: 3,
110
+ red: 2,
111
+ black: 1,
112
+ gray: 1,
113
+ };
114
+
115
+ export const ALL = 'All';
116
+ export const PROBLEMS = 'Problems';
117
+
118
+ export const THEME_KEY = 'theme';
119
+ export const SAVED_QUERIES_KEY = 'saved_queries';
120
+ export const DATA_QA_TUNE_COLUMNS_POPUP = 'tune-columns-popup';
121
+ export const SELECTED_COLUMNS_KEY = 'selectedColumns';
122
+ export const defaultUserSettings = {
123
+ [THEME_KEY]: 'light',
124
+ };
125
+ export const DEFAULT_SIZE_RESULT_PANE_KEY = 'default-size-result-pane';
126
+ export const DEFAULT_SIZE_SHEMA_TREE_PANE_KEY = 'default-size-schema-tree-pane';
@@ -0,0 +1,156 @@
1
+ import _ from 'lodash';
2
+ import DataTable from '@yandex-cloud/react-data-table';
3
+ import {Link as ExternalLink, Tooltip} from '@yandex-cloud/uikit';
4
+
5
+ import Icon from '../components/Icon/Icon';
6
+ import EntityStatus from '../components/EntityStatus/EntityStatus';
7
+ import {STORAGE_ROLE} from '../containers/Node/Node';
8
+ import PoolsGraph from '../components/PoolsGraph/PoolsGraph';
9
+ import ProgressViewer from '../components/ProgressViewer/ProgressViewer';
10
+ import TabletsStatistic from '../components/TabletsStatistic/TabletsStatistic';
11
+
12
+ import routes, {createHref} from '../routes';
13
+ import {STORAGE, TABLETS} from '../containers/Node/NodePages';
14
+ import {formatBytes} from './index';
15
+
16
+ export function getNodesColumns({showTooltip, hideTooltip, tabletsPath, getNodeRef}) {
17
+ const columns = [
18
+ {
19
+ name: 'NodeId',
20
+ header: '#',
21
+ width: '80px',
22
+ align: DataTable.RIGHT,
23
+ },
24
+ {
25
+ name: 'NodeRef',
26
+ header: '',
27
+ sortable: false,
28
+ render: ({row}) => {
29
+ const nodeRef = getNodeRef ? getNodeRef(row) : undefined;
30
+ return (
31
+ nodeRef && (
32
+ <ExternalLink href={nodeRef}>
33
+ <Icon name="external" />
34
+ </ExternalLink>
35
+ )
36
+ );
37
+ },
38
+ width: '40px',
39
+ align: DataTable.LEFT,
40
+ },
41
+ {
42
+ name: 'Host',
43
+ render: ({row, value}) => {
44
+ const hasStorage = _.find(row?.Roles, (el) => el === STORAGE_ROLE);
45
+ if (typeof value === 'undefined') {
46
+ return <span>—</span>;
47
+ }
48
+ return (
49
+ <EntityStatus
50
+ name={row.Host}
51
+ status={row.Overall}
52
+ path={createHref(routes.node, {
53
+ id: row.NodeId,
54
+ activeTab: hasStorage ? STORAGE : TABLETS,
55
+ })}
56
+ hasClipboardButton
57
+ />
58
+ );
59
+ },
60
+ width: '350px',
61
+ align: DataTable.LEFT,
62
+ },
63
+ {
64
+ name: 'DataCenter',
65
+ header: 'DC',
66
+ align: DataTable.LEFT,
67
+ render: ({value}) => (value ? value : '—'),
68
+ width: '60px',
69
+ },
70
+ {
71
+ name: 'Version',
72
+ width: '200px',
73
+ align: DataTable.LEFT,
74
+ render: ({value}) => {
75
+ return <Tooltip content={value}>{value}</Tooltip>;
76
+ },
77
+ },
78
+ {
79
+ name: 'uptime',
80
+ header: 'Uptime',
81
+ sortAccessor: ({StartTime}) => -StartTime,
82
+ align: DataTable.LEFT,
83
+ width: '110px',
84
+ },
85
+ {
86
+ name: 'MemoryUsed',
87
+ header: 'Memory',
88
+ sortAccessor: ({MemoryUsed = 0}) => Number(MemoryUsed),
89
+ defaultOrder: DataTable.DESCENDING,
90
+ render: ({value, row}) => {
91
+ if (value) {
92
+ return formatBytes(value);
93
+ }
94
+ if (row.Metrics) {
95
+ return formatBytes(row.Metrics.Memory);
96
+ } else {
97
+ return '—';
98
+ }
99
+ },
100
+ align: DataTable.RIGHT,
101
+ width: '120px',
102
+ },
103
+ {
104
+ name: 'PoolStats',
105
+ header: 'CPU',
106
+ sortAccessor: ({PoolStats = []}) =>
107
+ PoolStats.reduce((acc, item) => acc + item.Usage, 0),
108
+ defaultOrder: DataTable.DESCENDING,
109
+ render: ({value}) =>
110
+ value ? (
111
+ <PoolsGraph
112
+ onMouseEnter={showTooltip}
113
+ onMouseLeave={hideTooltip}
114
+ pools={value}
115
+ />
116
+ ) : (
117
+ '—'
118
+ ),
119
+ align: DataTable.LEFT,
120
+ width: '120px',
121
+ },
122
+ {
123
+ name: 'LoadAverage',
124
+ header: 'Load average',
125
+ sortAccessor: ({LoadAverage = []}) =>
126
+ LoadAverage.slice(0, 1).reduce((acc, item) => acc + item, 0),
127
+ defaultOrder: DataTable.DESCENDING,
128
+ render: ({value}) =>
129
+ value && value.length > 0 ? (
130
+ <ProgressViewer value={value[0]} percents={true} colorizeProgress={true} />
131
+ ) : (
132
+ '—'
133
+ ),
134
+ align: DataTable.LEFT,
135
+ width: '140px',
136
+ },
137
+ {
138
+ name: 'Tablets',
139
+ width: '330px',
140
+ render: ({row}) => {
141
+ return row.Tablets ? (
142
+ <TabletsStatistic
143
+ path={tabletsPath ?? row.TenantName}
144
+ nodeIds={[row.NodeId]}
145
+ tablets={row.Tablets}
146
+ />
147
+ ) : (
148
+ '—'
149
+ );
150
+ },
151
+ align: DataTable.LEFT,
152
+ },
153
+ ];
154
+
155
+ return columns;
156
+ }
@@ -0,0 +1,7 @@
1
+ import {I18N} from '@yandex-cloud/i18n';
2
+
3
+ export type Lang = keyof typeof I18N.LANGS;
4
+
5
+ export const i18n = new I18N();
6
+
7
+ export {I18N} from '@yandex-cloud/i18n';
@@ -0,0 +1 @@
1
+ export * from './i18n';
@@ -0,0 +1,136 @@
1
+ import numeral from 'numeral';
2
+ import _ from 'lodash';
3
+
4
+ import {MEGABYTE, TERABYTE, DAY_IN_SECONDS} from './constants';
5
+
6
+ import locales from 'numeral/locales'; // eslint-disable-line no-unused-vars
7
+ numeral.locale('ru');
8
+ numeral.localeData().delimiters.decimal = '.';
9
+
10
+ export const formatBytes = (bytes) => {
11
+ return numeral(bytes).format('0 ib').replace('i', '');
12
+ };
13
+
14
+ export const stringifyVdiskId = (id) => {
15
+ return Object.values(id).join('-');
16
+ };
17
+ export const getPDiskId = (info) => {
18
+ return `${info.NodeId}-${info.PDiskId}`;
19
+ };
20
+
21
+ export const formatUptime = (seconds) => {
22
+ const days = Math.floor(seconds / DAY_IN_SECONDS);
23
+ const remain = seconds % DAY_IN_SECONDS;
24
+
25
+ const uptime = [days && `${days}d`, numeral(remain).format('00:00:00')]
26
+ .filter(Boolean)
27
+ .join(' ');
28
+
29
+ return uptime;
30
+ };
31
+
32
+ export const formatIOPS = (value, capacity) => {
33
+ return [Math.floor(value), Math.floor(capacity) + ' IOPS'];
34
+ };
35
+
36
+ export const formatStorageValues = (value, total) => {
37
+ return [Math.floor(value / TERABYTE), `${Math.floor(total / TERABYTE)} TB`];
38
+ };
39
+ export const formatStorageValuesToGb = (value, total) => {
40
+ return [Math.floor(value / 1000000000), `${Math.floor(total / 1000000000)} GB`];
41
+ };
42
+
43
+ export const formatThroughput = (value, total) => {
44
+ return [(value / MEGABYTE).toFixed(2), (total / MEGABYTE).toFixed(1) + ' MB/s'];
45
+ };
46
+
47
+ export const formatNumber = (number) => {
48
+ return numeral(number).format();
49
+ };
50
+
51
+ export const formatCPU = (value) => {
52
+ return numeral(value / 1000000).format('0.00');
53
+ };
54
+
55
+ export const calcUptime = (milliseconds) => {
56
+ const currentDate = new Date();
57
+ return formatUptime((currentDate - Number(milliseconds)) / 1000);
58
+ };
59
+
60
+ // функция определяет, сколько нод имеют статус Connected "true"
61
+ export const getConnectedNodesCount = (nodeStateInfo) => {
62
+ return nodeStateInfo?.reduce((acc, item) => (item.Connected ? acc + 1 : acc), 0);
63
+ };
64
+
65
+ export const renderExplainNode = (node) => {
66
+ const parts = node.name.split('|');
67
+ return parts.length > 1 ? parts[1] : node.name;
68
+ };
69
+
70
+ export const getExplainNodeId = (...values) => {
71
+ return values.join('|');
72
+ };
73
+
74
+ const getStringFromProps = (props) => {
75
+ return props
76
+ .map(([name, value]) => {
77
+ return value && `${name}: ${Array.isArray(value) ? value.join(', ') : value}`;
78
+ })
79
+ .filter(Boolean)
80
+ .join('\n');
81
+ };
82
+
83
+ export const getMetaForExplainNode = (node) => {
84
+ switch (node.type) {
85
+ case 'MultiLookup':
86
+ case 'Lookup': {
87
+ return getStringFromProps([
88
+ ['lookup by', node.lookup_by],
89
+ ['columns', node.columns],
90
+ ]);
91
+ }
92
+ case 'FullScan':
93
+ case 'Scan': {
94
+ return getStringFromProps([
95
+ ['scan by', node.scan_by],
96
+ ['limit', node.limit],
97
+ ['columns', node.columns],
98
+ ]);
99
+ }
100
+ case 'Upsert':
101
+ case 'MultiUpsert': {
102
+ return getStringFromProps([
103
+ ['key', node.key],
104
+ ['columns', node.columns],
105
+ ]);
106
+ }
107
+ case 'Erase':
108
+ case 'MultiErase': {
109
+ return getStringFromProps([
110
+ ['key', node.key],
111
+ ['columns', node.columns],
112
+ ]);
113
+ }
114
+ default:
115
+ return '';
116
+ }
117
+ };
118
+
119
+ export const prepareQueryResponse = (data) => {
120
+ return _.map(data, (item) => {
121
+ const formattedData = {};
122
+
123
+ for (const field in item) {
124
+ if (Object.prototype.hasOwnProperty.call(item, field)) {
125
+ const type = typeof item[field];
126
+ if (type === 'object' || type === 'boolean' || Array.isArray(item[field])) {
127
+ formattedData[field] = JSON.stringify(item[field]);
128
+ } else {
129
+ formattedData[field] = item[field];
130
+ }
131
+ }
132
+ }
133
+
134
+ return formattedData;
135
+ });
136
+ };
@@ -0,0 +1,69 @@
1
+ import * as monaco from 'monaco-editor';
2
+
3
+ export const LANGUAGE_S_EXPRESSION_ID = 's-expression';
4
+
5
+ function registerSExpressionLanguage() {
6
+ monaco.languages.register({id: LANGUAGE_S_EXPRESSION_ID});
7
+ monaco.languages.setMonarchTokensProvider(LANGUAGE_S_EXPRESSION_ID, {
8
+ defaultToken: 'text',
9
+ ignoreCase: true,
10
+ tokenPostfix: '.yql',
11
+
12
+ brackets: [
13
+ {open: '[', close: ']', token: 'delimiter.square'},
14
+ {open: '(', close: ')', token: 'delimiter.parenthesis'},
15
+ {open: '{', close: '}', token: 'delimiter.curly'},
16
+ ],
17
+
18
+ keywordControl: 'bind|block|declare|export|import|lambda|let|quote|return'.split('|'),
19
+
20
+ escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
21
+
22
+ tokenizer: {
23
+ root: [
24
+ {include: '@whitespace'},
25
+ {include: '@comment'},
26
+ [/(#)((?:\w|[\\+-=<>'"&#])+)/, ['delimiter', 'constant']],
27
+ [
28
+ /(?:\b(?:(defun|defmethod|defmacro))\b)(\s+)((?:\w|-|\?)*)/,
29
+ ['type.function', 'text', 'entity.name'],
30
+ ],
31
+ [/(\*)(\S*)(\*)/, ['delimiter', 'variable', 'delimiter']],
32
+ {include: '@strings'},
33
+ [/'[^#\s)(]+/, 'variable.parameter'],
34
+ [/[(){}[\]]/, '@brackets'],
35
+ // identifiers and keywords
36
+ [
37
+ /(?:(?:<=?|>=?|==|!=|[-+*/%])|[a-zA-Z][a-zA-Z0-9!]*)/,
38
+ {
39
+ cases: {
40
+ '@keywordControl': {token: 'keyword.operator'},
41
+ '@default': 'identifier',
42
+ },
43
+ },
44
+ ],
45
+ ],
46
+ whitespace: [[/\s+/, 'white']],
47
+ comment: [[/#.*/, 'comment']],
48
+ strings: [
49
+ [/'?"(?=.)/, {token: 'string', next: '@qqstring'}],
50
+ [/'?[@]{2}/, {token: 'string', next: '@multiline'}],
51
+ [/'?x"(?:[0-9A-Fa-f]{2})*"/, 'string'],
52
+ ],
53
+ qqstring: [
54
+ [/\\(?:[0-3][0-7][0-7]|x[0-9A-Fa-f]{2}|["tnrbfav\\])/, 'string.escape'],
55
+ [/[^"\\]+/, 'string'],
56
+ [/"|$/, {token: 'string', next: '@pop'}],
57
+ ],
58
+ multiline: [
59
+ [/[^@]+/, 'string'],
60
+ [/[@]{2}/, {token: 'string', next: '@pop'}],
61
+ [/./, {token: 'string'}],
62
+ ],
63
+ },
64
+ });
65
+ }
66
+
67
+ export function registerLanguages() {
68
+ registerSExpressionLanguage();
69
+ }