Prechádzať zdrojové kódy

Added brokerConfig search functionality by value

Malav Mevada 2 rokov pred
rodič
commit
33e00221d2

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

@@ -14,7 +14,7 @@ import java.util.stream.Stream;
 public class BrokersConfigTab extends BasePage {
 public class BrokersConfigTab extends BasePage {
 
 
   protected List<SelenideElement> editBtn = $$x("//button[@aria-label='editAction']");
   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
   @Step
   public BrokersConfigTab waitUntilScreenReady() {
   public BrokersConfigTab waitUntilScreenReady() {

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

@@ -34,14 +34,18 @@ const Configs: React.FC = () => {
 
 
   const getData = () => {
   const getData = () => {
     return data
     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) => {
       .sort((a, b) => {
         if (a.source === b.source) return 0;
         if (a.source === b.source) return 0;
-
         return a.source === ConfigSource.DYNAMIC_BROKER_CONFIG ? -1 : 1;
         return a.source === ConfigSource.DYNAMIC_BROKER_CONFIG ? -1 : 1;
       });
       });
   };
   };
 
 
+
   const dataSource = React.useMemo(() => getData(), [data, keyword]);
   const dataSource = React.useMemo(() => getData(), [data, keyword]);
 
 
   const renderCell = (props: CellContext<BrokerConfig, unknown>) => (
   const renderCell = (props: CellContext<BrokerConfig, unknown>) => (
@@ -91,7 +95,7 @@ const Configs: React.FC = () => {
       <S.SearchWrapper>
       <S.SearchWrapper>
         <Search
         <Search
           onChange={setKeyword}
           onChange={setKeyword}
-          placeholder="Search by Key"
+          placeholder="Search by Key or Value"
           value={keyword}
           value={keyword}
         />
         />
       </S.SearchWrapper>
       </S.SearchWrapper>