vatsrahul1001 commented on code in PR #54210:
URL: https://github.com/apache/airflow/pull/54210#discussion_r2266900693


##########
airflow-core/src/airflow/ui/src/pages/Events/Events.tsx:
##########
@@ -141,31 +144,78 @@ const eventsColumn = (
   },
 ];
 
+const {
+  AFTER: AFTER_PARAM,
+  BEFORE: BEFORE_PARAM,
+  DAG_ID: DAG_ID_PARAM,
+  EVENT_TYPE: EVENT_TYPE_PARAM,
+  MAP_INDEX: MAP_INDEX_PARAM,
+  RUN_ID: RUN_ID_PARAM,
+  TASK_ID: TASK_ID_PARAM,
+  TRY_NUMBER: TRY_NUMBER_PARAM,
+  USER: USER_PARAM,
+}: SearchParamsKeysType = SearchParamsKeys;
+
 export const Events = () => {
   const { t: translate } = useTranslation("browse");
   const { dagId, runId, taskId } = useParams();
+  const [searchParams] = useSearchParams();
   const { setTableURLState, tableURLState } = useTableURLState();
   const { pagination, sorting } = tableURLState;
   const [sort] = sorting;
   const { onClose, onOpen, open } = useDisclosure();
 
+  // Get filter values from search params
+  const afterFilter = searchParams.get(AFTER_PARAM);
+  const beforeFilter = searchParams.get(BEFORE_PARAM);
+  const dagIdFilter = searchParams.get(DAG_ID_PARAM);
+  const eventTypeFilter = searchParams.get(EVENT_TYPE_PARAM);
+  const mapIndexFilter = searchParams.get(MAP_INDEX_PARAM);
+  const runIdFilter = searchParams.get(RUN_ID_PARAM);
+  const taskIdFilter = searchParams.get(TASK_ID_PARAM);
+  const tryNumberFilter = searchParams.get(TRY_NUMBER_PARAM);
+  const userFilter = searchParams.get(USER_PARAM);
+
   const orderBy = sort ? [`${sort.desc ? "-" : ""}${sort.id}`] : ["-when"];
 
+  // Convert string filters to appropriate types for API
+  const mapIndexNumber =
+    mapIndexFilter !== null && mapIndexFilter !== "" ? 
parseInt(mapIndexFilter, 10) : undefined;
+  const tryNumberNumber =
+    tryNumberFilter !== null && tryNumberFilter !== "" ? 
parseInt(tryNumberFilter, 10) : undefined;
+
+  // Handle date conversion - ensure valid ISO strings
+  const afterDate =
+    afterFilter !== null && afterFilter !== "" && 
!isNaN(Date.parse(afterFilter)) ? afterFilter : undefined;
+  const beforeDate =
+    beforeFilter !== null && beforeFilter !== "" && 
!isNaN(Date.parse(beforeFilter))
+      ? beforeFilter
+      : undefined;
+
   const { data, error, isFetching, isLoading } = 
useEventLogServiceGetEventLogs(
     {
-      dagId,
+      // Additional filters
+      after: afterDate,
+      before: beforeDate,
+      // URL params take precedence over filters for context-specific views
+      dagId: dagId ?? (dagIdFilter !== null && dagIdFilter !== "" ? 
dagIdFilter : undefined),
+      event: eventTypeFilter !== null && eventTypeFilter !== "" ? 
eventTypeFilter : undefined,
+      // Pagination and sorting

Review Comment:
   Removed



##########
airflow-core/src/airflow/ui/src/pages/Events/Events.tsx:
##########
@@ -141,31 +144,78 @@ const eventsColumn = (
   },
 ];
 
+const {
+  AFTER: AFTER_PARAM,
+  BEFORE: BEFORE_PARAM,
+  DAG_ID: DAG_ID_PARAM,
+  EVENT_TYPE: EVENT_TYPE_PARAM,
+  MAP_INDEX: MAP_INDEX_PARAM,
+  RUN_ID: RUN_ID_PARAM,
+  TASK_ID: TASK_ID_PARAM,
+  TRY_NUMBER: TRY_NUMBER_PARAM,
+  USER: USER_PARAM,
+}: SearchParamsKeysType = SearchParamsKeys;
+
 export const Events = () => {
   const { t: translate } = useTranslation("browse");
   const { dagId, runId, taskId } = useParams();
+  const [searchParams] = useSearchParams();
   const { setTableURLState, tableURLState } = useTableURLState();
   const { pagination, sorting } = tableURLState;
   const [sort] = sorting;
   const { onClose, onOpen, open } = useDisclosure();
 
+  // Get filter values from search params
+  const afterFilter = searchParams.get(AFTER_PARAM);
+  const beforeFilter = searchParams.get(BEFORE_PARAM);
+  const dagIdFilter = searchParams.get(DAG_ID_PARAM);
+  const eventTypeFilter = searchParams.get(EVENT_TYPE_PARAM);
+  const mapIndexFilter = searchParams.get(MAP_INDEX_PARAM);
+  const runIdFilter = searchParams.get(RUN_ID_PARAM);
+  const taskIdFilter = searchParams.get(TASK_ID_PARAM);
+  const tryNumberFilter = searchParams.get(TRY_NUMBER_PARAM);
+  const userFilter = searchParams.get(USER_PARAM);
+
   const orderBy = sort ? [`${sort.desc ? "-" : ""}${sort.id}`] : ["-when"];
 
+  // Convert string filters to appropriate types for API
+  const mapIndexNumber =
+    mapIndexFilter !== null && mapIndexFilter !== "" ? 
parseInt(mapIndexFilter, 10) : undefined;
+  const tryNumberNumber =
+    tryNumberFilter !== null && tryNumberFilter !== "" ? 
parseInt(tryNumberFilter, 10) : undefined;

Review Comment:
   Fixed



-- 
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