Sfoglia il codice sorgente

Added brokerConfig search functionality by value

Malav Mevada 2 anni fa
parent
commit
4ff667d2d1

+ 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 {
 
   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() {

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

@@ -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>) => (