Skip to content

Commit ed9f91f

Browse files
FE: Broker: Config: Implement search by the Value (#3804)
Co-authored-by: Roman Zabaluev <[email protected]>
1 parent d2a5acc commit ed9f91f

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersConfigTab.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
public class BrokersConfigTab extends BasePage {
1818

19+
protected List<SelenideElement> editBtn = $$x("//button[@aria-label='editAction']");
20+
protected SelenideElement searchByKeyField = $x("//input[@placeholder='Search by Key or Value']");
1921
protected SelenideElement sourceInfoIcon = $x("//div[text()='Source']/..//div/div[@class]");
2022
protected SelenideElement sourceInfoTooltip = $x("//div[text()='Source']/..//div/div[@style]");
2123
protected ElementsCollection editBtns = $$x("//button[@aria-label='editAction']");

kafka-ui-react-app/src/components/Brokers/Broker/Configs/Configs.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,19 @@ const Configs: React.FC = () => {
3434

3535
const getData = () => {
3636
return data
37-
.filter(
38-
(item) =>
39-
item.name.toLocaleLowerCase().indexOf(keyword.toLocaleLowerCase()) >
40-
-1
41-
)
37+
.filter((item) => {
38+
const nameMatch = item.name
39+
.toLocaleLowerCase()
40+
.includes(keyword.toLocaleLowerCase());
41+
return nameMatch
42+
? true
43+
: item.value &&
44+
item.value
45+
.toLocaleLowerCase()
46+
.includes(keyword.toLocaleLowerCase()); // try to match the keyword on any of the item.value elements when nameMatch fails but item.value exists
47+
})
4248
.sort((a, b) => {
4349
if (a.source === b.source) return 0;
44-
4550
return a.source === ConfigSource.DYNAMIC_BROKER_CONFIG ? -1 : 1;
4651
});
4752
};
@@ -95,7 +100,7 @@ const Configs: React.FC = () => {
95100
<S.SearchWrapper>
96101
<Search
97102
onChange={setKeyword}
98-
placeholder="Search by Key"
103+
placeholder="Search by Key or Value"
99104
value={keyword}
100105
/>
101106
</S.SearchWrapper>

0 commit comments

Comments
 (0)