Skip to content

Commit

Permalink
FE: Broker: Config: Implement search by the Value (#3804)
Browse files Browse the repository at this point in the history
Co-authored-by: Roman Zabaluev <rzabaluev@provectus.com>
  • Loading branch information
malavmevada and Haarolean authored Aug 23, 2023
1 parent d2a5acc commit ed9f91f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

public class BrokersConfigTab extends BasePage {

protected List<SelenideElement> editBtn = $$x("//button[@aria-label='editAction']");
protected SelenideElement searchByKeyField = $x("//input[@placeholder='Search by Key or Value']");
protected SelenideElement sourceInfoIcon = $x("//div[text()='Source']/..//div/div[@class]");
protected SelenideElement sourceInfoTooltip = $x("//div[text()='Source']/..//div/div[@style]");
protected ElementsCollection editBtns = $$x("//button[@aria-label='editAction']");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@ const Configs: React.FC = () => {

const getData = () => {
return data
.filter(
(item) =>
item.name.toLocaleLowerCase().indexOf(keyword.toLocaleLowerCase()) >
-1
)
.filter((item) => {
const nameMatch = item.name
.toLocaleLowerCase()
.includes(keyword.toLocaleLowerCase());
return nameMatch
? true
: item.value &&
item.value
.toLocaleLowerCase()
.includes(keyword.toLocaleLowerCase()); // try to match the keyword on any of the item.value elements when nameMatch fails but item.value exists
})
.sort((a, b) => {
if (a.source === b.source) return 0;

return a.source === ConfigSource.DYNAMIC_BROKER_CONFIG ? -1 : 1;
});
};
Expand Down Expand Up @@ -95,7 +100,7 @@ const Configs: React.FC = () => {
<S.SearchWrapper>
<Search
onChange={setKeyword}
placeholder="Search by Key"
placeholder="Search by Key or Value"
value={keyword}
/>
</S.SearchWrapper>
Expand Down

0 comments on commit ed9f91f

Please sign in to comment.