Skip to content

Commit fa986f0

Browse files
authored
Merge branch 'main' into astandrik.fix-columns-width-on-long-rowset-1340
2 parents 5add284 + e63d22b commit fa986f0

File tree

14 files changed

+127
-24
lines changed

14 files changed

+127
-24
lines changed

src/containers/Nodes/columns/columns.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ const getHostColumn = (getNodeRef?: GetNodeRefFunc, database?: string): NodesCol
3636
align: DataTable.LEFT,
3737
sortable: false,
3838
});
39+
const nodeNameColumn: NodesColumn = {
40+
name: NODES_COLUMNS_IDS.NodeName,
41+
header: NODES_COLUMNS_TITLES.NodeName,
42+
align: DataTable.LEFT,
43+
render: ({row}) => row.NodeName || EMPTY_DATA_PLACEHOLDER,
44+
width: 200,
45+
};
3946

4047
const getHostColumnWithUndefinedWidth = (
4148
getNodeRef?: GetNodeRefFunc,
@@ -217,6 +224,7 @@ export function getNodesColumns({database, getNodeRef}: GetNodesColumnsProps): N
217224
const columns = [
218225
nodeIdColumn,
219226
getHostColumn(getNodeRef, database),
227+
nodeNameColumn,
220228
dataCenterColumn,
221229
rackColumn,
222230
versionColumn,

src/containers/Nodes/columns/constants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const NODES_TABLE_SELECTED_COLUMNS_LS_KEY = 'nodesTableSelectedColumns';
88
export const NODES_COLUMNS_IDS = {
99
NodeId: 'NodeId',
1010
Host: 'Host',
11+
NodeName: 'NodeName',
1112
DC: 'DC',
1213
Rack: 'Rack',
1314
Version: 'Version',
@@ -48,6 +49,9 @@ export const NODES_COLUMNS_TITLES = {
4849
get Host() {
4950
return i18n('host');
5051
},
52+
get NodeName() {
53+
return i18n('node-name');
54+
},
5155
get DC() {
5256
return i18n('dc');
5357
},

src/containers/Nodes/columns/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"node-id": "Node Id",
33
"host": "Host",
4+
"node-name": "Node Name",
45
"dc": "DC",
56
"rack": "Rack",
67
"version": "Version",

src/containers/Storage/PaginatedStorage.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import {useStorageQueryParams} from './useStorageQueryParams';
44

55
export interface PaginatedStorageProps {
66
database?: string;
7-
nodeId?: string;
8-
groupId?: string;
7+
nodeId?: string | number;
8+
groupId?: string | number;
9+
pDiskId?: string | number;
10+
911
parentContainer?: Element | null;
1012
}
1113

src/containers/Storage/PaginatedStorageGroups.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,18 @@ export function PaginatedStorageGroups(props: PaginatedStorageProps) {
4949
return <LoaderWrapper loading={!capabilitiesLoaded}>{renderContent()}</LoaderWrapper>;
5050
}
5151

52-
function StorageGroupsComponent({database, nodeId, parentContainer}: PaginatedStorageProps) {
52+
function StorageGroupsComponent({
53+
database,
54+
nodeId,
55+
groupId,
56+
pDiskId,
57+
parentContainer,
58+
}: PaginatedStorageProps) {
5359
const {searchValue, visibleEntities, handleShowAllGroups} = useStorageQueryParams();
5460

5561
const {columnsToShow, columnsToSelect, setColumns} = useStorageGroupsSelectedColumns({
5662
visibleEntities,
57-
nodeId,
63+
nodeId: nodeId?.toString(),
5864
});
5965

6066
const renderControls: RenderControls = ({totalEntities, foundEntities, inited}) => {
@@ -75,6 +81,8 @@ function StorageGroupsComponent({database, nodeId, parentContainer}: PaginatedSt
7581
<PaginatedStorageGroupsTable
7682
database={database}
7783
nodeId={nodeId}
84+
groupId={groupId}
85+
pDiskId={pDiskId}
7886
searchValue={searchValue}
7987
visibleEntities={visibleEntities}
8088
onShowAll={handleShowAllGroups}
@@ -86,14 +94,19 @@ function StorageGroupsComponent({database, nodeId, parentContainer}: PaginatedSt
8694
);
8795
}
8896

89-
function GroupedStorageGroupsComponent({database, groupId, nodeId}: PaginatedStorageProps) {
97+
function GroupedStorageGroupsComponent({
98+
database,
99+
nodeId,
100+
groupId,
101+
pDiskId,
102+
}: PaginatedStorageProps) {
90103
const [autoRefreshInterval] = useAutoRefreshInterval();
91104
const {searchValue, storageGroupsGroupByParam, visibleEntities, handleShowAllGroups} =
92105
useStorageQueryParams();
93106

94107
const {columnsToShow, columnsToSelect, setColumns} = useStorageGroupsSelectedColumns({
95108
visibleEntities,
96-
nodeId,
109+
nodeId: nodeId?.toString(),
97110
});
98111

99112
const {currentData, isFetching, error} = storageApi.useGetStorageGroupsInfoQuery(
@@ -102,6 +115,7 @@ function GroupedStorageGroupsComponent({database, groupId, nodeId}: PaginatedSto
102115
with: 'all',
103116
nodeId,
104117
groupId,
118+
pDiskId,
105119
filter: searchValue,
106120
shouldUseGroupsHandler: true,
107121
group: storageGroupsGroupByParam,
@@ -147,6 +161,8 @@ function GroupedStorageGroupsComponent({database, groupId, nodeId}: PaginatedSto
147161
<PaginatedStorageGroupsTable
148162
database={database}
149163
nodeId={nodeId}
164+
groupId={groupId}
165+
pDiskId={pDiskId}
150166
filterGroup={name}
151167
filterGroupBy={storageGroupsGroupByParam}
152168
searchValue={searchValue}

src/containers/Storage/PaginatedStorageNodes.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
} from '../../store/reducers/capabilities/hooks';
1111
import {useClusterBaseInfo} from '../../store/reducers/cluster/cluster';
1212
import {storageApi} from '../../store/reducers/storage/storage';
13-
import {valueIsDefined} from '../../utils';
1413
import {useAutoRefreshInterval} from '../../utils/hooks';
1514
import {NodesUptimeFilterValues} from '../../utils/nodes';
1615
import {useAdditionalNodeProps} from '../AppWithClusters/useClusterData';
@@ -57,13 +56,18 @@ export const PaginatedStorageNodes = (props: PaginatedStorageProps) => {
5756
return <LoaderWrapper loading={!capabilitiesLoaded}>{renderContent()}</LoaderWrapper>;
5857
};
5958

60-
function StorageNodesComponent({database, groupId, parentContainer}: PaginatedStorageProps) {
59+
function StorageNodesComponent({
60+
database,
61+
nodeId,
62+
groupId,
63+
parentContainer,
64+
}: PaginatedStorageProps) {
6165
const {searchValue, visibleEntities, nodesUptimeFilter, handleShowAllNodes} =
6266
useStorageQueryParams();
6367

6468
const {columnsToShow, columnsToSelect, setColumns} = useStorageNodesColumnsToSelect({
6569
database,
66-
groupId,
70+
groupId: groupId?.toString(),
6771
});
6872

6973
const renderControls: RenderControls = ({totalEntities, foundEntities, inited}) => {
@@ -83,6 +87,8 @@ function StorageNodesComponent({database, groupId, parentContainer}: PaginatedSt
8387
return (
8488
<PaginatedStorageNodesTable
8589
database={database}
90+
nodeId={nodeId}
91+
groupId={groupId}
8692
searchValue={searchValue}
8793
visibleEntities={visibleEntities}
8894
nodesUptimeFilter={nodesUptimeFilter}
@@ -102,7 +108,7 @@ function GroupedStorageNodesComponent({database, groupId, nodeId}: PaginatedStor
102108

103109
const {columnsToShow, columnsToSelect, setColumns} = useStorageNodesColumnsToSelect({
104110
database,
105-
groupId,
111+
groupId: groupId?.toString(),
106112
});
107113

108114
const {currentData, isFetching, error} = storageApi.useGetStorageNodesInfoQuery(
@@ -111,8 +117,7 @@ function GroupedStorageNodesComponent({database, groupId, nodeId}: PaginatedStor
111117
with: 'all',
112118
filter: searchValue,
113119
node_id: nodeId,
114-
// node_id and group_id params don't work together
115-
group_id: valueIsDefined(nodeId) ? undefined : groupId,
120+
group_id: groupId,
116121
group: storageNodesGroupByParam,
117122
},
118123
{
@@ -155,6 +160,8 @@ function GroupedStorageNodesComponent({database, groupId, nodeId}: PaginatedStor
155160
>
156161
<PaginatedStorageNodesTable
157162
database={database}
163+
nodeId={nodeId}
164+
groupId={groupId}
158165
searchValue={searchValue}
159166
visibleEntities={'all'}
160167
nodesUptimeFilter={NodesUptimeFilterValues.All}

src/containers/Storage/Storage.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type {NodesSortParams} from '../../store/reducers/nodes/types';
1313
import {filterGroups, filterNodes} from '../../store/reducers/storage/selectors';
1414
import {storageApi} from '../../store/reducers/storage/storage';
1515
import type {StorageSortParams} from '../../store/reducers/storage/types';
16-
import {valueIsDefined} from '../../utils';
1716
import {useAutoRefreshInterval, useTableSort} from '../../utils/hooks';
1817
import {useAdditionalNodeProps} from '../AppWithClusters/useClusterData';
1918

@@ -90,8 +89,7 @@ export const Storage = ({database, nodeId, groupId, pDiskId}: StorageProps) => {
9089
database,
9190
with: visibleEntities,
9291
node_id: nodeId,
93-
// node_id and group_id params don't work together
94-
group_id: valueIsDefined(nodeId) ? undefined : groupId,
92+
group_id: groupId,
9593
},
9694
{
9795
skip: !isNodes,

src/containers/Storage/StorageGroups/PaginatedStorageGroupsTable.tsx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ interface PaginatedStorageGroupsTableProps {
2121
columns: StorageGroupsColumn[];
2222

2323
database?: string;
24-
nodeId?: string;
24+
nodeId?: string | number;
25+
groupId?: string | number;
26+
pDiskId?: string | number;
2527

2628
filterGroup?: string;
2729
filterGroupBy?: GroupsGroupByField;
@@ -40,6 +42,8 @@ export const PaginatedStorageGroupsTable = ({
4042
columns,
4143
database,
4244
nodeId,
45+
groupId,
46+
pDiskId,
4347
filterGroup,
4448
filterGroupBy,
4549
searchValue,
@@ -56,8 +60,26 @@ export const PaginatedStorageGroupsTable = ({
5660
const fetchData = useGroupsGetter(groupsHandlerAvailable);
5761

5862
const tableFilters = React.useMemo(() => {
59-
return {searchValue, visibleEntities, database, nodeId, filterGroup, filterGroupBy};
60-
}, [searchValue, visibleEntities, database, nodeId, filterGroup, filterGroupBy]);
63+
return {
64+
searchValue,
65+
visibleEntities,
66+
database,
67+
nodeId,
68+
groupId,
69+
pDiskId,
70+
filterGroup,
71+
filterGroupBy,
72+
};
73+
}, [
74+
searchValue,
75+
visibleEntities,
76+
database,
77+
nodeId,
78+
groupId,
79+
pDiskId,
80+
filterGroup,
81+
filterGroupBy,
82+
]);
6183

6284
const renderEmptyDataMessage = () => {
6385
if (visibleEntities !== VISIBLE_ENTITIES.all) {

src/containers/Storage/StorageGroups/getGroups.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@ export function useGroupsGetter(shouldUseGroupsHandler: boolean) {
1616
async (params) => {
1717
const {limit, offset, sortParams, filters} = params;
1818
const {sortOrder, columnId} = sortParams ?? {};
19-
const {searchValue, visibleEntities, database, nodeId, filterGroup, filterGroupBy} =
20-
filters ?? {};
19+
const {
20+
searchValue,
21+
visibleEntities,
22+
database,
23+
nodeId,
24+
groupId,
25+
pDiskId,
26+
filterGroup,
27+
filterGroupBy,
28+
} = filters ?? {};
2129

2230
const sort = isSortableStorageProperty(columnId)
2331
? prepareSortValue(columnId, sortOrder)
@@ -31,6 +39,8 @@ export function useGroupsGetter(shouldUseGroupsHandler: boolean) {
3139
with: visibleEntities,
3240
database,
3341
nodeId,
42+
groupId,
43+
pDiskId,
3444
filter_group: filterGroup,
3545
filter_group_by: filterGroupBy,
3646
shouldUseGroupsHandler,

src/containers/Storage/StorageNodes/PaginatedStorageNodesTable.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ interface PaginatedStorageNodesTableProps {
1818
columns: StorageNodesColumn[];
1919

2020
database?: string;
21+
nodeId?: string | number;
22+
groupId?: string | number;
2123

2224
filterGroup?: string;
2325
filterGroupBy?: NodesGroupByField;
@@ -36,6 +38,8 @@ interface PaginatedStorageNodesTableProps {
3638
export const PaginatedStorageNodesTable = ({
3739
columns,
3840
database,
41+
nodeId,
42+
groupId,
3943
filterGroup,
4044
filterGroupBy,
4145
searchValue,
@@ -53,10 +57,21 @@ export const PaginatedStorageNodesTable = ({
5357
visibleEntities,
5458
nodesUptimeFilter,
5559
database,
60+
nodeId,
61+
groupId,
5662
filterGroup,
5763
filterGroupBy,
5864
};
59-
}, [searchValue, visibleEntities, nodesUptimeFilter, database, filterGroup, filterGroupBy]);
65+
}, [
66+
searchValue,
67+
visibleEntities,
68+
nodesUptimeFilter,
69+
database,
70+
nodeId,
71+
groupId,
72+
filterGroup,
73+
filterGroupBy,
74+
]);
6075

6176
const renderEmptyDataMessage = () => {
6277
if (

0 commit comments

Comments
 (0)