File tree Expand file tree Collapse file tree 2 files changed +35
-7
lines changed
kafka-ui-react-app/src/components/Topics/Topic/ConsumerGroups Expand file tree Collapse file tree 2 files changed +35
-7
lines changed Original file line number Diff line number Diff line change
1
+ import styled from 'styled-components' ;
2
+
3
+ export const SearchWrapper = styled . div `
4
+ margin: 10px;
5
+ width: 21%;
6
+ ` ;
Original file line number Diff line number Diff line change @@ -5,14 +5,27 @@ import useAppParams from 'lib/hooks/useAppParams';
5
5
import { useTopicConsumerGroups } from 'lib/hooks/api/topics' ;
6
6
import { ColumnDef } from '@tanstack/react-table' ;
7
7
import Table , { LinkCell , TagCell } from 'components/common/NewTable' ;
8
+ import Search from 'components/common/Search/Search' ;
9
+
10
+ import * as S from './TopicConsumerGroups.styled' ;
8
11
9
12
const TopicConsumerGroups : React . FC = ( ) => {
13
+ const [ keyword , setKeyword ] = React . useState ( '' ) ;
10
14
const { clusterName, topicName } = useAppParams < RouteParamsClusterTopic > ( ) ;
11
15
12
- const { data : consumerGroups = [ ] } = useTopicConsumerGroups ( {
16
+ const { data = [ ] } = useTopicConsumerGroups ( {
13
17
clusterName,
14
18
topicName,
15
19
} ) ;
20
+
21
+ const consumerGroups = React . useMemo (
22
+ ( ) =>
23
+ data . filter (
24
+ ( item ) => item . groupId . toLocaleLowerCase ( ) . indexOf ( keyword ) > - 1
25
+ ) ,
26
+ [ data , keyword ]
27
+ ) ;
28
+
16
29
const columns = React . useMemo < ColumnDef < ConsumerGroup > [ ] > (
17
30
( ) => [
18
31
{
@@ -61,12 +74,21 @@ const TopicConsumerGroups: React.FC = () => {
61
74
[ ]
62
75
) ;
63
76
return (
64
- < Table
65
- columns = { columns }
66
- data = { consumerGroups }
67
- enableSorting
68
- emptyMessage = "No active consumer groups"
69
- />
77
+ < >
78
+ < S . SearchWrapper >
79
+ < Search
80
+ onChange = { setKeyword }
81
+ placeholder = "Search by Consumer Name"
82
+ value = { keyword }
83
+ />
84
+ </ S . SearchWrapper >
85
+ < Table
86
+ columns = { columns }
87
+ data = { consumerGroups }
88
+ enableSorting
89
+ emptyMessage = "No active consumer groups"
90
+ />
91
+ </ >
70
92
) ;
71
93
} ;
72
94
You can’t perform that action at this time.
0 commit comments