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


##########
airflow-core/src/airflow/ui/src/pages/Dag/Tasks/TaskFilters/TaskFilters.tsx:
##########
@@ -78,59 +53,116 @@ export const TaskFilters = ({ tasksData }: { readonly 
tasksData: TaskCollectionR
     { key: "true", label: translate("mapped") },
     { key: "false", label: translate("notMapped") },
   ];
-  const taskNamePattern = searchParams.get(NAME_PATTERN) ?? "";
-  const handleSearchChange = (value: string) => {
-    if (value) {
-      searchParams.set(NAME_PATTERN, value);
-    } else {
-      searchParams.delete(NAME_PATTERN);
+
+  // Convert to FilterBar select option shape (label/value)
+  const operatorOptions = allOperatorNames
+    .map((value) => ({ label: value, value }))
+    .sort((left, right) => left.label.localeCompare(right.label));
+  const triggerRuleOptions = allTriggerRules
+    .map((value) => ({ label: value, value }))
+    .sort((left, right) => left.label.localeCompare(right.label));
+  const retryValueOptions = allRetryValues
+    .map((value) => ({ label: value, value }))
+    .sort((left, right) => left.label.localeCompare(right.label));
+  const mappedOptions = allMappedValues.map(({ key, label }) => ({ label, 
value: key }));
+
+  // FilterBar configs (keys unchanged; labels stick to prior wording)
+  const configsUnfiltered: Array<FilterConfig | false> = [
+    {
+      hotkeyDisabled: true,
+      key: NAME_PATTERN,
+      label: translate("searchTasks"),
+      placeholder: translate("searchTasks"),
+      type: "text",
+    },
+    operatorOptions.length > 0 && {
+      key: OPERATOR,
+      label: translate("selectOperator", { defaultValue: "Operators" }),
+      multiple: true,
+      options: operatorOptions,
+      type: "select",
+    },
+    triggerRuleOptions.length > 0 && {
+      key: TRIGGER_RULE,
+      label: translate("selectTriggerRules", { defaultValue: "Trigger rules" 
}),
+      multiple: true,
+      options: triggerRuleOptions,
+      type: "select",
+    },
+    retryValueOptions.length > 0 && {
+      key: RETRIES,
+      label: translate("retries", { defaultValue: "Retry values" }),
+      multiple: true,
+      options: retryValueOptions,
+      type: "select",
+    },
+    {
+      key: MAPPED,
+      label: translate("mapped", { defaultValue: "Mapped" }),
+      multiple: false,
+      options: mappedOptions,
+      type: "select",
+    },
+  ];

Review Comment:
   Task Instances list are also displayed on TI details view and DagRun details 
view. There some filters should be removed accordingly e.g On a TI (group or 
mapped index), dag run and dag id are fixed, those filters shouldn't be 
possible. Similarly on a specific dag run in the grid, listing TI, we shouldn't 
be able to filter per dag run, because it is already set.
   
   You can take a look at the HITL `FilterBar` implementation to take an 
example from.



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