You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "dheerajturaga (via GitHub)" <gi...@apache.org> on 2025/09/15 18:16:04 UTC

[PR] Add delete button for dag runs in more options menu [airflow]

dheerajturaga opened a new pull request, #55696:
URL: https://github.com/apache/airflow/pull/55696

   - Add 'more options' hamburger menu button next to 'Mark Dag Run as' dropdown in dag run header
   - Move delete functionality into the more options menu following the same pattern as dag header
   - Update DeleteRunButton styling to match delete dag button theme (remove solid variant, add Box wrapper)
   - Add conditional navigation: only navigate to /dags/<dag_id>/runs when deleting from specific run detail page
   
   <img width="1910" height="747" alt="image" src="https://github.com/user-attachments/assets/92434524-fdd0-4c01-a251-0fcde8af8ace" />
   
   <img width="1917" height="737" alt="image" src="https://github.com/user-attachments/assets/6704aa62-ebda-4072-8841-0d92c51df65a" />
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add delete button for dag runs in more options menu [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #55696:
URL: https://github.com/apache/airflow/pull/55696#discussion_r2350144883


##########
airflow-core/src/airflow/ui/src/pages/Run/Header.tsx:
##########
@@ -90,6 +92,22 @@ export const Header = ({
             />
             <ClearRunButton dagRun={dagRun} isHotkeyEnabled withText={containerWidth > 700} />
             <MarkRunAsButton dagRun={dagRun} isHotkeyEnabled withText={containerWidth > 700} />
+            <Menu.Root>
+              <Menu.Trigger asChild>
+                <Button aria-label={translate("dag:header.buttons.advanced")} variant="outline">
+                  <LuMenu />
+                </Button>
+              </Menu.Trigger>
+              <Portal>
+                <Menu.Positioner>
+                  <Menu.Content>
+                    <Menu.Item closeOnSelect={false} value="delete">
+                      <DeleteRunButton dagRun={dagRun} width="100%" withText={true} />

Review Comment:
   Why not put the Box here instead?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add delete button for dag runs in more options menu [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #55696:
URL: https://github.com/apache/airflow/pull/55696#discussion_r2350143626


##########
airflow-core/src/airflow/ui/src/pages/DeleteRunButton.tsx:
##########
@@ -28,29 +29,36 @@ import { useDeleteDagRun } from "src/queries/useDeleteDagRun";
 type DeleteRunButtonProps = {
   readonly dagRun: DAGRunResponse;
   readonly withText?: boolean;
-};
+} & ButtonProps;
 
-const DeleteRunButton = ({ dagRun, withText = true }: DeleteRunButtonProps) => {
+const DeleteRunButton = ({ dagRun, width, withText = true }: DeleteRunButtonProps) => {
   const { onClose, onOpen, open } = useDisclosure();
+  const navigate = useNavigate();
+  const location = useLocation();
   const { t: translate } = useTranslation();
 
+  const isOnRunDetailPage = location.pathname.includes(`/dags/${dagRun.dag_id}/runs/${dagRun.dag_run_id}`);
+
   const { isPending, mutate: deleteDagRun } = useDeleteDagRun({
     dagId: dagRun.dag_id,
     dagRunId: dagRun.dag_run_id,
     onSuccessConfirm: () => {
       onClose();
+      if (isOnRunDetailPage) {
+        navigate(`/dags/${dagRun.dag_id}/runs`);
+      }
     },
   });
 
   return (
-    <>
+    <Box width={width}>

Review Comment:
   I feel like we should set button width via `...props` and set the box width only inside the menu created in Header.tsx



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add delete button for dag runs in more options menu [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #55696:
URL: https://github.com/apache/airflow/pull/55696#discussion_r2350143626


##########
airflow-core/src/airflow/ui/src/pages/DeleteRunButton.tsx:
##########
@@ -28,29 +29,36 @@ import { useDeleteDagRun } from "src/queries/useDeleteDagRun";
 type DeleteRunButtonProps = {
   readonly dagRun: DAGRunResponse;
   readonly withText?: boolean;
-};
+} & ButtonProps;
 
-const DeleteRunButton = ({ dagRun, withText = true }: DeleteRunButtonProps) => {
+const DeleteRunButton = ({ dagRun, width, withText = true }: DeleteRunButtonProps) => {
   const { onClose, onOpen, open } = useDisclosure();
+  const navigate = useNavigate();
+  const location = useLocation();
   const { t: translate } = useTranslation();
 
+  const isOnRunDetailPage = location.pathname.includes(`/dags/${dagRun.dag_id}/runs/${dagRun.dag_run_id}`);
+
   const { isPending, mutate: deleteDagRun } = useDeleteDagRun({
     dagId: dagRun.dag_id,
     dagRunId: dagRun.dag_run_id,
     onSuccessConfirm: () => {
       onClose();
+      if (isOnRunDetailPage) {
+        navigate(`/dags/${dagRun.dag_id}/runs`);
+      }
     },
   });
 
   return (
-    <>
+    <Box width={width}>

Review Comment:
   I feel like we should width to the button via `...props` and set the box width only inside the menu created in Header.tsx



##########
airflow-core/src/airflow/ui/src/pages/DeleteRunButton.tsx:
##########
@@ -28,29 +29,36 @@ import { useDeleteDagRun } from "src/queries/useDeleteDagRun";
 type DeleteRunButtonProps = {
   readonly dagRun: DAGRunResponse;
   readonly withText?: boolean;
-};
+} & ButtonProps;
 
-const DeleteRunButton = ({ dagRun, withText = true }: DeleteRunButtonProps) => {
+const DeleteRunButton = ({ dagRun, width, withText = true }: DeleteRunButtonProps) => {
   const { onClose, onOpen, open } = useDisclosure();
+  const navigate = useNavigate();
+  const location = useLocation();
   const { t: translate } = useTranslation();
 
+  const isOnRunDetailPage = location.pathname.includes(`/dags/${dagRun.dag_id}/runs/${dagRun.dag_run_id}`);
+
   const { isPending, mutate: deleteDagRun } = useDeleteDagRun({
     dagId: dagRun.dag_id,
     dagRunId: dagRun.dag_run_id,
     onSuccessConfirm: () => {
       onClose();
+      if (isOnRunDetailPage) {
+        navigate(`/dags/${dagRun.dag_id}/runs`);
+      }
     },
   });
 
   return (
-    <>
+    <Box width={width}>

Review Comment:
   I feel like we should set the width to the button via `...props` and set the box width only inside the menu created in Header.tsx



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add delete button for dag runs in more options menu [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #55696:
URL: https://github.com/apache/airflow/pull/55696#discussion_r2353296187


##########
airflow-core/src/airflow/ui/src/pages/DeleteRunButton.tsx:
##########
@@ -50,7 +58,7 @@ const DeleteRunButton = ({ dagRun, withText = true }: DeleteRunButtonProps) => {
         icon={<FiTrash2 />}
         onClick={onOpen}
         text={translate("dags:runAndTaskActions.delete.button", { type: translate("dagRun_one") })}
-        variant="solid"
+        width={width}
         withText={withText}

Review Comment:
   ```suggestion
           withText={withText}
           {...rest}
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add delete button for dag runs in more options menu [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #55696:
URL: https://github.com/apache/airflow/pull/55696#discussion_r2353297937


##########
airflow-core/src/airflow/ui/src/pages/DeleteRunButton.tsx:
##########
@@ -50,7 +58,7 @@ const DeleteRunButton = ({ dagRun, withText = true }: DeleteRunButtonProps) => {
         icon={<FiTrash2 />}
         onClick={onOpen}
         text={translate("dags:runAndTaskActions.delete.button", { type: translate("dagRun_one") })}
-        variant="solid"
+        width={width}
         withText={withText}

Review Comment:
   Can we make sure that the variant is respected over in DagRuns.tsx?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add delete button for dag runs in more options menu [airflow]

Posted by "dheerajturaga (via GitHub)" <gi...@apache.org>.
dheerajturaga commented on code in PR #55696:
URL: https://github.com/apache/airflow/pull/55696#discussion_r2357517029


##########
airflow-core/src/airflow/ui/src/pages/DeleteRunButton.tsx:
##########
@@ -50,7 +58,7 @@ const DeleteRunButton = ({ dagRun, withText = true }: DeleteRunButtonProps) => {
         icon={<FiTrash2 />}
         onClick={onOpen}
         text={translate("dags:runAndTaskActions.delete.button", { type: translate("dagRun_one") })}
-        variant="solid"
+        width={width}
         withText={withText}

Review Comment:
   Done!



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add delete button for dag runs in more options menu [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #55696:
URL: https://github.com/apache/airflow/pull/55696#discussion_r2353295666


##########
airflow-core/src/airflow/ui/src/pages/DeleteRunButton.tsx:
##########
@@ -28,17 +29,24 @@ import { useDeleteDagRun } from "src/queries/useDeleteDagRun";
 type DeleteRunButtonProps = {
   readonly dagRun: DAGRunResponse;
   readonly withText?: boolean;
-};
+} & ButtonProps;
 
-const DeleteRunButton = ({ dagRun, withText = true }: DeleteRunButtonProps) => {
+const DeleteRunButton = ({ dagRun, width, withText = true }: DeleteRunButtonProps) => {

Review Comment:
   ```suggestion
   const DeleteRunButton = ({ dagRun, withText = true, ...rest }: DeleteRunButtonProps) => {
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add delete button for dag runs in more options menu [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi merged PR #55696:
URL: https://github.com/apache/airflow/pull/55696


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add delete button for dag runs in more options menu [airflow]

Posted by "dheerajturaga (via GitHub)" <gi...@apache.org>.
dheerajturaga commented on code in PR #55696:
URL: https://github.com/apache/airflow/pull/55696#discussion_r2356229856


##########
airflow-core/src/airflow/ui/src/pages/DeleteRunButton.tsx:
##########
@@ -28,17 +29,24 @@ import { useDeleteDagRun } from "src/queries/useDeleteDagRun";
 type DeleteRunButtonProps = {
   readonly dagRun: DAGRunResponse;
   readonly withText?: boolean;
-};
+} & ButtonProps;
 
-const DeleteRunButton = ({ dagRun, withText = true }: DeleteRunButtonProps) => {
+const DeleteRunButton = ({ dagRun, width, withText = true }: DeleteRunButtonProps) => {

Review Comment:
   Done!



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add delete button for dag runs in more options menu [airflow]

Posted by "dheerajturaga (via GitHub)" <gi...@apache.org>.
dheerajturaga commented on code in PR #55696:
URL: https://github.com/apache/airflow/pull/55696#discussion_r2352779626


##########
airflow-core/src/airflow/ui/src/pages/DeleteRunButton.tsx:
##########
@@ -28,29 +29,36 @@ import { useDeleteDagRun } from "src/queries/useDeleteDagRun";
 type DeleteRunButtonProps = {
   readonly dagRun: DAGRunResponse;
   readonly withText?: boolean;
-};
+} & ButtonProps;
 
-const DeleteRunButton = ({ dagRun, withText = true }: DeleteRunButtonProps) => {
+const DeleteRunButton = ({ dagRun, width, withText = true }: DeleteRunButtonProps) => {
   const { onClose, onOpen, open } = useDisclosure();
+  const navigate = useNavigate();
+  const location = useLocation();
   const { t: translate } = useTranslation();
 
+  const isOnRunDetailPage = location.pathname.includes(`/dags/${dagRun.dag_id}/runs/${dagRun.dag_run_id}`);
+
   const { isPending, mutate: deleteDagRun } = useDeleteDagRun({
     dagId: dagRun.dag_id,
     dagRunId: dagRun.dag_run_id,
     onSuccessConfirm: () => {
       onClose();
+      if (isOnRunDetailPage) {
+        navigate(`/dags/${dagRun.dag_id}/runs`);
+      }
     },
   });
 
   return (
-    <>
+    <Box width={width}>

Review Comment:
   Let me know if the current changes are satisfactory



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add delete button for dag runs in more options menu [airflow]

Posted by "dheerajturaga (via GitHub)" <gi...@apache.org>.
dheerajturaga commented on code in PR #55696:
URL: https://github.com/apache/airflow/pull/55696#discussion_r2352777613


##########
airflow-core/src/airflow/ui/src/pages/Run/Header.tsx:
##########
@@ -90,6 +92,22 @@ export const Header = ({
             />
             <ClearRunButton dagRun={dagRun} isHotkeyEnabled withText={containerWidth > 700} />
             <MarkRunAsButton dagRun={dagRun} isHotkeyEnabled withText={containerWidth > 700} />
+            <Menu.Root>
+              <Menu.Trigger asChild>
+                <Button aria-label={translate("dag:header.buttons.advanced")} variant="outline">
+                  <LuMenu />
+                </Button>
+              </Menu.Trigger>
+              <Portal>
+                <Menu.Positioner>
+                  <Menu.Content>
+                    <Menu.Item closeOnSelect={false} value="delete">
+                      <DeleteRunButton dagRun={dagRun} width="100%" withText={true} />

Review Comment:
   Done



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org