Pei-Cheng-Yu commented on code in PR #56920:
URL: https://github.com/apache/airflow/pull/56920#discussion_r2454844541
##########
airflow-core/src/airflow/ui/src/pages/TaskInstances/TaskInstancesFilter.tsx:
##########
@@ -101,66 +191,106 @@ export const TaskInstancesFilter = ({
[pagination, searchParams, setSearchParams, setTableURLState, sorting],
);
+ const onClearFilters = useCallback(() => {
+ resetPagination();
+ setSearchParams((prev) => {
+ const next = new URLSearchParams(prev);
+
+ next.delete(STATE_PARAM);
+ next.delete(OPERATOR_PARAM);
+ next.delete(QUEUE_PARAM);
+ next.delete(POOL_PARAM);
+
+ return next;
+ });
+ }, [setSearchParams, resetPagination]);
+
+ const initialValues = useMemo(() => {
+ const values: Record<string, FilterValue> = {};
+
+ filterConfigs.forEach((config) => {
+ const value = searchParams.get(config.key);
+
+ if (value !== null && value !== "") {
+ if (config.type === "number") {
+ const parsedValue = Number(value);
+
+ values[config.key] = isNaN(parsedValue) ? value : parsedValue;
+ } else {
+ values[config.key] = value;
+ }
+ }
+ });
+
+ return values;
+ }, [searchParams, filterConfigs]);
+
+ const taskFilterCount =
+ (searchParams.getAll(STATE_PARAM).length > 0 ? 1 : 0) +
+ (searchParams.getAll(OPERATOR_PARAM).length > 0 ? 1 : 0) +
+ (searchParams.getAll(QUEUE_PARAM).length > 0 ? 1 : 0) +
+ (searchParams.getAll(POOL_PARAM).length > 0 ? 1 : 0);
+
return (
- <HStack paddingY="4px">
- {dagId === undefined && (
+ <VStack align="start" justifyContent="space-between">
+ <HStack alignItems="start" paddingY="4px" minWidth="100%">
+ {dagId === undefined && (
+ <SearchBar
+ buttonProps={{ disabled: true }}
+ defaultValue={filteredDagIdPattern ?? ""}
+ hideAdvanced
+ hotkeyDisabled={true}
+ onChange={handleDagIdPatternChange}
+ placeHolder={translate("dags:search.dags")}
+ />
+ )}
<SearchBar
buttonProps={{ disabled: true }}
- defaultValue={filteredDagIdPattern ?? ""}
+ defaultValue={taskDisplayNamePattern ?? ""}
hideAdvanced
- hotkeyDisabled={true}
- onChange={handleDagIdPatternChange}
- placeHolder={translate("dags:search.dags")}
+ hotkeyDisabled={Boolean(runId)}
+ onChange={handleSearchChange}
+ placeHolder={translate("dags:search.tasks")}
+ />
+ <StateFilter
+ onChange={handleStateChange}
+ translate={translate}
Review Comment:
this part is removed after using filterBar for state filter
--
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]