Skip to content

Commit 0c7d78c

Browse files
committed
fix: better types
1 parent 6e1cd32 commit 0c7d78c

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/components/PaginatedTable/types.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type {PreparedStorageNode} from '../../store/reducers/storage/types';
12
import type {IResponseError} from '../../types/api/error';
23

34
import type {ASCENDING, CENTER, DESCENDING, LEFT, RIGHT} from './constants';
@@ -36,19 +37,19 @@ export interface Column<T> {
3637
align: AlignType;
3738
}
3839

39-
interface StorageNodesTableDataExtension {
40-
columnSettings?: {
41-
maxSlotsPerDisk: number;
42-
maxDisksPerNode: number;
43-
};
44-
}
45-
46-
export interface PaginatedTableData<T> extends StorageNodesTableDataExtension {
40+
export interface PaginatedTableData<T> {
4741
data: T[];
4842
total: number;
4943
found: number;
5044
}
5145

46+
export type StorageNodesPaginatedTableData = PaginatedTableData<PreparedStorageNode> & {
47+
columnSettings?: {
48+
maxSlotsPerDisk: number;
49+
maxDisksPerNode: number;
50+
};
51+
};
52+
5253
type FetchDataParams<F, E = {}> = {
5354
limit: number;
5455
offset: number;

src/containers/Storage/utils/useTableCSSVariables.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22

3-
import type {PaginatedTableData} from '../../../components/PaginatedTable/types';
4-
import type {PreparedStorageNode} from '../../../store/reducers/storage/types';
3+
import type {StorageNodesPaginatedTableData} from '../../../components/PaginatedTable/types';
54

65
// Constants moved from PaginatedStorageNodes.tsx
76
const MAX_SLOTS_CSS_VAR = '--maximum-slots';
@@ -15,7 +14,7 @@ const MAX_DISKS_CSS_VAR = '--maximum-disks';
1514
export function useTableCSSVariables() {
1615
const [tableStyle, setTableStyle] = React.useState<React.CSSProperties | undefined>(undefined);
1716

18-
const handleDataFetched = React.useCallback((data: PaginatedTableData<PreparedStorageNode>) => {
17+
const handleDataFetched = React.useCallback((data: StorageNodesPaginatedTableData) => {
1918
if (data?.columnSettings) {
2019
const {maxSlotsPerDisk, maxDisksPerNode} = data.columnSettings;
2120
setTableStyle({

0 commit comments

Comments
 (0)