ydb-embedded-ui 4.31.2 → 4.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/dist/components/CellWithPopover/CellWithPopover.scss +7 -0
  2. package/dist/components/Loader/Loader.tsx +3 -2
  3. package/dist/components/MetricChart/MetricChart.tsx +45 -4
  4. package/dist/components/MetricChart/index.ts +1 -1
  5. package/dist/components/MetricChart/types.ts +3 -0
  6. package/dist/components/VirtualTable/TableHead.tsx +127 -26
  7. package/dist/components/VirtualTable/TableRow.tsx +15 -2
  8. package/dist/components/VirtualTable/VirtualTable.scss +62 -60
  9. package/dist/components/VirtualTable/VirtualTable.tsx +11 -1
  10. package/dist/components/VirtualTable/types.ts +1 -0
  11. package/dist/components/VirtualTable/useIntersectionObserver.ts +1 -0
  12. package/dist/containers/Node/Node.tsx +9 -7
  13. package/dist/containers/Nodes/NodesWrapper.tsx +1 -0
  14. package/dist/containers/Nodes/VirtualNodes.tsx +11 -5
  15. package/dist/containers/Nodes/getNodesColumns.tsx +1 -0
  16. package/dist/containers/Tenant/Diagnostics/Diagnostics.scss +2 -1
  17. package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +11 -6
  18. package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/prepareTableInfo.ts +2 -2
  19. package/dist/containers/Tenant/Diagnostics/TenantOverview/DefaultOverviewContent/DefaultOverviewContent.tsx +6 -0
  20. package/dist/containers/Tenant/Diagnostics/TenantOverview/{DefaultDashboard.tsx → DefaultOverviewContent/defaultDashboardConfig.ts} +3 -7
  21. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TenantCpu.tsx +3 -2
  22. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/{CpuDashboard.tsx → cpuDashboardConfig.ts} +2 -6
  23. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantDashboard/TenantDashboard.tsx +27 -9
  24. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantMemory/TenantMemory.tsx +3 -2
  25. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantMemory/{MemoryDashboard.tsx → memoryDashboardConfig.ts} +2 -6
  26. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx +3 -5
  27. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverviewTableLayout.tsx +1 -3
  28. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorage.tsx +6 -6
  29. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/{StorageDashboard.tsx → storageDashboardConfig.ts} +2 -6
  30. package/dist/containers/Tenant/Diagnostics/TenantOverview/utils.ts +3 -0
  31. package/dist/containers/UserSettings/i18n/en.json +2 -5
  32. package/dist/containers/UserSettings/i18n/ru.json +2 -5
  33. package/dist/containers/UserSettings/settings.ts +1 -12
  34. package/dist/services/settings.ts +0 -2
  35. package/dist/utils/constants.ts +0 -2
  36. package/dist/utils/hooks/useTableResize.ts +53 -0
  37. package/package.json +2 -1
@@ -0,0 +1,53 @@
1
+ import {useCallback, useState} from 'react';
2
+ import type {Column as DataTableColumn} from '@gravity-ui/react-data-table';
3
+ import type {Column as VirtualTableColumn} from '../../components/VirtualTable';
4
+ import {settingsManager} from '../../services/settings';
5
+
6
+ export type Column<T> = VirtualTableColumn<T> & DataTableColumn<T>;
7
+
8
+ export type TableColumnsWidthSetup = Record<string, number>;
9
+
10
+ export type HandleTableColumnsResize = (newSetup: TableColumnsWidthSetup) => void;
11
+
12
+ export const updateColumnsWidth = <T>(
13
+ columns: Column<T>[],
14
+ columnsWidthSetup: TableColumnsWidthSetup,
15
+ ) => {
16
+ return columns.map((column) => {
17
+ if (!column.resizeable) {
18
+ return column;
19
+ }
20
+ return {...column, width: columnsWidthSetup[column.name] ?? column.width};
21
+ });
22
+ };
23
+
24
+ export const useTableResize = (
25
+ localStorageKey: string,
26
+ ): [TableColumnsWidthSetup, HandleTableColumnsResize] => {
27
+ const [tableColumnsWidthSetup, setTableColumnsWidth] = useState<TableColumnsWidthSetup>(() => {
28
+ const setupFromLS = settingsManager.readUserSettingsValue(
29
+ localStorageKey,
30
+ {},
31
+ ) as TableColumnsWidthSetup;
32
+
33
+ return setupFromLS;
34
+ });
35
+
36
+ const handleSetupChange: HandleTableColumnsResize = useCallback(
37
+ (newSetup) => {
38
+ setTableColumnsWidth((previousSetup) => {
39
+ // ResizeObserver callback may be triggered only for currently resized column
40
+ // or for the whole set of columns
41
+ const setup = {
42
+ ...previousSetup,
43
+ ...newSetup,
44
+ };
45
+ settingsManager.setUserSettingsValue(localStorageKey, setup);
46
+ return setup;
47
+ });
48
+ },
49
+ [localStorageKey],
50
+ );
51
+
52
+ return [tableColumnsWidthSetup, handleSetupChange];
53
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "4.31.2",
3
+ "version": "4.33.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -56,6 +56,7 @@
56
56
  "build": "rm -rf build && DISABLE_ESLINT_PLUGIN=true react-app-rewired build",
57
57
  "//build:embedded": "echo 'PUBLIC_URL is a setting for create-react-app. Embedded version is built and hosted as is on ydb servers, with no way of knowing the final URL pattern. PUBLIC_URL=. keeps paths to all static relative, allowing servers to handle them as needed'",
58
58
  "build:embedded": "GENERATE_SOURCEMAP=false PUBLIC_URL=. REACT_APP_BACKEND=http://localhost:8765 npm run build",
59
+ "build:embedded:archive": "npm run build:embedded && mv build embedded-ui && zip -r embedded-ui.zip embedded-ui && rm -rf embedded-ui",
59
60
  "lint:styles": "stylelint 'src/**/*.scss'",
60
61
  "unimported": "npx unimported --no-cache",
61
62
  "package": "rm -rf dist && copyfiles -u 1 'src/**/*' dist",