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


##########
airflow-core/src/airflow/ui/src/pages/Dag/Tasks/TaskFilters/TaskFilters.tsx:
##########
@@ -78,59 +53,129 @@ 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 }));
+
+  // Narrow falsy entries without hard casts
+  const isFilterConfig = (x: FilterConfig | false): x is FilterConfig => x !== 
false;
+
+  // 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 && {

Review Comment:
   This filter config should directly come from the hook. You don't have to 
create the full config manually, so those can be re-used by other filter bars.



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