ydb-embedded-ui 6.1.0 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. package/dist/components/DateRange/DateRange.scss +7 -0
  2. package/dist/components/NodeHostWrapper/NodeHostWrapper.js +1 -1
  3. package/dist/components/NodeHostWrapper/NodeHostWrapper.scss +0 -6
  4. package/dist/components/QueryResultTable/QueryResultTable.d.ts +2 -2
  5. package/dist/components/QueryResultTable/QueryResultTable.js +2 -1
  6. package/dist/components/QueryResultTable/QueryResultTable.scss +1 -0
  7. package/dist/components/ResizeableDataTable/ResizeableDataTable.d.ts +7 -0
  8. package/dist/components/ResizeableDataTable/ResizeableDataTable.js +14 -0
  9. package/dist/components/ResizeableDataTable/ResizeableDataTable.scss +8 -0
  10. package/dist/components/VirtualTable/ResizeHandler.d.ts +8 -0
  11. package/dist/components/VirtualTable/ResizeHandler.js +62 -0
  12. package/dist/components/VirtualTable/ResizeableVirtualTable.d.ts +6 -0
  13. package/dist/components/VirtualTable/ResizeableVirtualTable.js +16 -0
  14. package/dist/components/VirtualTable/TableHead.d.ts +3 -3
  15. package/dist/components/VirtualTable/TableHead.js +16 -31
  16. package/dist/components/VirtualTable/VirtualTable.d.ts +2 -4
  17. package/dist/components/VirtualTable/VirtualTable.scss +24 -4
  18. package/dist/components/VirtualTable/types.d.ts +3 -0
  19. package/dist/components/VirtualTable/utils.d.ts +2 -0
  20. package/dist/components/VirtualTable/utils.js +21 -0
  21. package/dist/containers/ClusterModeGuard/ClusterModeGuard.js +1 -1
  22. package/dist/containers/Clusters/Clusters.js +3 -2
  23. package/dist/containers/Clusters/Clusters.scss +5 -0
  24. package/dist/containers/Clusters/columns.d.ts +1 -0
  25. package/dist/containers/Clusters/columns.js +4 -3
  26. package/dist/containers/Nodes/Nodes.js +4 -4
  27. package/dist/containers/Nodes/Nodes.scss +0 -5
  28. package/dist/containers/Nodes/VirtualNodes.js +4 -6
  29. package/dist/containers/Nodes/getNodesColumns.d.ts +1 -0
  30. package/dist/containers/Nodes/getNodesColumns.js +9 -1
  31. package/dist/containers/PDiskPage/PDiskGroups.js +3 -3
  32. package/dist/containers/Storage/Storage.scss +0 -4
  33. package/dist/containers/Storage/StorageGroups/StorageGroups.js +3 -3
  34. package/dist/containers/Storage/StorageGroups/VirtualStorageGroups.js +3 -3
  35. package/dist/containers/Storage/StorageGroups/getStorageGroupsColumns.d.ts +3 -0
  36. package/dist/containers/Storage/StorageGroups/getStorageGroupsColumns.js +7 -3
  37. package/dist/containers/Storage/StorageNodes/StorageNodes.js +3 -3
  38. package/dist/containers/Storage/StorageNodes/VirtualStorageNodes.js +3 -3
  39. package/dist/containers/Storage/StorageNodes/getStorageNodesColumns.d.ts +3 -0
  40. package/dist/containers/Storage/StorageNodes/getStorageNodesColumns.js +2 -0
  41. package/dist/containers/Tablet/Tablet.scss +0 -4
  42. package/dist/containers/Tablet/TabletTable/TabletTable.js +5 -3
  43. package/dist/containers/Tenant/Acl/Acl.js +3 -2
  44. package/dist/containers/Tenant/Acl/Acl.scss +0 -6
  45. package/dist/containers/Tenant/Diagnostics/Consumers/Consumers.js +3 -3
  46. package/dist/containers/Tenant/Diagnostics/Consumers/Consumers.scss +2 -0
  47. package/dist/containers/Tenant/Diagnostics/Consumers/columns/columns.d.ts +1 -0
  48. package/dist/containers/Tenant/Diagnostics/Consumers/columns/columns.js +2 -0
  49. package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.js +5 -4
  50. package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.scss +1 -5
  51. package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.js +8 -4
  52. package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.scss +2 -0
  53. package/dist/containers/Tenant/Diagnostics/Partitions/PartitionsControls/PartitionsControls.js +1 -1
  54. package/dist/containers/Tenant/Diagnostics/Partitions/columns/Columns.scss +0 -8
  55. package/dist/containers/Tenant/Diagnostics/Partitions/columns/columns.d.ts +1 -0
  56. package/dist/containers/Tenant/Diagnostics/Partitions/columns/columns.js +11 -4
  57. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopNodesByCpu.js +2 -2
  58. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopNodesByLoad.js +2 -2
  59. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopQueries.js +3 -2
  60. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopShards.js +2 -2
  61. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantMemory/TopNodesByMemory.js +2 -2
  62. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.scss +3 -7
  63. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverviewTableLayout.d.ts +2 -2
  64. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverviewTableLayout.js +2 -2
  65. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TopGroups.js +2 -2
  66. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TopTables.js +4 -2
  67. package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.js +8 -11
  68. package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.scss +2 -24
  69. package/dist/containers/Tenant/Diagnostics/TopQueries/getTopQueriesColumns.d.ts +1 -0
  70. package/dist/containers/Tenant/Diagnostics/TopQueries/getTopQueriesColumns.js +7 -0
  71. package/dist/containers/Tenant/Diagnostics/TopShards/Filters/Filters.d.ts +1 -2
  72. package/dist/containers/Tenant/Diagnostics/TopShards/Filters/Filters.js +3 -4
  73. package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.d.ts +0 -1
  74. package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.js +8 -10
  75. package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.scss +4 -15
  76. package/dist/containers/Tenant/Diagnostics/TopShards/getTopShardsColumns.d.ts +1 -0
  77. package/dist/containers/Tenant/Diagnostics/TopShards/getTopShardsColumns.js +5 -0
  78. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.js +1 -1
  79. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.scss +0 -6
  80. package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.scss +1 -21
  81. package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.js +4 -4
  82. package/dist/containers/Tenant/Query/ExplainResult/utils.d.ts +0 -3
  83. package/dist/containers/Tenant/Query/ExplainResult/utils.js +0 -34
  84. package/dist/containers/Tenant/Query/Preview/Preview.scss +6 -3
  85. package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.js +4 -2
  86. package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.scss +0 -1
  87. package/dist/containers/Tenant/Query/QueryEditor/helpers.js +2 -1
  88. package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.js +4 -1
  89. package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.scss +0 -1
  90. package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.d.ts +1 -2
  91. package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +4 -3
  92. package/dist/containers/Tenant/Schema/SchemaViewer/helpers.d.ts +1 -0
  93. package/dist/containers/Tenant/Schema/SchemaViewer/helpers.js +4 -2
  94. package/dist/containers/Tenants/Tenants.js +8 -3
  95. package/dist/containers/Tenants/Tenants.scss +13 -5
  96. package/dist/containers/Versions/GroupedNodesTree/GroupedNodesTree.scss +0 -2
  97. package/dist/containers/Versions/NodesTable/NodesTable.js +14 -9
  98. package/dist/styles/mixins.scss +0 -47
  99. package/dist/utils/constants.d.ts +25 -10
  100. package/dist/utils/hooks/useTableResize.d.ts +2 -7
  101. package/dist/utils/hooks/useTableResize.js +12 -24
  102. package/package.json +10 -10
  103. package/dist/containers/Tenant/Diagnostics/TopShards/Filters/Filters.scss +0 -8
@@ -2,37 +2,3 @@ export const renderExplainNode = (node) => {
2
2
  const parts = node.name.split('|');
3
3
  return parts.length > 1 ? parts[1] : node.name;
4
4
  };
5
- export function getColors() {
6
- const colorsMap = {
7
- success: '--g-color-text-positive',
8
- error: '--g-color-text-danger',
9
- warning: '--g-color-text-warning',
10
- errorBackground: '--g-color-base-danger-medium',
11
- warningBackground: '--g-color-base-warning-medium',
12
- mute: '--g-color-line-generic',
13
- stroke: '--g-color-text-hint',
14
- fill: '--g-color-base-generic-ultralight',
15
- nodeFill: '--g-color-base-float',
16
- nodeShadow: '--g-color-sfx-shadow',
17
- titleColor: '--g-color-text-primary',
18
- textColor: '--g-color-text-complementary',
19
- buttonBorderColor: '--g-color-line-generic',
20
- // groupBorderColor: '--g-color-celestial-thunder',
21
- // groupFill: '--g-color-celestial',
22
- titleHoverColor: '--g-color-text-link-hover',
23
- nodeHover: '--g-color-base-float-hover',
24
- specialHover: '--g-color-line-focus',
25
- };
26
- const style = getComputedStyle(document.body);
27
- const colors = Object.keys(colorsMap).reduce((acc, key) => {
28
- const color = style.getPropertyValue(colorsMap[key]).replace(/ /g, '');
29
- if (color) {
30
- acc[key] = color;
31
- }
32
- return acc;
33
- }, {});
34
- const getCommonColor = (name) => {
35
- return style.getPropertyValue(`--g-color-${name}`).replace(/ /g, '');
36
- };
37
- return Object.assign(Object.assign({}, colors), { getCommonColor });
38
- }
@@ -1,8 +1,9 @@
1
- @import '../../../../styles/mixins.scss';
1
+ @use '../../../../styles/mixins.scss';
2
2
 
3
3
  .kv-preview {
4
4
  height: 100%;
5
- @include query-data-table;
5
+ @include mixins.flex-container();
6
+ @include mixins.query-data-table();
6
7
 
7
8
  &__header {
8
9
  position: sticky;
@@ -48,9 +49,11 @@
48
49
  &__result {
49
50
  overflow: auto;
50
51
 
52
+ width: 100%;
53
+
51
54
  // This fixes last row display for ordinary preview (not fullscreen)
52
55
  height: calc(100% - 40px);
53
- padding: 0 10px;
56
+ padding-left: 10px;
54
57
 
55
58
  // Fix white space footer block for fullscreen preview
56
59
  .kv-fullscreen & {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import DataTable from '@gravity-ui/react-data-table';
2
+ import { ResizeableDataTable } from '../../../../components/ResizeableDataTable/ResizeableDataTable';
3
3
  import { TruncatedQuery } from '../../../../components/TruncatedQuery/TruncatedQuery';
4
4
  import { selectQueriesHistory } from '../../../../store/reducers/executeQuery';
5
5
  import { TENANT_QUERY_TABS_ID } from '../../../../store/reducers/tenant/constants';
@@ -11,6 +11,7 @@ import { MAX_QUERY_HEIGHT, QUERY_TABLE_SETTINGS } from '../../utils/constants';
11
11
  import i18n from '../i18n';
12
12
  import './QueriesHistory.scss';
13
13
  const b = cn('ydb-queries-history');
14
+ const QUERIES_HISTORY_COLUMNS_WIDTH_LS_KEY = 'queriesHistoryTableColumnsWidth';
14
15
  function QueriesHistory({ changeUserInput }) {
15
16
  const dispatch = useTypedDispatch();
16
17
  const [queryMode, setQueryMode] = useQueryModes();
@@ -35,6 +36,7 @@ function QueriesHistory({ changeUserInput }) {
35
36
  return (_jsx("div", { className: b('query'), children: _jsx(TruncatedQuery, { value: row.queryText, maxQueryHeight: MAX_QUERY_HEIGHT }) }));
36
37
  },
37
38
  sortable: false,
39
+ width: 600,
38
40
  },
39
41
  {
40
42
  name: 'syntax',
@@ -46,6 +48,6 @@ function QueriesHistory({ changeUserInput }) {
46
48
  width: 200,
47
49
  },
48
50
  ];
49
- return (_jsx("div", { className: b(), children: _jsx(DataTable, { theme: "yandex-cloud", columns: columns, data: reversedHistory, settings: QUERY_TABLE_SETTINGS, emptyDataMessage: i18n('history.empty'), onRowClick: (row) => onQueryClick(row), rowClassName: () => b('table-row') }) }));
51
+ return (_jsx("div", { className: b(), children: _jsx(ResizeableDataTable, { columnsWidthLSKey: QUERIES_HISTORY_COLUMNS_WIDTH_LS_KEY, columns: columns, data: reversedHistory, settings: QUERY_TABLE_SETTINGS, emptyDataMessage: i18n('history.empty'), onRowClick: (row) => onQueryClick(row), rowClassName: () => b('table-row') }) }));
50
52
  }
51
53
  export default QueriesHistory;
@@ -7,7 +7,6 @@
7
7
  padding: 0 16px;
8
8
 
9
9
  @include flex-container();
10
- @include table-styles;
11
10
 
12
11
  &__table-row {
13
12
  cursor: pointer;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import { AUTOCOMPLETE_ON_ENTER, ENABLE_AUTOCOMPLETE, useSetting } from '../../../../lib';
2
+ import { AUTOCOMPLETE_ON_ENTER, ENABLE_AUTOCOMPLETE } from '../../../../utils/constants';
3
+ import { useSetting } from '../../../../utils/hooks';
3
4
  export const EDITOR_OPTIONS = {
4
5
  automaticLayout: true,
5
6
  selectOnLineNumbers: true,
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import DataTable from '@gravity-ui/react-data-table';
4
4
  import { Button, Dialog } from '@gravity-ui/uikit';
5
5
  import { Icon } from '../../../../components/Icon';
6
+ import { ResizeableDataTable } from '../../../../components/ResizeableDataTable/ResizeableDataTable';
6
7
  import { TruncatedQuery } from '../../../../components/TruncatedQuery/TruncatedQuery';
7
8
  import { setQueryNameToEdit } from '../../../../store/reducers/saveQuery';
8
9
  import { TENANT_QUERY_TABS_ID } from '../../../../store/reducers/tenant/constants';
@@ -16,6 +17,7 @@ const b = cn('ydb-saved-queries');
16
17
  const DeleteDialog = ({ visible, queryName, onCancelClick, onConfirmClick }) => {
17
18
  return (_jsxs(Dialog, { open: visible, hasCloseButton: false, size: "s", onClose: onCancelClick, onEnterKeyDown: onConfirmClick, children: [_jsx(Dialog.Header, { caption: i18n('delete-dialog.header') }), _jsxs(Dialog.Body, { className: b('dialog-body'), children: [i18n('delete-dialog.question'), _jsx("span", { className: b('dialog-query-name'), children: ` ${queryName}?` })] }), _jsx(Dialog.Footer, { textButtonApply: i18n('delete-dialog.delete'), textButtonCancel: i18n('delete-dialog.cancel'), onClickButtonCancel: onCancelClick, onClickButtonApply: onConfirmClick })] }));
18
19
  };
20
+ const SAVED_QUERIES_COLUMNS_WIDTH_LS_KEY = 'savedQueriesTableColumnsWidth';
19
21
  export const SavedQueries = ({ savedQueries, changeUserInput, onDeleteQuery }) => {
20
22
  const dispatch = useTypedDispatch();
21
23
  const [isDeleteDialogVisible, setIsDeleteDialogVisible] = React.useState(false);
@@ -56,9 +58,10 @@ export const SavedQueries = ({ savedQueries, changeUserInput, onDeleteQuery }) =
56
58
  header: 'Query Text',
57
59
  render: ({ row: query }) => (_jsxs("div", { className: b('query'), children: [_jsx("div", { className: b('query-body'), children: _jsx(TruncatedQuery, { value: query.body, maxQueryHeight: MAX_QUERY_HEIGHT }) }), _jsxs("span", { className: b('controls'), children: [_jsx(Button, { view: "flat-secondary", children: _jsx(Icon, { name: "pencil", viewBox: "0 0 24 24" }) }), _jsx(Button, { view: "flat-secondary", onClick: onDeleteQueryClick(query.name), children: _jsx(Icon, { name: "trash", viewBox: "0 0 24 24" }) })] })] })),
58
60
  sortable: false,
61
+ resizeMinWidth: 650,
59
62
  },
60
63
  ];
61
- return (_jsxs(React.Fragment, { children: [_jsx("div", { className: b(), children: _jsx(DataTable, { theme: "yandex-cloud", columns: columns, data: savedQueries, settings: QUERY_TABLE_SETTINGS, emptyDataMessage: i18n('saved.empty'), rowClassName: () => b('row'), onRowClick: (row) => onQueryClick(row.body, row.name), initialSortOrder: {
64
+ return (_jsxs(React.Fragment, { children: [_jsx("div", { className: b(), children: _jsx(ResizeableDataTable, { columnsWidthLSKey: SAVED_QUERIES_COLUMNS_WIDTH_LS_KEY, columns: columns, data: savedQueries, settings: QUERY_TABLE_SETTINGS, emptyDataMessage: i18n('saved.empty'), rowClassName: () => b('row'), onRowClick: (row) => onQueryClick(row.body, row.name), initialSortOrder: {
62
65
  columnId: 'name',
63
66
  order: DataTable.ASCENDING,
64
67
  } }) }), _jsx(DeleteDialog, { visible: isDeleteDialogVisible, queryName: queryNameToDelete, onCancelClick: onCancelDeleteClick, onConfirmClick: onConfirmDeleteClick })] }));
@@ -9,7 +9,6 @@
9
9
  padding: 0 16px;
10
10
 
11
11
  @include flex-container();
12
- @include table-styles;
13
12
 
14
13
  &__row {
15
14
  cursor: pointer;
@@ -1,10 +1,9 @@
1
1
  import type { EPathType } from '../../../../types/api/schema';
2
2
  import './SchemaViewer.scss';
3
3
  interface SchemaViewerProps {
4
- className?: string;
5
4
  type?: EPathType;
6
5
  path?: string;
7
6
  withFamilies?: boolean;
8
7
  }
9
- export declare const SchemaViewer: ({ className, type, path, withFamilies }: SchemaViewerProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const SchemaViewer: ({ type, path, withFamilies }: SchemaViewerProps) => import("react/jsx-runtime").JSX.Element;
10
9
  export {};
@@ -1,18 +1,19 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import DataTable from '@gravity-ui/react-data-table';
3
+ import { ResizeableDataTable } from '../../../../components/ResizeableDataTable/ResizeableDataTable';
3
4
  import { TableSkeleton } from '../../../../components/TableSkeleton/TableSkeleton';
4
5
  import { cn } from '../../../../utils/cn';
5
6
  import { DEFAULT_TABLE_SETTINGS } from '../../../../utils/constants';
6
7
  import { useTypedSelector } from '../../../../utils/hooks';
7
- import { SchemaViewerColumns, prepareColumnDescriptions, prepareFamilies, prepareSchemaTableColumns, } from './helpers';
8
+ import { SCHEMA_COLUMNS_WIDTH_LS_KEY, SchemaViewerColumns, prepareColumnDescriptions, prepareFamilies, prepareSchemaTableColumns, } from './helpers';
8
9
  import './SchemaViewer.scss';
9
10
  const b = cn('schema-viewer');
10
- export const SchemaViewer = ({ className, type, path, withFamilies = false }) => {
11
+ export const SchemaViewer = ({ type, path, withFamilies = false }) => {
11
12
  const { data, loading } = useTypedSelector((state) => state.schema);
12
13
  const currentObjectData = path ? data[path] : undefined;
13
14
  const { columns, keyColumnIds } = prepareColumnDescriptions(type, currentObjectData);
14
15
  const families = prepareFamilies(currentObjectData);
15
- return (_jsx("div", { className: b(null, className), children: loading ? (_jsx(TableSkeleton, {})) : (_jsx(DataTable, { theme: "yandex-cloud", data: columns, columns: prepareSchemaTableColumns({
16
+ return (_jsx("div", { className: b(null), children: loading ? (_jsx(TableSkeleton, {})) : (_jsx(ResizeableDataTable, { columnsWidthLSKey: SCHEMA_COLUMNS_WIDTH_LS_KEY, data: columns, columns: prepareSchemaTableColumns({
16
17
  type,
17
18
  b,
18
19
  families,
@@ -16,6 +16,7 @@ export declare function prepareColumnDescriptions(type?: EPathType, scheme?: TEv
16
16
  keyColumnIds: number[];
17
17
  };
18
18
  export declare function prepareFamilies(scheme?: TEvDescribeSchemeResult): Record<number, TFamilyDescription>;
19
+ export declare const SCHEMA_COLUMNS_WIDTH_LS_KEY = "schemaTableColumnsWidth";
19
20
  export declare function prepareSchemaTableColumns(options: {
20
21
  type?: EPathType;
21
22
  b: ClassNameFormatter;
@@ -69,6 +69,7 @@ export function prepareFamilies(scheme) {
69
69
  return acc;
70
70
  }, {})) !== null && _e !== void 0 ? _e : {});
71
71
  }
72
+ export const SCHEMA_COLUMNS_WIDTH_LS_KEY = 'schemaTableColumnsWidth';
72
73
  export function prepareSchemaTableColumns(options) {
73
74
  const keyColumnsOrderValues = options.keyColumnIds.reduce((result, keyColumnId, index) => {
74
75
  // Put columns with negative values, so they will be the first with ascending sort
@@ -79,14 +80,15 @@ export function prepareSchemaTableColumns(options) {
79
80
  const columns = [
80
81
  {
81
82
  name: SchemaViewerColumns.id,
82
- width: 40,
83
+ width: 60,
83
84
  },
84
85
  ];
85
86
  if (!isExternalTable(options.type)) {
86
87
  // External tables don't have key columns
87
88
  columns.push({
88
89
  name: SchemaViewerColumns.key,
89
- width: 40,
90
+ width: 70,
91
+ resizeMinWidth: 70,
90
92
  // Table should start with key columns on sort click
91
93
  defaultOrder: DataTable.ASCENDING,
92
94
  // Values in keyColumnsOrderValues are always negative, so it will be 1 for not key columns
@@ -8,6 +8,7 @@ import { ResponseError } from '../../components/Errors/ResponseError';
8
8
  import { Illustration } from '../../components/Illustration';
9
9
  import { PoolsGraph } from '../../components/PoolsGraph/PoolsGraph';
10
10
  import { ProblemFilter } from '../../components/ProblemFilter';
11
+ import { ResizeableDataTable } from '../../components/ResizeableDataTable/ResizeableDataTable';
11
12
  import { Search } from '../../components/Search';
12
13
  import { TableWithControlsLayout } from '../../components/TableWithControlsLayout/TableWithControlsLayout';
13
14
  import { TabletsStatistic } from '../../components/TabletsStatistic';
@@ -22,6 +23,7 @@ import { useTypedDispatch, useTypedSelector } from '../../utils/hooks';
22
23
  import { getTenantPath } from '../Tenant/TenantPages';
23
24
  import './Tenants.scss';
24
25
  const b = cn('tenants');
26
+ const DATABASES_COLUMNS_WIDTH_LS_KEY = 'databasesTableColumnsWidth';
25
27
  export const Tenants = ({ additionalTenantsProps }) => {
26
28
  const dispatch = useTypedDispatch();
27
29
  const { currentData, isFetching, error } = tenantsApi.useGetTenantsInfoQuery({ clusterName }, { pollingInterval: DEFAULT_POLLING_INTERVAL });
@@ -75,6 +77,7 @@ export const Tenants = ({ additionalTenantsProps }) => {
75
77
  {
76
78
  name: 'Type',
77
79
  width: 200,
80
+ resizeMinWidth: 150,
78
81
  render: ({ row }) => {
79
82
  if (row.Type !== 'Serverless') {
80
83
  return row.Type;
@@ -138,6 +141,7 @@ export const Tenants = ({ additionalTenantsProps }) => {
138
141
  name: 'PoolStats',
139
142
  header: 'Pools',
140
143
  width: 100,
144
+ resizeMinWidth: 60,
141
145
  sortAccessor: ({ PoolStats = [] }) => PoolStats.reduce((acc, item) => acc + (item.Usage || 0), 0),
142
146
  defaultOrder: DataTable.DESCENDING,
143
147
  align: DataTable.LEFT,
@@ -147,7 +151,8 @@ export const Tenants = ({ additionalTenantsProps }) => {
147
151
  name: 'Tablets',
148
152
  header: 'Tablets States',
149
153
  sortable: false,
150
- width: 430,
154
+ width: 500,
155
+ resizeMinWidth: 500,
151
156
  render: ({ row }) => {
152
157
  const backend = getTenantBackend(row);
153
158
  return row.Tablets ? (_jsx(TabletsStatistic, { path: row.Name, tablets: row.Tablets, nodeIds: row.NodeIds || [], backend: backend })) : ('—');
@@ -157,10 +162,10 @@ export const Tenants = ({ additionalTenantsProps }) => {
157
162
  if (filteredTenants.length === 0 && problemFilter !== ProblemFilterValues.ALL) {
158
163
  return _jsx(Illustration, { name: "thumbsUp", width: "200" });
159
164
  }
160
- return (_jsx(DataTable, { theme: "yandex-cloud", data: filteredTenants, columns: columns, settings: DEFAULT_TABLE_SETTINGS, emptyDataMessage: "No such tenants" }));
165
+ return (_jsx(ResizeableDataTable, { columnsWidthLSKey: DATABASES_COLUMNS_WIDTH_LS_KEY, data: filteredTenants, columns: columns, settings: DEFAULT_TABLE_SETTINGS, emptyDataMessage: "No such tenants" }));
161
166
  };
162
167
  if (error) {
163
168
  return _jsx(ResponseError, { error: error });
164
169
  }
165
- return (_jsxs(TableWithControlsLayout, { children: [_jsx(TableWithControlsLayout.Controls, { children: renderControls() }), _jsx(TableWithControlsLayout.Table, { loading: loading, className: b('table'), children: renderTable() })] }));
170
+ return (_jsxs(TableWithControlsLayout, { children: [_jsx(TableWithControlsLayout.Controls, { children: renderControls() }), _jsx(TableWithControlsLayout.Table, { loading: loading, children: renderTable() })] }));
166
171
  };
@@ -25,20 +25,28 @@
25
25
  }
26
26
  }
27
27
 
28
- &__table {
29
- @include table-styles;
28
+ &__type {
29
+ display: flex;
30
+ flex-direction: row;
31
+ align-items: center;
32
+ gap: 10px;
30
33
  }
31
34
 
32
35
  &__type-value {
33
- margin-right: 10px;
36
+ overflow: hidden;
37
+
38
+ width: min-content;
39
+
40
+ white-space: nowrap;
41
+ text-overflow: ellipsis;
34
42
  }
35
43
 
36
44
  &__type-button {
37
- visibility: hidden;
45
+ display: none;
38
46
  }
39
47
 
40
48
  .data-table__row:hover &__type-button {
41
- visibility: visible;
49
+ display: block;
42
50
  }
43
51
 
44
52
  &__name-wrapper {
@@ -23,8 +23,6 @@
23
23
 
24
24
  @include freeze-nth-column(1);
25
25
  @include freeze-nth-column(2, 80px);
26
-
27
- @include table-styles;
28
26
  }
29
27
 
30
28
  .ydb-tree-view {
@@ -3,15 +3,18 @@ import DataTable from '@gravity-ui/react-data-table';
3
3
  import { EntityStatus } from '../../../components/EntityStatus/EntityStatus';
4
4
  import { PoolsGraph } from '../../../components/PoolsGraph/PoolsGraph';
5
5
  import { ProgressViewer } from '../../../components/ProgressViewer/ProgressViewer';
6
+ import { ResizeableDataTable } from '../../../components/ResizeableDataTable/ResizeableDataTable';
6
7
  import { DEFAULT_TABLE_SETTINGS } from '../../../utils/constants';
7
8
  import { formatBytes } from '../../../utils/dataFormatters/dataFormatters';
8
9
  import { isUnavailableNode } from '../../../utils/nodes';
9
10
  import { getDefaultNodePath } from '../../Node/NodePages';
11
+ const VERSIONS_COLUMNS_WIDTH_LS_KEY = 'versionsTableColumnsWidth';
10
12
  const columns = [
11
13
  {
12
14
  name: 'NodeId',
13
15
  header: '#',
14
- width: '80px',
16
+ width: 80,
17
+ resizeMinWidth: 80,
15
18
  align: DataTable.LEFT,
16
19
  render: ({ row }) => row.NodeId,
17
20
  },
@@ -25,7 +28,7 @@ const columns = [
25
28
  const nodePath = !isUnavailableNode(row) && row.NodeId ? getDefaultNodePath(row.NodeId) : undefined;
26
29
  return (_jsx(EntityStatus, { name: title, path: nodePath, hasClipboardButton: true, showStatus: false }));
27
30
  },
28
- width: '400px',
31
+ width: 400,
29
32
  align: DataTable.LEFT,
30
33
  },
31
34
  {
@@ -34,14 +37,14 @@ const columns = [
34
37
  render: ({ row }) => row.Endpoints
35
38
  ? row.Endpoints.map(({ Name, Address }) => `${Name} ${Address}`).join(', ')
36
39
  : '-',
37
- width: '300px',
40
+ width: 300,
38
41
  align: DataTable.LEFT,
39
42
  },
40
43
  {
41
44
  name: 'uptime',
42
45
  header: 'Uptime',
43
46
  sortAccessor: ({ StartTime }) => StartTime && -StartTime,
44
- width: '120px',
47
+ width: 120,
45
48
  align: DataTable.LEFT,
46
49
  render: ({ row }) => row.uptime,
47
50
  },
@@ -51,7 +54,7 @@ const columns = [
51
54
  sortAccessor: ({ MemoryUsed = 0 }) => Number(MemoryUsed),
52
55
  defaultOrder: DataTable.DESCENDING,
53
56
  render: ({ row }) => (row.MemoryUsed ? formatBytes(row.MemoryUsed) : '—'),
54
- width: '120px',
57
+ width: 120,
55
58
  align: DataTable.RIGHT,
56
59
  },
57
60
  {
@@ -60,7 +63,7 @@ const columns = [
60
63
  sortAccessor: ({ MemoryLimit = 0 }) => Number(MemoryLimit),
61
64
  defaultOrder: DataTable.DESCENDING,
62
65
  render: ({ row }) => (row.MemoryLimit ? formatBytes(row.MemoryLimit) : '—'),
63
- width: '120px',
66
+ width: 120,
64
67
  align: DataTable.RIGHT,
65
68
  },
66
69
  {
@@ -68,7 +71,8 @@ const columns = [
68
71
  header: 'Pools',
69
72
  sortAccessor: ({ PoolStats = [] }) => PoolStats.reduce((acc, item) => acc + (item.Usage || 0), 0),
70
73
  defaultOrder: DataTable.DESCENDING,
71
- width: '120px',
74
+ width: 80,
75
+ resizeMinWidth: 60,
72
76
  render: ({ row }) => (row.PoolStats ? _jsx(PoolsGraph, { pools: row.PoolStats }) : '—'),
73
77
  align: DataTable.LEFT,
74
78
  },
@@ -77,11 +81,12 @@ const columns = [
77
81
  header: 'Load average',
78
82
  sortAccessor: ({ LoadAverage = [] }) => LoadAverage.slice(0, 1).reduce((acc, item) => acc + item, 0),
79
83
  defaultOrder: DataTable.DESCENDING,
80
- width: '200px',
84
+ width: 140,
85
+ resizeMinWidth: 140,
81
86
  render: ({ row }) => row.LoadAverage && row.LoadAverage.length > 0 ? (_jsx(ProgressViewer, { value: row.LoadAverage[0], percents: true, capacity: 100, colorizeProgress: true })) : ('—'),
82
87
  align: DataTable.LEFT,
83
88
  },
84
89
  ];
85
90
  export const NodesTable = ({ nodes }) => {
86
- return (_jsx(DataTable, { theme: "yandex-cloud", data: nodes, columns: columns, settings: DEFAULT_TABLE_SETTINGS }));
91
+ return (_jsx(ResizeableDataTable, { columnsWidthLSKey: VERSIONS_COLUMNS_WIDTH_LS_KEY, data: nodes, columns: columns, settings: DEFAULT_TABLE_SETTINGS }));
87
92
  };
@@ -96,13 +96,6 @@
96
96
 
97
97
  @mixin query-data-table() {
98
98
  & .data-table {
99
- $_: &;
100
-
101
- &__table {
102
- border-spacing: 0;
103
- border-collapse: separate;
104
- }
105
-
106
99
  &__th,
107
100
  &__td {
108
101
  vertical-align: middle;
@@ -114,11 +107,6 @@
114
107
  }
115
108
  }
116
109
 
117
- &__row,
118
- &__sticky th {
119
- height: 40px;
120
- }
121
-
122
110
  &__th {
123
111
  box-shadow: inset 0 -1px 0 0 var(--g-tabs-color-divider);
124
112
  }
@@ -170,41 +158,6 @@
170
158
  }
171
159
  }
172
160
 
173
- @mixin table-styles {
174
- & .data-table {
175
- &__table {
176
- width: 100%;
177
- }
178
-
179
- &__row,
180
- &__sticky th {
181
- height: 40px;
182
- }
183
-
184
- &__box {
185
- .data-table__table-wrapper {
186
- padding-bottom: 20px;
187
- }
188
-
189
- &_sticky-head_fixed {
190
- overflow: initial;
191
- }
192
- }
193
- }
194
- }
195
-
196
- @mixin table-sticky-styles {
197
- & .data-table {
198
- &__th {
199
- height: auto;
200
- }
201
- }
202
-
203
- & {
204
- padding-bottom: 20px;
205
- }
206
- }
207
-
208
161
  @mixin json-tree-styles {
209
162
  // stylelint-disable
210
163
  font-family: var(--g-font-family-monospace) !important;
@@ -1,3 +1,5 @@
1
+ /// <reference types="react" />
2
+ import type { Settings } from '@gravity-ui/react-data-table';
1
3
  export declare const AUTO_RELOAD_INTERVAL: number;
2
4
  export declare const DEFAULT_POLLING_INTERVAL: number;
3
5
  export declare const KILOBYTE = 1000;
@@ -66,19 +68,32 @@ export declare const DEFAULT_IS_TENANT_SUMMARY_COLLAPSED = "default-is-tenant-su
66
68
  export declare const DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED = "default-is-tenant-common-info-collapsed";
67
69
  export declare const DEFAULT_IS_QUERY_RESULT_COLLAPSED = "default-is-query-result-collapsed";
68
70
  export declare const DEFAULT_CLUSTER_TAB_KEY = "default-cluster-tab";
69
- export declare const DEFAULT_TABLE_SETTINGS: {
70
- readonly displayIndices: false;
71
- readonly stickyHead: "moving";
72
- readonly syncHeadOnResize: true;
73
- readonly dynamicRender: true;
74
- readonly highlightRows: true;
75
- };
71
+ export declare const DEFAULT_TABLE_SETTINGS: Settings;
76
72
  export declare const TENANT_OVERVIEW_TABLES_SETTINGS: {
77
73
  readonly stickyHead: "fixed";
78
74
  readonly dynamicRender: false;
79
- readonly displayIndices: false;
80
- readonly syncHeadOnResize: true;
81
- readonly highlightRows: true;
75
+ readonly displayIndices?: boolean | undefined;
76
+ readonly stickyTop?: number | "auto" | undefined;
77
+ readonly syncHeadOnResize?: boolean | undefined;
78
+ readonly stickyFooter?: import("@gravity-ui/react-data-table").HeadPosition | undefined;
79
+ readonly stickyBottom?: number | "auto" | undefined;
80
+ readonly dynamicInnerRef?: import("react").Ref<ReactList> | undefined;
81
+ readonly dynamicRenderType?: "simple" | "uniform" | "variable" | undefined;
82
+ readonly dynamicItemSizeEstimator?: any;
83
+ readonly dynamicItemSizeGetter?: any;
84
+ readonly dynamicRenderMinSize?: number | undefined;
85
+ readonly dynamicRenderUseStaticSize?: boolean | undefined;
86
+ readonly dynamicRenderThreshold?: number | undefined;
87
+ readonly dynamicRenderScrollParentGetter?: any;
88
+ readonly dynamicRenderScrollParentViewportSizeGetter?: (() => number) | undefined;
89
+ readonly sortable?: boolean | undefined;
90
+ readonly externalSort?: boolean | undefined;
91
+ readonly disableSortReset?: boolean | undefined;
92
+ readonly defaultOrder?: import("@gravity-ui/react-data-table").OrderType | undefined;
93
+ readonly defaultResizeable?: boolean | undefined;
94
+ readonly highlightRows?: boolean | undefined;
95
+ readonly stripedRows?: boolean | undefined;
96
+ readonly headerMod?: "multiline" | "pre" | undefined;
82
97
  };
83
98
  export declare const QUERY_INITIAL_MODE_KEY = "query_initial_mode";
84
99
  export declare const LAST_USED_QUERY_ACTION_KEY = "last_used_query_action";
@@ -1,7 +1,2 @@
1
- import type { Column as DataTableColumn } from '@gravity-ui/react-data-table';
2
- import type { Column as VirtualTableColumn } from '../../components/VirtualTable';
3
- export type Column<T> = VirtualTableColumn<T> & DataTableColumn<T>;
4
- export type TableColumnsWidthSetup = Record<string, number>;
5
- export type HandleTableColumnsResize = (newSetup: TableColumnsWidthSetup) => void;
6
- export declare const updateColumnsWidth: <T>(columns: Column<T>[], columnsWidthSetup: TableColumnsWidthSetup) => Column<T>[];
7
- export declare const useTableResize: (localStorageKey: string) => [TableColumnsWidthSetup, HandleTableColumnsResize];
1
+ import type { ColumnWidthByName, HandleResize } from '@gravity-ui/react-data-table';
2
+ export declare const useTableResize: (localStorageKey?: string) => [ColumnWidthByName, HandleResize];
@@ -1,29 +1,17 @@
1
1
  import React from 'react';
2
- import { DEFAULT_RESIZEABLE } from '../../components/VirtualTable';
2
+ import { useTableResize as libUseTableResize } from '@gravity-ui/react-data-table';
3
3
  import { settingsManager } from '../../services/settings';
4
- export const updateColumnsWidth = (columns, columnsWidthSetup) => {
5
- return columns.map((column) => {
6
- var _a, _b;
7
- const resizeable = (_a = column.resizeable) !== null && _a !== void 0 ? _a : DEFAULT_RESIZEABLE;
8
- if (!resizeable) {
9
- return column;
10
- }
11
- return Object.assign(Object.assign({}, column), { width: (_b = columnsWidthSetup[column.name]) !== null && _b !== void 0 ? _b : column.width });
12
- });
13
- };
14
4
  export const useTableResize = (localStorageKey) => {
15
- const [tableColumnsWidthSetup, setTableColumnsWidth] = React.useState(() => {
16
- const setupFromLS = settingsManager.readUserSettingsValue(localStorageKey, {});
17
- return setupFromLS;
18
- });
19
- const handleSetupChange = React.useCallback((newSetup) => {
20
- setTableColumnsWidth((previousSetup) => {
21
- // ResizeObserver callback may be triggered only for currently resized column
22
- // or for the whole set of columns
23
- const setup = Object.assign(Object.assign({}, previousSetup), newSetup);
24
- settingsManager.setUserSettingsValue(localStorageKey, setup);
25
- return setup;
26
- });
5
+ const getSizes = React.useCallback(() => {
6
+ if (!localStorageKey) {
7
+ return {};
8
+ }
9
+ return settingsManager.readUserSettingsValue(localStorageKey, {});
10
+ }, [localStorageKey]);
11
+ const saveSizes = React.useCallback((value) => {
12
+ if (localStorageKey) {
13
+ settingsManager.setUserSettingsValue(localStorageKey, value);
14
+ }
27
15
  }, [localStorageKey]);
28
- return [tableColumnsWidthSetup, handleSetupChange];
16
+ return libUseTableResize({ saveSizes, getSizes });
29
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "6.1.0",
3
+ "version": "6.2.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -12,15 +12,15 @@
12
12
  "dependencies": {
13
13
  "@bem-react/classname": "^1.6.0",
14
14
  "@gravity-ui/axios-wrapper": "^1.4.1",
15
- "@gravity-ui/chartkit": "^5.3.0",
16
- "@gravity-ui/components": "^3.4.1",
17
- "@gravity-ui/date-utils": "^2.2.0",
18
- "@gravity-ui/i18n": "^1.4.0",
15
+ "@gravity-ui/chartkit": "^5.5.0",
16
+ "@gravity-ui/components": "^3.6.0",
17
+ "@gravity-ui/date-utils": "^2.4.0",
18
+ "@gravity-ui/i18n": "^1.5.0",
19
19
  "@gravity-ui/icons": "^2.9.1",
20
- "@gravity-ui/navigation": "^2.7.0",
21
- "@gravity-ui/paranoid": "^1.4.1",
22
- "@gravity-ui/react-data-table": "^2.0.1",
23
- "@gravity-ui/uikit": "^6.10.2",
20
+ "@gravity-ui/navigation": "^2.10.0",
21
+ "@gravity-ui/paranoid": "^2.0.1",
22
+ "@gravity-ui/react-data-table": "^2.1.1",
23
+ "@gravity-ui/uikit": "^6.15.0",
24
24
  "@gravity-ui/websql-autocomplete": "^8.1.0",
25
25
  "@reduxjs/toolkit": "^2.2.3",
26
26
  "axios": "^1.6.8",
@@ -122,7 +122,7 @@
122
122
  "devDependencies": {
123
123
  "@commitlint/cli": "^19.2.1",
124
124
  "@commitlint/config-conventional": "^19.1.0",
125
- "@gravity-ui/eslint-config": "^3.1.1",
125
+ "@gravity-ui/eslint-config": "^3.2.0",
126
126
  "@gravity-ui/prettier-config": "^1.1.0",
127
127
  "@gravity-ui/stylelint-config": "^4.0.1",
128
128
  "@gravity-ui/tsconfig": "^1.0.0",
@@ -1,8 +0,0 @@
1
- .top-shards {
2
- &__filters {
3
- display: flex;
4
- flex-wrap: wrap;
5
- align-items: baseline;
6
- gap: 16px;
7
- }
8
- }