pierrejeambrun commented on code in PR #55691:
URL: https://github.com/apache/airflow/pull/55691#discussion_r2355368339


##########
airflow-core/src/airflow/ui/src/pages/DagRuns.tsx:
##########
@@ -275,9 +278,36 @@ export const DagRuns = () => {
     [pagination, searchParams, setSearchParams, setTableURLState, sorting],
   );
 
+  const handleDagIdPatternChange = useCallback(
+    (value: string) => {
+      if (value === "") {
+        searchParams.delete(DAG_ID_PATTERN_PARAM);
+      } else {
+        searchParams.set(DAG_ID_PATTERN_PARAM, value);
+      }
+      setTableURLState({
+        pagination: { ...pagination, pageIndex: 0 },
+        sorting,
+      });
+      setSearchParams(searchParams);
+    },
+    [pagination, searchParams, setSearchParams, setTableURLState, sorting],
+  );
+
   return (
     <>
       <HStack paddingY="4px">
+        {dagId === undefined && (
+          <Box>
+            <SearchBar
+              defaultValue={filteredDagIdPattern ?? ""}
+              hideAdvanced
+              hotkeyDisabled={true}
+              onChange={handleDagIdPatternChange}
+              placeHolder="Search by Dag ID"

Review Comment:
   Same here, translated placeholder.



##########
airflow-core/src/airflow/ui/src/pages/TaskInstances/TaskInstancesFilter.tsx:
##########
@@ -80,8 +85,34 @@ export const TaskInstancesFilter = ({
     setSearchParams(searchParams);
   };
 
+  const handleDagIdPatternChange = useCallback(
+    (value: string) => {
+      if (value === "") {
+        searchParams.delete(DAG_ID_PATTERN_PARAM);
+      } else {
+        searchParams.set(DAG_ID_PATTERN_PARAM, value);
+      }
+      setTableURLState({
+        pagination: { ...pagination, pageIndex: 0 },
+        sorting,
+      });
+      setSearchParams(searchParams);
+    },
+    [pagination, searchParams, setSearchParams, setTableURLState, sorting],
+  );
+
   return (
     <HStack paddingY="4px">
+      {dagId === undefined && (
+        <SearchBar
+          buttonProps={{ disabled: true }}
+          defaultValue={filteredDagIdPattern ?? ""}
+          hideAdvanced
+          hotkeyDisabled={true}
+          onChange={handleDagIdPatternChange}
+          placeHolder="Search by Dag ID"

Review Comment:
   This placeholder should be translated (`search.dags`)



##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py:
##########
@@ -1401,6 +1401,46 @@ def test_should_respond_200_for_pagination(self, 
test_client, session):
         assert (num_entries_batch1 + num_entries_batch2) == ti_count
         assert response_batch1 != response_batch2
 
+    def test_dag_id_pattern_filter(self, test_client, session):

Review Comment:
   Nit: Similarly to what you did for `dag_runs` this should be part of the 
`test_should_respond_200` test which tests all the query params (filter, search 
and all). So all of them are grouped together. 
   
   I don't think we need an extra specific test. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to