Skip to content

Commit d27f6c0

Browse files
review: use different group by query params
1 parent dfb88ca commit d27f6c0

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

src/containers/Storage/StorageControls/StorageControls.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ export function StorageGroupsControls({
4545
handleTextFilterChange,
4646
handleStorageTypeChange,
4747
handleVisibleEntitiesChange,
48-
handleGroupByParamChange,
48+
handleStorageGroupsGroupByParamChange,
4949
} = useStorageQueryParams();
5050

5151
const handleGroupBySelectUpdate = (value: string[]) => {
52-
handleGroupByParamChange(value[0]);
52+
handleStorageGroupsGroupByParamChange(value[0]);
5353
};
5454

5555
return (
@@ -122,11 +122,11 @@ export function StorageNodesControls({
122122
handleStorageTypeChange,
123123
handleVisibleEntitiesChange,
124124
handleUptimeFilterChange,
125-
handleGroupByParamChange,
125+
handleStorageNodesGroupByParamChange,
126126
} = useStorageQueryParams();
127127

128128
const handleGroupBySelectUpdate = (value: string[]) => {
129-
handleGroupByParamChange(value[0]);
129+
handleStorageNodesGroupByParamChange(value[0]);
130130
};
131131

132132
return (

src/containers/Storage/useStorageQueryParams.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export function useStorageQueryParams() {
1313
visible: StringParam,
1414
search: StringParam,
1515
uptimeFilter: StringParam,
16-
groupBy: StringParam,
16+
storageNodesGroupBy: StringParam,
17+
storageGroupsGroupBy: StringParam,
1718
});
1819

1920
const storageType = storageTypeSchema.parse(queryParams.type);
@@ -22,8 +23,12 @@ export function useStorageQueryParams() {
2223
const searchValue = queryParams.search ?? '';
2324
const nodesUptimeFilter = nodesUptimeFilterValuesSchema.parse(queryParams.uptimeFilter);
2425

25-
const storageGroupsGroupByParam = storageGroupsGroupByParamSchema.parse(queryParams.groupBy);
26-
const storageNodesGroupByParam = storageNodesGroupByParamSchema.parse(queryParams.groupBy);
26+
const storageGroupsGroupByParam = storageGroupsGroupByParamSchema.parse(
27+
queryParams.storageGroupsGroupBy,
28+
);
29+
const storageNodesGroupByParam = storageNodesGroupByParamSchema.parse(
30+
queryParams.storageNodesGroupBy,
31+
);
2732

2833
const handleTextFilterChange = (value: string) => {
2934
setQueryParams({search: value || undefined}, 'replaceIn');
@@ -41,8 +46,11 @@ export function useStorageQueryParams() {
4146
setQueryParams({uptimeFilter: value}, 'replaceIn');
4247
};
4348

44-
const handleGroupByParamChange = (value: string) => {
45-
setQueryParams({groupBy: value}, 'replaceIn');
49+
const handleStorageGroupsGroupByParamChange = (value: string) => {
50+
setQueryParams({storageGroupsGroupBy: value}, 'replaceIn');
51+
};
52+
const handleStorageNodesGroupByParamChange = (value: string) => {
53+
setQueryParams({storageNodesGroupBy: value}, 'replaceIn');
4654
};
4755

4856
const handleShowAllGroups = () => {
@@ -66,7 +74,10 @@ export function useStorageQueryParams() {
6674
handleVisibleEntitiesChange,
6775
handleStorageTypeChange,
6876
handleUptimeFilterChange,
69-
handleGroupByParamChange,
77+
78+
handleStorageGroupsGroupByParamChange,
79+
handleStorageNodesGroupByParamChange,
80+
7081
handleShowAllGroups,
7182
handleShowAllNodes,
7283
};

0 commit comments

Comments
 (0)