parkhojeong commented on code in PR #65687:
URL: https://github.com/apache/airflow/pull/65687#discussion_r3247253173


##########
airflow-core/src/airflow/ui/src/components/DagDeactivatedBanner.tsx:
##########
@@ -0,0 +1,67 @@
+/*!
+ * 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 { Button, HStack, Text, useDisclosure } from "@chakra-ui/react";
+import { useTranslation } from "react-i18next";
+import { LuFileWarning } from "react-icons/lu";
+import { useParams } from "react-router-dom";
+
+import { useDagServiceGetDag, useImportErrorServiceGetImportErrors } from 
"openapi/queries";
+import { DagImportErrorModal } from "src/pages/Dag/DagImportErrorModal";
+
+export const DagDeactivatedBanner = () => {
+  const { t: translate } = useTranslation(["dag", "dashboard"]);
+  const { dagId = "" } = useParams();
+  const { onClose, onOpen, open } = useDisclosure();
+
+  const { data: dag } = useDagServiceGetDag({ dagId }, undefined, { enabled: 
dagId !== "" });
+  const relativeFileloc = dag?.relative_fileloc ?? "";
+
+  const { data } = useImportErrorServiceGetImportErrors({ filename: 
relativeFileloc }, undefined, {
+    enabled: dag?.is_stale && relativeFileloc.length > 0,
+  });
+
+  if (dagId === "" || !dag?.is_stale) {
+    return undefined;
+  }
+
+  const importError = data?.import_errors[0];

Review Comment:
   In multi-bundle deployments, different Dag bundles can have the same 
relative_fileloc. Should we consider this case? Otherwise this can show an 
import error from another bundle.
   
   
   Repro: seed two Dags in different bundles with the same relative_fileloc and 
matching import errors, then open the bundle_b Dag page. it can show the 
bundle_a import error 
   
   <img width="1438" height="236" alt="image" 
src="https://github.com/user-attachments/assets/7b9e0b33-4d41-49c6-a073-cf1b3f3ba824";
 />
   
   <details>
   <summary> repro.py with example_bash_operator </summary>
   
   ```
   from __future__ import annotations
   
   from datetime import datetime, timezone
   
   from airflow.models import DagModel
   from airflow.models.dagbundle import DagBundleModel
   from airflow.models.errors import ParseImportError
   from airflow.utils.session import create_session
   
   DAG_ID = "example_bash_operator"
   OTHER_DAG_ID = "repro_bundle_a_same_fileloc"
   RELATIVE_FILELOC = "same_path/stale_dag.py"
   
   with create_session() as session:
       dag = session.get(DagModel, DAG_ID)
       if dag is None:
           raise RuntimeError(f"Dag not found: {DAG_ID}")
   
       for bundle_name in ["bundle_a", "bundle_b"]:
           if session.get(DagBundleModel, bundle_name) is None:
               session.add(DagBundleModel(name=bundle_name))
       session.flush()
   
       dag.is_stale = True
       dag.bundle_name = "bundle_b"
       dag.relative_fileloc = RELATIVE_FILELOC
   
       other_dag = session.get(DagModel, OTHER_DAG_ID)
       if other_dag is None:
           other_dag = DagModel(
               dag_id=OTHER_DAG_ID,
               fileloc="/tmp/bundle_a/same_path/stale_dag.py",
               relative_fileloc=RELATIVE_FILELOC,
               bundle_name="bundle_a",
               is_stale=True,
               is_paused=False,
           )
           session.add(other_dag)
       else:
           other_dag.fileloc = "/tmp/bundle_a/same_path/stale_dag.py"
           other_dag.relative_fileloc = RELATIVE_FILELOC
           other_dag.bundle_name = "bundle_a"
           other_dag.is_stale = True
   
       session.query(ParseImportError).filter(ParseImportError.filename == 
RELATIVE_FILELOC).delete()
   
       session.add(
           ParseImportError(
               bundle_name="bundle_a",
               filename=RELATIVE_FILELOC,
               timestamp=datetime(2026, 5, 15, 12, 0, tzinfo=timezone.utc),
               stacktrace="wrong bundle error",
           )
       )
       session.add(
           ParseImportError(
               bundle_name="bundle_b",
               filename=RELATIVE_FILELOC,
               timestamp=datetime(2026, 5, 15, 12, 1, tzinfo=timezone.utc),
               stacktrace="correct bundle error",
           )
       )
   
       print(f"Open http://localhost:28080/dags/{DAG_ID}";)
   
   ```
   
   </details>



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