Skip to content

Commit 410def9

Browse files
fix: enable search for table groups
1 parent 24c04e2 commit 410def9

File tree

3 files changed

+50
-37
lines changed

3 files changed

+50
-37
lines changed

src/containers/Storage/PaginatedStorageGroups.tsx

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ function GroupedStorageGroupsComponent({database, groupId, nodeId}: PaginatedSto
9595
with: 'all',
9696
nodeId,
9797
groupId,
98+
filter: searchValue,
9899
shouldUseGroupsHandler: true,
99100
group: storageGroupsGroupByParam,
100101
},
@@ -121,24 +122,28 @@ function GroupedStorageGroupsComponent({database, groupId, nodeId}: PaginatedSto
121122
};
122123

123124
const renderGroups = () => {
124-
return tableGroups?.map(({name, count}) => {
125-
return (
126-
<TableGroup key={name} title={name} count={count} entityName={i18n('groups')}>
127-
<PaginatedStorageGroupsTable
128-
database={database}
129-
nodeId={nodeId}
130-
filterGroup={name}
131-
filterGroupBy={storageGroupsGroupByParam}
132-
searchValue={searchValue}
133-
visibleEntities={'all'}
134-
onShowAll={handleShowAllGroups}
135-
renderErrorMessage={renderPaginatedTableErrorMessage}
136-
columns={columnsToShow}
137-
initialEntitiesCount={count}
138-
/>
139-
</TableGroup>
140-
);
141-
});
125+
if (tableGroups?.length) {
126+
return tableGroups.map(({name, count}) => {
127+
return (
128+
<TableGroup key={name} title={name} count={count} entityName={i18n('groups')}>
129+
<PaginatedStorageGroupsTable
130+
database={database}
131+
nodeId={nodeId}
132+
filterGroup={name}
133+
filterGroupBy={storageGroupsGroupByParam}
134+
searchValue={searchValue}
135+
visibleEntities={'all'}
136+
onShowAll={handleShowAllGroups}
137+
renderErrorMessage={renderPaginatedTableErrorMessage}
138+
columns={columnsToShow}
139+
initialEntitiesCount={count}
140+
/>
141+
</TableGroup>
142+
);
143+
});
144+
}
145+
146+
return i18n('no-groups');
142147
};
143148

144149
return (

src/containers/Storage/PaginatedStorageNodes.tsx

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ function GroupedStorageNodesComponent({database, groupId, nodeId}: PaginatedStor
106106
{
107107
database,
108108
with: 'all',
109+
filter: searchValue,
109110
node_id: nodeId,
110111
// node_id and group_id params don't work together
111112
group_id: valueIsDefined(nodeId) ? undefined : groupId,
@@ -134,24 +135,28 @@ function GroupedStorageNodesComponent({database, groupId, nodeId}: PaginatedStor
134135
};
135136

136137
const renderGroups = () => {
137-
return tableGroups?.map(({name, count}) => {
138-
return (
139-
<TableGroup key={name} title={name} count={count} entityName={i18n('nodes')}>
140-
<PaginatedStorageNodesTable
141-
database={database}
142-
searchValue={searchValue}
143-
visibleEntities={'all'}
144-
nodesUptimeFilter={NodesUptimeFilterValues.All}
145-
onShowAll={handleShowAllNodes}
146-
filterGroup={name}
147-
filterGroupBy={storageNodesGroupByParam}
148-
renderErrorMessage={renderPaginatedTableErrorMessage}
149-
columns={columnsToShow}
150-
initialEntitiesCount={count}
151-
/>
152-
</TableGroup>
153-
);
154-
});
138+
if (tableGroups?.length) {
139+
return tableGroups.map(({name, count}) => {
140+
return (
141+
<TableGroup key={name} title={name} count={count} entityName={i18n('nodes')}>
142+
<PaginatedStorageNodesTable
143+
database={database}
144+
searchValue={searchValue}
145+
visibleEntities={'all'}
146+
nodesUptimeFilter={NodesUptimeFilterValues.All}
147+
onShowAll={handleShowAllNodes}
148+
filterGroup={name}
149+
filterGroupBy={storageNodesGroupByParam}
150+
renderErrorMessage={renderPaginatedTableErrorMessage}
151+
columns={columnsToShow}
152+
initialEntitiesCount={count}
153+
/>
154+
</TableGroup>
155+
);
156+
});
157+
}
158+
159+
return i18n('no-nodes');
155160
};
156161

157162
return (

src/containers/Storage/i18n/en.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44

55
"controls_groups-search-placeholder": "Group ID, Pool name",
66
"controls_nodes-search-placeholder": "Node ID, FQDN",
7-
"controls_group-by-placeholder": "Group by:"
7+
"controls_group-by-placeholder": "Group by:",
8+
9+
"no-nodes": "No such nodes",
10+
"no-groups": "No such groups"
811
}

0 commit comments

Comments
 (0)