Added brokerConfig search functionality by value
This commit is contained in:
parent
bc85924d7d
commit
33e00221d2
2 changed files with 8 additions and 4 deletions
|
@ -14,7 +14,7 @@ import java.util.stream.Stream;
|
|||
public class BrokersConfigTab extends BasePage {
|
||||
|
||||
protected List<SelenideElement> editBtn = $$x("//button[@aria-label='editAction']");
|
||||
protected SelenideElement searchByKeyField = $x("//input[@placeholder='Search by Key']");
|
||||
protected SelenideElement searchByKeyField = $x("//input[@placeholder='Search by Key or Value']");
|
||||
|
||||
@Step
|
||||
public BrokersConfigTab waitUntilScreenReady() {
|
||||
|
|
|
@ -34,14 +34,18 @@ const Configs: React.FC = () => {
|
|||
|
||||
const getData = () => {
|
||||
return data
|
||||
.filter((item) => item.name.toLocaleLowerCase().indexOf(keyword) > -1)
|
||||
.filter((item) => {
|
||||
const nameMatch = item.name.toLocaleLowerCase().includes(keyword);
|
||||
const valueMatch = item.value && item.value.includes(keyword);
|
||||
return nameMatch || valueMatch;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
if (a.source === b.source) return 0;
|
||||
|
||||
return a.source === ConfigSource.DYNAMIC_BROKER_CONFIG ? -1 : 1;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const dataSource = React.useMemo(() => getData(), [data, keyword]);
|
||||
|
||||
const renderCell = (props: CellContext<BrokerConfig, unknown>) => (
|
||||
|
@ -91,7 +95,7 @@ const Configs: React.FC = () => {
|
|||
<S.SearchWrapper>
|
||||
<Search
|
||||
onChange={setKeyword}
|
||||
placeholder="Search by Key"
|
||||
placeholder="Search by Key or Value"
|
||||
value={keyword}
|
||||
/>
|
||||
</S.SearchWrapper>
|
||||
|
|
Loading…
Add table
Reference in a new issue