diff --git a/airflow-core/src/airflow/ui/src/components/Clear/Run/ClearRunDialog.tsx b/airflow-core/src/airflow/ui/src/components/Clear/Run/ClearRunDialog.tsx index 7be08d27af4bf..9f680efe65f4d 100644 --- a/airflow-core/src/airflow/ui/src/components/Clear/Run/ClearRunDialog.tsx +++ b/airflow-core/src/airflow/ui/src/components/Clear/Run/ClearRunDialog.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { Button, Flex, Heading, VStack } from "@chakra-ui/react"; +import { Button, Flex } from "@chakra-ui/react"; import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { CgRedo } from "react-icons/cg"; @@ -26,7 +26,7 @@ import type { DAGRunResponse } from "openapi/requests/types.gen"; import { ActionAccordion } from "src/components/ActionAccordion"; import { getRunOnLatestVersionState } from "src/components/Clear/TaskInstance/runOnLatestVersion"; import { useRerunWithLatestVersion } from "src/components/Clear/useRerunWithLatestVersion"; -import { Checkbox, Dialog } from "src/components/ui"; +import { Checkbox, Modal } from "src/components/ui"; import SegmentedControl from "src/components/ui/SegmentedControl"; import { useClearRunDefaultOptions } from "src/hooks/useUserSettings"; import { useClearDagRunDryRun } from "src/queries/useClearDagRunDryRun"; @@ -108,7 +108,44 @@ const ClearRunDialog = ({ dagRun, onClose, open }: Props) => { const shouldShowBundleVersionOption = shouldShowRunOnLatestOption && !onlyNew; return ( - + + {shouldShowBundleVersionOption ? ( + setRunOnLatestVersion(Boolean(event.checked))} + title={ + runOnLatestVersionForced + ? translate("dags:runAndTaskActions.options.runOnLatestVersionForced") + : undefined + } + > + {translate("dags:runAndTaskActions.options.runOnLatestVersion")} + + ) : undefined} + + } lazyMount onOpenChange={(details) => { if (!details.open) { @@ -116,85 +153,37 @@ const ClearRunDialog = ({ dagRun, onClose, open }: Props) => { } }} open={open} + title={ + <> + + {translate("dags:runAndTaskActions.clear.title", { type: translate("dagRun_one") })}:{" "} + {" "} + {dagRunId} + + } > - - - - - - {translate("dags:runAndTaskActions.clear.title", { type: translate("dagRun_one") })}:{" "} - {" "} - {dagRunId} - - - - - - - - - - - - - {shouldShowBundleVersionOption ? ( - setRunOnLatestVersion(Boolean(event.checked))} - title={ - runOnLatestVersionForced - ? translate("dags:runAndTaskActions.options.runOnLatestVersionForced") - : undefined - } - > - {translate("dags:runAndTaskActions.options.runOnLatestVersion")} - - ) : undefined} - - - - - + + + + + ); }; diff --git a/airflow-core/src/airflow/ui/src/components/Clear/TaskInstance/ClearGroupTaskInstanceDialog.tsx b/airflow-core/src/airflow/ui/src/components/Clear/TaskInstance/ClearGroupTaskInstanceDialog.tsx index aec9bd55c6656..55f97b5d11718 100644 --- a/airflow-core/src/airflow/ui/src/components/Clear/TaskInstance/ClearGroupTaskInstanceDialog.tsx +++ b/airflow-core/src/airflow/ui/src/components/Clear/TaskInstance/ClearGroupTaskInstanceDialog.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { Button, Flex, Heading, VStack } from "@chakra-ui/react"; +import { Button, Flex } from "@chakra-ui/react"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import { CgRedo } from "react-icons/cg"; @@ -30,7 +30,7 @@ import { import type { LightGridTaskInstanceSummary, TaskInstanceResponse } from "openapi/requests/types.gen"; import { ActionAccordion } from "src/components/ActionAccordion"; import { useRerunWithLatestVersion } from "src/components/Clear/useRerunWithLatestVersion"; -import { Checkbox, Dialog } from "src/components/ui"; +import { Checkbox, Modal } from "src/components/ui"; import SegmentedControl from "src/components/ui/SegmentedControl"; import { useClearTaskInstanceDefaultOptions } from "src/hooks/useUserSettings"; import { useClearTaskInstances } from "src/queries/useClearTaskInstances"; @@ -135,101 +135,90 @@ export const ClearGroupTaskInstanceDialog = ({ onClose, open, taskInstance }: Pr }; return ( - - - - - - - {translate("dags:runAndTaskActions.clear.title", { - type: translate("taskInstance", { count: affectedTasks.total_entries ?? 0 }), - })} - : - {" "} - {groupId} - - - - - - - - - + + {shouldShowRunOnLatestOption ? ( + setRunOnLatestVersion(Boolean(event.checked))} + title={ + runOnLatestVersionForced + ? translate("dags:runAndTaskActions.options.runOnLatestVersionForced") + : undefined + } > - {translate("modal.confirm")} - - - - - + {translate("dags:runAndTaskActions.options.runOnLatestVersion")} + + ) : undefined} + + } + lazyMount + onOpenChange={onClose} + open={open} + title={ + <> + {translate("dags:runAndTaskActions.clear.title", { + type: translate("taskInstance", { count: affectedTasks.total_entries ?? 0 }), + })} + : {groupId} + + } + > + + + + + ); }; diff --git a/airflow-core/src/airflow/ui/src/components/Clear/TaskInstance/ClearTaskInstanceDialog.tsx b/airflow-core/src/airflow/ui/src/components/Clear/TaskInstance/ClearTaskInstanceDialog.tsx index 074e3f2d40ae4..feeeb98e7483d 100644 --- a/airflow-core/src/airflow/ui/src/components/Clear/TaskInstance/ClearTaskInstanceDialog.tsx +++ b/airflow-core/src/airflow/ui/src/components/Clear/TaskInstance/ClearTaskInstanceDialog.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { Button, Flex, Heading, useDisclosure, VStack } from "@chakra-ui/react"; +import { Button, Flex, useDisclosure } from "@chakra-ui/react"; import { useEffect, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { CgRedo } from "react-icons/cg"; @@ -27,7 +27,7 @@ import { ActionAccordion } from "src/components/ActionAccordion"; import { taskInstanceKey } from "src/components/ActionAccordion/columns"; import { useRerunWithLatestVersion } from "src/components/Clear/useRerunWithLatestVersion"; import Time from "src/components/Time"; -import { Checkbox, Dialog } from "src/components/ui"; +import { Checkbox, Modal } from "src/components/ui"; import SegmentedControl from "src/components/ui/SegmentedControl"; import { useClearPreventRunningTaskDefault, @@ -198,108 +198,100 @@ const ClearTaskInstanceDialog = (props: Props) => { return ( <> - - - - - - - {allMapped - ? translate("dags:runAndTaskActions.clearAllMapped.title") - : translate("dags:runAndTaskActions.clear.title", { - type: translate("taskInstance_one"), - })} - : - {" "} - {allMapped ? ( - taskId - ) : ( - <> - {taskInstance?.task_display_name} - - - - - - - - - - - + + setPreventRunningTask(Boolean(event.checked))} + style={{ marginRight: "auto" }} > - {shouldShowRunOnLatestOption ? ( - setRunOnLatestVersion(Boolean(event.checked))} - title={ - runOnLatestVersionForced - ? translate("dags:runAndTaskActions.options.runOnLatestVersionForced") - : undefined - } - > - {translate("dags:runAndTaskActions.options.runOnLatestVersion")} - - ) : undefined} + {translate("dags:runAndTaskActions.options.preventRunningTasks")} + + {shouldShowRunOnLatestOption ? ( setPreventRunningTask(Boolean(event.checked))} - style={{ marginRight: "auto" }} + checked={runOnLatestVersionForced || runOnLatestVersion} + disabled={runOnLatestVersionForced} + onCheckedChange={(event) => setRunOnLatestVersion(Boolean(event.checked))} + title={ + runOnLatestVersionForced + ? translate("dags:runAndTaskActions.options.runOnLatestVersionForced") + : undefined + } > - {translate("dags:runAndTaskActions.options.preventRunningTasks")} + {translate("dags:runAndTaskActions.options.runOnLatestVersion")} - - - - - + ) : undefined} + + } + lazyMount + onOpenChange={onCloseDialog} + open={openDialog ? !open : false} + title={ + <> + + {allMapped + ? translate("dags:runAndTaskActions.clearAllMapped.title") + : translate("dags:runAndTaskActions.clear.title", { + type: translate("taskInstance_one"), + })} + : + {" "} + {allMapped ? ( + taskId + ) : ( + <> + {taskInstance?.task_display_name}