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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]