Skip to content

Commit 2d95afe

Browse files
committed
fix: review fix
1 parent f147308 commit 2d95afe

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

src/components/PaginatedTable/TableChunk.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ export const TableChunk = typedMemo(function TableChunk<T, F>({
104104
}, [currentData, isActive, onDataFetched]);
105105

106106
const chunkOffset = id * limit;
107-
const remainingLenght = totalLength - chunkOffset;
108-
const calculatedChunkLength = remainingLenght < limit ? remainingLenght : limit;
107+
const remainingLength = totalLength - chunkOffset;
108+
const calculatedChunkLength = remainingLength < limit ? remainingLength : limit;
109109

110110
const dataLength = currentData?.data?.length || calculatedChunkLength;
111111

src/containers/Storage/PaginatedStorage.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,30 @@ export interface PaginatedStorageProps {
1212
viewContext: StorageViewContext;
1313

1414
parentContainer?: Element | null;
15+
16+
initialEntitiesCount?: number;
1517
}
1618

19+
const DEFAULT_ENTITIES_COUNT = 10;
20+
1721
export const PaginatedStorage = (props: PaginatedStorageProps) => {
1822
const {storageType} = useStorageQueryParams();
1923

2024
const isNodes = storageType === 'nodes';
2125

2226
if (isNodes) {
23-
return <PaginatedStorageNodes {...props} />;
27+
return (
28+
<PaginatedStorageNodes
29+
initialEntitiesCount={props.viewContext.nodeId ? 1 : DEFAULT_ENTITIES_COUNT}
30+
{...props}
31+
/>
32+
);
2433
}
2534

26-
return <PaginatedStorageGroups {...props} />;
35+
return (
36+
<PaginatedStorageGroups
37+
initialEntitiesCount={props.viewContext.groupId ? 1 : DEFAULT_ENTITIES_COUNT}
38+
{...props}
39+
/>
40+
);
2741
};

src/containers/Storage/PaginatedStorageGroups.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ function StorageGroupsComponent({
5656
pDiskId,
5757
viewContext,
5858
parentContainer,
59+
initialEntitiesCount,
5960
}: PaginatedStorageProps) {
6061
const {searchValue, visibleEntities, handleShowAllGroups} = useStorageQueryParams();
6162

@@ -91,6 +92,7 @@ function StorageGroupsComponent({
9192
renderControls={renderControls}
9293
renderErrorMessage={renderPaginatedTableErrorMessage}
9394
columns={columnsToShow}
95+
initialEntitiesCount={initialEntitiesCount}
9496
/>
9597
);
9698
}

src/containers/Storage/PaginatedStorageNodes.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function StorageNodesComponent({
6363
groupId,
6464
viewContext,
6565
parentContainer,
66+
initialEntitiesCount,
6667
}: PaginatedStorageProps) {
6768
const {searchValue, visibleEntities, nodesUptimeFilter, handleShowAllNodes} =
6869
useStorageQueryParams();
@@ -99,6 +100,7 @@ function StorageNodesComponent({
99100
renderControls={renderControls}
100101
renderErrorMessage={renderPaginatedTableErrorMessage}
101102
columns={columnsToShow}
103+
initialEntitiesCount={initialEntitiesCount}
102104
/>
103105
);
104106
}

0 commit comments

Comments
 (0)