OscarLigthart commented on code in PR #57237:
URL: https://github.com/apache/airflow/pull/57237#discussion_r2472668770


##########
airflow-core/src/airflow/ui/src/layouts/Details/LineageFilter.tsx:
##########
@@ -0,0 +1,163 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Portal, Popover, Text, VStack } from "@chakra-ui/react";
+import { FiChevronDown, FiFilter } from "react-icons/fi";
+
+import { Button } from "src/components/ui";
+
+export type FilterMode = "both" | "downstream" | "none" | "upstream";
+
+type LineageFilterProps = {
+  readonly currentTaskId?: string; // The currently selected/hovered task from 
URL
+  readonly filterMode: FilterMode;
+  readonly filterRoot: string | undefined;
+  readonly onClearFilter: () => void;
+  readonly onFilterModeChange: (mode: FilterMode) => void;
+  readonly translate: (key: string) => string;
+};
+
+export const LineageFilter = ({
+  currentTaskId,
+  filterMode,
+  filterRoot,
+  onClearFilter,
+  onFilterModeChange,
+  translate,
+}: LineageFilterProps) => {
+  const isCurrentTaskTheRoot = currentTaskId === filterRoot;
+  const activeMode = isCurrentTaskTheRoot ? filterMode : "none";
+
+  const getButtonLabel = () => {
+    // Show "Lineage" when no task is selected or no filter is active
+    if (filterRoot === undefined || filterMode === "none") {
+      return translate("dag:panel.lineage.label");
+    }
+
+    // Show "task_name: filter_mode" when a filter is active
+    const modeLabels = {
+      both: translate("dag:panel.lineage.options.both"),
+      downstream: translate("dag:panel.lineage.options.downstream"),
+      none: "",
+      upstream: translate("dag:panel.lineage.options.upstream"),
+    };
+
+    return `${filterRoot}: ${modeLabels[filterMode]}`;
+  };
+
+  return (
+    <Popover.Root positioning={{ placement: "bottom-end" }}>

Review Comment:
   It would be the same as the option one, but I can change it. I have no 
strong preference.



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