Skip to content

Commit 9e25733

Browse files
fix(StorageNodes): uniform render type (#1376)
1 parent 570507e commit 9e25733

File tree

5 files changed

+23
-25
lines changed

5 files changed

+23
-25
lines changed

src/containers/Storage/PDisk/PDisk.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222

2323
&__vdisks-item {
24-
flex-basis: 5px;
24+
flex-basis: 3px;
2525
flex-shrink: 0;
2626

2727
.stack__layer {

src/containers/Storage/Storage.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ import type {
2626
VisibleEntities,
2727
} from '../../store/reducers/storage/types';
2828
import {valueIsDefined} from '../../utils';
29-
import {DEFAULT_TABLE_SETTINGS} from '../../utils/constants';
3029
import {useAutoRefreshInterval, useTableSort} from '../../utils/hooks';
3130
import {NodesUptimeFilterValues, nodesUptimeFilterValuesSchema} from '../../utils/nodes';
3231
import {useAdditionalNodeProps} from '../AppWithClusters/useClusterData';
3332

3433
import {StorageControls} from './StorageControls/StorageControls';
35-
import {StorageGroups} from './StorageGroups/StorageGroups';
34+
import {StorageGroupsTable} from './StorageGroups/StorageGroupsTable';
3635
import {useStorageGroupsSelectedColumns} from './StorageGroups/columns/hooks';
37-
import {StorageNodes} from './StorageNodes/StorageNodes';
36+
import {StorageNodesTable} from './StorageNodes/StorageNodesTable';
3837
import {useStorageNodesSelectedColumns} from './StorageNodes/columns/hooks';
3938
import {b} from './shared';
4039
import {defaultSortNode, getDefaultSortGroup} from './utils';
@@ -201,24 +200,22 @@ export const Storage = ({database, nodeId, groupId, pDiskId}: StorageProps) => {
201200
return (
202201
<React.Fragment>
203202
{isGroups ? (
204-
<StorageGroups
203+
<StorageGroupsTable
205204
key="groups"
206205
visibleEntities={visibleEntities}
207206
data={storageGroups}
208-
tableSettings={DEFAULT_TABLE_SETTINGS}
209207
onShowAll={() => handleGroupVisibilityChange(VISIBLE_ENTITIES.all)}
210208
sort={groupsSort}
211209
handleSort={handleGroupsSort}
212210
columns={storageGroupsColumnsToShow}
213211
/>
214212
) : null}
215213
{isNodes ? (
216-
<StorageNodes
214+
<StorageNodesTable
217215
key="nodes"
218216
visibleEntities={visibleEntities}
219217
nodesUptimeFilter={uptimeFilter}
220218
data={storageNodes}
221-
tableSettings={DEFAULT_TABLE_SETTINGS}
222219
onShowAll={handleShowAllNodes}
223220
sort={nodesSort}
224221
handleSort={handleNodesSort}

src/containers/Storage/StorageGroups/StorageGroups.tsx renamed to src/containers/Storage/StorageGroups/StorageGroupsTable.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
1-
import type {Settings, SortOrder} from '@gravity-ui/react-data-table';
1+
import type {SortOrder} from '@gravity-ui/react-data-table';
22

33
import {ResizeableDataTable} from '../../../components/ResizeableDataTable/ResizeableDataTable';
44
import {VISIBLE_ENTITIES} from '../../../store/reducers/storage/constants';
55
import type {PreparedStorageGroup, VisibleEntities} from '../../../store/reducers/storage/types';
6+
import {DEFAULT_TABLE_SETTINGS} from '../../../utils/constants';
67
import type {HandleSort} from '../../../utils/hooks/useTableSort';
78

89
import {StorageGroupsEmptyDataMessage} from './StorageGroupsEmptyDataMessage';
910
import {STORAGE_GROUPS_COLUMNS_WIDTH_LS_KEY} from './columns/constants';
1011
import type {StorageGroupsColumn} from './columns/types';
1112
import i18n from './i18n';
1213

13-
interface StorageGroupsProps {
14+
interface StorageGroupsTableProps {
1415
data: PreparedStorageGroup[];
1516
columns: StorageGroupsColumn[];
16-
tableSettings: Settings;
1717
visibleEntities: VisibleEntities;
1818
onShowAll?: VoidFunction;
1919
sort?: SortOrder;
2020
handleSort?: HandleSort;
2121
}
2222

23-
export function StorageGroups({
23+
export function StorageGroupsTable({
2424
data,
2525
columns,
26-
tableSettings,
2726
visibleEntities,
2827
onShowAll,
2928
sort,
3029
handleSort,
31-
}: StorageGroupsProps) {
30+
}: StorageGroupsTableProps) {
3231
if (!data.length && visibleEntities !== VISIBLE_ENTITIES.all) {
3332
return (
3433
<StorageGroupsEmptyDataMessage
@@ -44,7 +43,7 @@ export function StorageGroups({
4443
key={visibleEntities}
4544
data={data}
4645
columns={columns}
47-
settings={tableSettings}
46+
settings={DEFAULT_TABLE_SETTINGS}
4847
emptyDataMessage={i18n('empty.default')}
4948
sortOrder={sort}
5049
onSort={handleSort}

src/containers/Storage/StorageNodes/StorageNodes.tsx renamed to src/containers/Storage/StorageNodes/StorageNodesTable.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import type {Settings, SortOrder} from '@gravity-ui/react-data-table';
1+
import type {SortOrder} from '@gravity-ui/react-data-table';
22

33
import {ResizeableDataTable} from '../../../components/ResizeableDataTable/ResizeableDataTable';
44
import {VISIBLE_ENTITIES} from '../../../store/reducers/storage/constants';
55
import type {PreparedStorageNode, VisibleEntities} from '../../../store/reducers/storage/types';
6+
import {DEFAULT_TABLE_SETTINGS} from '../../../utils/constants';
67
import type {HandleSort} from '../../../utils/hooks/useTableSort';
78
import {NodesUptimeFilterValues} from '../../../utils/nodes';
89

@@ -12,27 +13,30 @@ import type {StorageNodesColumn} from './columns/types';
1213
import i18n from './i18n';
1314
import {getRowUnavailableClassName} from './shared';
1415

15-
interface StorageNodesProps {
16+
const tableSettings = {
17+
...DEFAULT_TABLE_SETTINGS,
18+
dynamicRenderMinSize: 51,
19+
} as const;
20+
21+
interface StorageNodesTableProps {
1622
data: PreparedStorageNode[];
1723
columns: StorageNodesColumn[];
18-
tableSettings: Settings;
1924
visibleEntities: VisibleEntities;
2025
nodesUptimeFilter: NodesUptimeFilterValues;
2126
sort?: SortOrder;
2227
onShowAll?: VoidFunction;
2328
handleSort?: HandleSort;
2429
}
2530

26-
export function StorageNodes({
31+
export function StorageNodesTable({
2732
data,
2833
columns,
29-
tableSettings,
3034
visibleEntities,
3135
nodesUptimeFilter,
3236
sort,
3337
onShowAll,
3438
handleSort,
35-
}: StorageNodesProps) {
39+
}: StorageNodesTableProps) {
3640
if (
3741
!data.length &&
3842
(visibleEntities !== VISIBLE_ENTITIES.all ||
@@ -53,10 +57,7 @@ export function StorageNodes({
5357
key={visibleEntities as string}
5458
data={data}
5559
columns={columns}
56-
settings={{
57-
...tableSettings,
58-
dynamicRenderType: 'variable',
59-
}}
60+
settings={tableSettings}
6061
emptyDataMessage={i18n('empty.default')}
6162
rowClassName={getRowUnavailableClassName}
6263
sortOrder={sort}

src/containers/Storage/StorageNodes/columns/StorageNodesColumns.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
align-items: flex-end;
1010

1111
width: max-content;
12+
height: 40px;
1213
}
1314
&__pdisks-item {
1415
flex-grow: 1;

0 commit comments

Comments
 (0)