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


##########
airflow-core/src/airflow/ui/src/hooks/useLineageFilter.ts:
##########
@@ -0,0 +1,89 @@
+/*!
+ * 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 { useEffect, useRef } from "react";
+import { useLocalStorage } from "usehooks-ts";
+
+import type { FilterMode } from "src/layouts/Details/LineageFilter";
+
+type UseLineageFilterProps = {
+  readonly dagId: string;
+  readonly taskId?: string;
+};
+
+type UseLineageFilterReturn = {
+  readonly handleClearLineageFilter: () => void;

Review Comment:
   We can remove clear and instead just call something like 
`setFilter(undefined`)



##########
airflow-core/src/airflow/ui/src/layouts/Details/Grid/Grid.tsx:
##########
@@ -77,6 +90,46 @@ export const Grid = ({ dagRunState, limit, runType, 
showGantt, triggeringUser }:
     triggeringUser,
   });
 
+  const selectedVersion = useSelectedVersion();
+
+  // Fetch lineage-filtered structure when filter is active
+  const { data: lineageStructure } = useStructureServiceStructureData(
+    {
+      dagId,
+      externalDependencies: false,
+      includeDownstream: filterMode === "downstream" || filterMode === "both",
+      includeUpstream: filterMode === "upstream" || filterMode === "both",
+      root: filterMode !== "none" && filterRoot !== undefined ? filterRoot : 
undefined,
+      versionNumber: selectedVersion,
+    },
+    undefined,
+    {
+      enabled: selectedVersion !== undefined && filterMode !== "none" && 
filterRoot !== undefined,
+    },
+  );
+
+  // Extract allowed task IDs from lineage structure when filter is active
+  const allowedTaskIds = useMemo(() => {
+    if (filterMode === "none" || filterRoot === undefined || lineageStructure 
=== undefined) {
+      return undefined;
+    }
+
+    const taskIds = new Set<string>();
+
+    lineageStructure.nodes.forEach((node) => {
+      const addNodeAndChildren = (currentNode: typeof node) => {
+        taskIds.add(currentNode.id);
+        if (currentNode.children) {
+          currentNode.children.forEach((child) => addNodeAndChildren(child));
+        }
+      };
+
+      addNodeAndChildren(node);

Review Comment:
   If we want to make this a function, then we should declare it outside of the 
forEach loop.



##########
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:
   Is there any reason we're doing this as a popover instead of using the 
existing Menu dropdown component? https://www.chakra-ui.com/docs/components/menu



##########
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" }}>
+      <Popover.Trigger asChild>
+        <Button bg="bg.subtle" color="fg.default" size="sm" variant="outline">

Review Comment:
   I don't think we need to specifically declare "fg.default"?



##########
airflow-core/src/airflow/ui/src/layouts/Details/Grid/Grid.tsx:
##########
@@ -77,6 +90,46 @@ export const Grid = ({ dagRunState, limit, runType, 
showGantt, triggeringUser }:
     triggeringUser,
   });
 
+  const selectedVersion = useSelectedVersion();
+
+  // Fetch lineage-filtered structure when filter is active
+  const { data: lineageStructure } = useStructureServiceStructureData(

Review Comment:
   I am wary about fetching all of the tasks a second time and then iterating 
through them all again on the frontend. Ideally we can just add root, 
filterUpstream, and filterDownstream onto the existing grid structure endpoint. 
But that can be in another PR I suppose.



##########
airflow-core/src/airflow/ui/src/layouts/Details/PanelButtons.tsx:
##########
@@ -259,6 +269,14 @@ export const PanelButtons = ({
         </ButtonGroup>
         <Flex alignItems="center" gap={1} justifyContent="space-between" 
pl={2} pr={6}>
           <ToggleGroups />
+          <LineageFilter
+            currentTaskId={taskId}
+            filterMode={lineageFilterMode}
+            filterRoot={lineageFilterRoot}
+            onClearFilter={onClearLineageFilter}
+            onFilterModeChange={setLineageFilterMode}
+            translate={translate}

Review Comment:
   Let's just call `useTranslate` in the component instead of passing the 
translate function.



##########
airflow-core/src/airflow/ui/src/layouts/Details/Graph/Graph.tsx:
##########
@@ -84,6 +102,9 @@ export const Graph = () => {
     {
       dagId,
       externalDependencies: dependencies === "immediate",
+      includeDownstream: filterMode === "downstream" || filterMode === "both",
+      includeUpstream: filterMode === "upstream" || filterMode === "both",
+      root: filterMode !== "none" && filterRoot !== undefined ? filterRoot : 
undefined,

Review Comment:
   Instead of a filterMode enum and filterRoot value of "none", let's just have 
variables that directly map to these parameters.
   
   includeUpstream: bool
   includeDownstream: bool
   root: string | undefined
    
    



##########
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" }}>
+      <Popover.Trigger asChild>
+        <Button bg="bg.subtle" color="fg.default" size="sm" variant="outline">
+          <FiFilter />
+          {getButtonLabel()}
+          <FiChevronDown size={8} />
+        </Button>
+      </Popover.Trigger>
+      <Portal>
+        <Popover.Positioner>
+          <Popover.Content>
+            <Popover.Arrow />
+            <Popover.Body display="flex" flexDirection="column" gap={2} p={3}>
+              <VStack align="start" gap={2}>
+                <Text fontSize="sm" fontWeight="semibold">
+                  {translate("dag:panel.lineage.label")}
+                </Text>
+
+                {filterRoot !== undefined && filterMode !== "none" ? (
+                  <Text color="blue.600" fontSize="xs" fontWeight="medium">

Review Comment:
   ```suggestion
                     <Text color="brand.solid" fontSize="xs" 
fontWeight="medium">
   ```



##########
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" }}>
+      <Popover.Trigger asChild>
+        <Button bg="bg.subtle" color="fg.default" size="sm" variant="outline">
+          <FiFilter />
+          {getButtonLabel()}
+          <FiChevronDown size={8} />
+        </Button>
+      </Popover.Trigger>
+      <Portal>
+        <Popover.Positioner>
+          <Popover.Content>
+            <Popover.Arrow />
+            <Popover.Body display="flex" flexDirection="column" gap={2} p={3}>
+              <VStack align="start" gap={2}>
+                <Text fontSize="sm" fontWeight="semibold">
+                  {translate("dag:panel.lineage.label")}
+                </Text>
+
+                {filterRoot !== undefined && filterMode !== "none" ? (
+                  <Text color="blue.600" fontSize="xs" fontWeight="medium">
+                    {translate("dag:panel.lineage.activeFilter")}: 
{filterRoot} -{" "}
+                    {filterMode === "upstream"
+                      ? translate("dag:panel.lineage.options.upstream")
+                      : filterMode === "downstream"
+                        ? translate("dag:panel.lineage.options.downstream")
+                        : translate("dag:panel.lineage.options.both")}
+                  </Text>
+                ) : undefined}
+
+                {currentTaskId === undefined ? undefined : (
+                  <Text color="fg.muted" fontSize="xs">
+                    {translate("dag:panel.lineage.selectedTask")}: 
<strong>{currentTaskId}</strong>
+                  </Text>
+                )}
+
+                {currentTaskId === undefined ? (
+                  <Text color="fg.muted" fontSize="xs">
+                    {translate("dag:panel.lineage.clickTask")}
+                  </Text>
+                ) : undefined}

Review Comment:
   We can combine these two ternary statements



##########
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" }}>
+      <Popover.Trigger asChild>
+        <Button bg="bg.subtle" color="fg.default" size="sm" variant="outline">
+          <FiFilter />
+          {getButtonLabel()}
+          <FiChevronDown size={8} />
+        </Button>
+      </Popover.Trigger>
+      <Portal>
+        <Popover.Positioner>
+          <Popover.Content>
+            <Popover.Arrow />
+            <Popover.Body display="flex" flexDirection="column" gap={2} p={3}>
+              <VStack align="start" gap={2}>
+                <Text fontSize="sm" fontWeight="semibold">
+                  {translate("dag:panel.lineage.label")}
+                </Text>
+
+                {filterRoot !== undefined && filterMode !== "none" ? (
+                  <Text color="blue.600" fontSize="xs" fontWeight="medium">
+                    {translate("dag:panel.lineage.activeFilter")}: 
{filterRoot} -{" "}
+                    {filterMode === "upstream"
+                      ? translate("dag:panel.lineage.options.upstream")
+                      : filterMode === "downstream"
+                        ? translate("dag:panel.lineage.options.downstream")
+                        : translate("dag:panel.lineage.options.both")}
+                  </Text>
+                ) : undefined}
+
+                {currentTaskId === undefined ? undefined : (
+                  <Text color="fg.muted" fontSize="xs">
+                    {translate("dag:panel.lineage.selectedTask")}: 
<strong>{currentTaskId}</strong>
+                  </Text>
+                )}
+
+                {currentTaskId === undefined ? (
+                  <Text color="fg.muted" fontSize="xs">
+                    {translate("dag:panel.lineage.clickTask")}
+                  </Text>
+                ) : undefined}
+
+                <VStack align="stretch" gap={1} width="100%">
+                  <Button
+                    colorPalette={activeMode === "upstream" ? "blue" : "gray"}
+                    disabled={currentTaskId === undefined}
+                    justifyContent="flex-start"
+                    onClick={() => onFilterModeChange("upstream")}
+                    size="sm"
+                    variant={activeMode === "upstream" ? "solid" : "ghost"}
+                    width="100%"
+                  >
+                    {translate("dag:panel.lineage.options.upstream")}
+                  </Button>
+
+                  <Button
+                    colorPalette={activeMode === "downstream" ? "blue" : 
"gray"}
+                    disabled={currentTaskId === undefined}
+                    justifyContent="flex-start"
+                    onClick={() => onFilterModeChange("downstream")}
+                    size="sm"
+                    variant={activeMode === "downstream" ? "solid" : "ghost"}
+                    width="100%"
+                  >
+                    {translate("dag:panel.lineage.options.downstream")}
+                  </Button>
+
+                  <Button
+                    colorPalette={activeMode === "both" ? "blue" : "gray"}
+                    disabled={currentTaskId === undefined}
+                    justifyContent="flex-start"
+                    onClick={() => onFilterModeChange("both")}
+                    size="sm"
+                    variant={activeMode === "both" ? "solid" : "ghost"}
+                    width="100%"
+                  >
+                    {translate("dag:panel.lineage.options.both")}
+                  </Button>
+                </VStack>
+
+                {filterMode !== "none" && filterRoot !== undefined ? (
+                  <Button
+                    colorPalette="red"

Review Comment:
   ```suggestion
   ```
   
   We don't use red for other filter clearing.



##########
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 = () => {

Review Comment:
   There is no need for this to be a function. These can just be calculated 
variables.



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