Skip to content

Move Dag, run and TI into common.json #51622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const ActionAccordion = ({ affectedTasks, note, setNote }: Props) => {
<Accordion.Item key="tasks" value="tasks">
<Accordion.ItemTrigger>
<Text fontWeight="bold">
{translate("dags:runAndTaskActions.clear.dialog.affectedTasks.title", {
{translate("dags:runAndTaskActions.affectedTasks.title", {
count: affectedTasks.total_entries,
})}
</Text>
Expand All @@ -62,7 +62,7 @@ const ActionAccordion = ({ affectedTasks, note, setNote }: Props) => {
data={affectedTasks.task_instances}
displayMode="table"
modelName={translate("common:taskInstance_other")}
noRowsMessage={translate("dags:runAndTaskActions.clear.dialog.affectedTasks.noItemsFound")}
noRowsMessage={translate("dags:runAndTaskActions.affectedTasks.noItemsFound")}
total={affectedTasks.total_entries}
/>
</Box>
Expand All @@ -71,7 +71,7 @@ const ActionAccordion = ({ affectedTasks, note, setNote }: Props) => {
) : undefined}
<Accordion.Item key="note" value="note">
<Accordion.ItemTrigger>
<Text fontWeight="bold">{translate("dags:runAndTaskActions.clear.dialog.note.title")}</Text>
<Text fontWeight="bold">{translate("note.label")}</Text>
</Accordion.ItemTrigger>
<Accordion.ItemContent>
<Editable.Root
Expand All @@ -90,16 +90,14 @@ const ActionAccordion = ({ affectedTasks, note, setNote }: Props) => {
{Boolean(note) ? (
<ReactMarkdown>{note}</ReactMarkdown>
) : (
<Text color="fg.subtle">
{translate("dags:runAndTaskActions.clear.dialog.note.placeholder")}
</Text>
<Text color="fg.subtle">{translate("note.placeholder")}</Text>
)}
</Editable.Preview>
<Editable.Textarea
data-testid="notes-input"
height="200px"
overflowY="auto"
placeholder={translate("dags:runAndTaskActions.clear.dialog.note.placeholder")}
placeholder={translate("note.placeholder")}
resize="none"
/>
</Editable.Root>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { StateBadge } from "src/components/StateBadge";
export const getColumns = (translate: TFunction): Array<MetaColumn<TaskInstanceResponse>> => [
{
accessorKey: "task_id",
header: translate("dags:runAndTaskActions.clear.dialog.affectedTasks.columns.taskId"),
header: translate("taskId"),
size: 200,
},
{
Expand All @@ -35,14 +35,14 @@ export const getColumns = (translate: TFunction): Array<MetaColumn<TaskInstanceR
original: { state },
},
}) => <StateBadge state={state}>{translate(`common:states.${state}`)}</StateBadge>,
header: translate("dags:runAndTaskActions.clear.dialog.affectedTasks.columns.state"),
header: translate("state"),
},
{
accessorKey: "map_index",
header: translate("common:mapIndex"),
header: translate("mapIndex"),
},
{
accessorKey: "run_id",
header: translate("dags:runAndTaskActions.clear.dialog.affectedTasks.columns.runId"),
header: translate("runId"),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ const ClearRunDialog = ({ dagRun, onClose, open }: Props) => {
<Dialog.Header>
<VStack align="start" gap={4}>
<Heading size="xl">
<strong>{translate("dags:runAndTaskActions.clear.dialog.title", { type: "Run" })}: </strong>{" "}
{dagRunId}
<strong>{translate("dags:runAndTaskActions.clear.title", { type: "Run" })}: </strong> {dagRunId}
</Heading>
</VStack>
</Dialog.Header>
Expand All @@ -83,16 +82,16 @@ const ClearRunDialog = ({ dagRun, onClose, open }: Props) => {
onChange={setSelectedOptions}
options={[
{
label: translate("dags:runAndTaskActions.clear.dialog.options.existingTasks"),
label: translate("dags:runAndTaskActions.options.existingTasks"),
value: "existingTasks",
},
{
label: translate("dags:runAndTaskActions.clear.dialog.options.onlyFailed"),
label: translate("dags:runAndTaskActions.options.onlyFailed"),
value: "onlyFailed",
},
{
disabled: true,
label: translate("dags:runAndTaskActions.clear.dialog.options.queueNew"),
label: translate("dags:runAndTaskActions.options.queueNew"),
value: "new_tasks",
},
]}
Expand All @@ -119,7 +118,7 @@ const ClearRunDialog = ({ dagRun, onClose, open }: Props) => {
}
}}
>
<CgRedo /> {translate("dags:runAndTaskActions.clear.dialog.confirm")}
<CgRedo /> {translate("modal.confirm")}
</Button>
</Flex>
</Dialog.Body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,24 @@ const ClearTaskInstanceDialog = ({ onClose, open, taskInstance }: Props) => {
options={[
{
disabled: taskInstance.logical_date === null,
label: translate("dags:runAndTaskActions.clear.dialog.options.past"),
label: translate("dags:runAndTaskActions.options.past"),
value: "past",
},
{
disabled: taskInstance.logical_date === null,
label: translate("dags:runAndTaskActions.clear.dialog.options.future"),
label: translate("dags:runAndTaskActions.options.future"),
value: "future",
},
{
label: translate("dags:runAndTaskActions.clear.dialog.options.upstream"),
label: translate("dags:runAndTaskActions.options.upstream"),
value: "upstream",
},
{
label: translate("dags:runAndTaskActions.clear.dialog.options.downstream"),
label: translate("dags:runAndTaskActions.options.downstream"),
value: "downstream",
},
{
label: translate("dags:runAndTaskActions.clear.dialog.options.onlyFailed"),
label: translate("dags:runAndTaskActions.options.onlyFailed"),
value: "onlyFailed",
},
]}
Expand Down Expand Up @@ -166,7 +166,7 @@ const ClearTaskInstanceDialog = ({ onClose, open, taskInstance }: Props) => {
}
}}
>
<CgRedo /> {translate("dags:runAndTaskActions.clear.dialog.confirm")}
<CgRedo /> {translate("modal.confirm")}
</Button>
</Flex>
</Dialog.Body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const DurationChart = ({
readonly entries: Array<RunResponse> | undefined;
readonly kind: "Dag Run" | "Task Instance";
}) => {
const { t: translate } = useTranslation("components");
const { t: translate } = useTranslation(["components", "common"]);
const navigate = useNavigate();

if (!entries) {
Expand Down Expand Up @@ -193,10 +193,10 @@ export const DurationChart = ({
ticks: {
maxTicksLimit: 3,
},
title: { align: "end", display: true, text: translate("durationChart.runAfter") },
title: { align: "end", display: true, text: translate("dagRun.runAfter") },
},
y: {
title: { align: "end", display: true, text: translate("durationChart.duration") },
title: { align: "end", display: true, text: translate("duration") },
},
},
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const MarkRunAsDialog = ({ dagRun, onClose, open, state }: Props) => {
<Dialog.Header>
<VStack align="start" gap={4}>
<Heading size="xl">
{translate("dags:runAndTaskActions.markAs.dialog.title", { state, type: "Run" })}: {dagRunId}{" "}
{translate("dags:runAndTaskActions.markAs.title", { state, type: "Run" })}: {dagRunId}{" "}
<StateBadge state={state} />
</Heading>
</VStack>
Expand All @@ -69,7 +69,7 @@ const MarkRunAsDialog = ({ dagRun, onClose, open, state }: Props) => {
});
}}
>
{translate("dags:runAndTaskActions.markAs.dialog.confirm")}
{translate("modal.confirm")}
</Button>
</Flex>
</Dialog.Body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const MarkTaskInstanceAsDialog = ({ onClose, open, state, taskInstance }: Props)
<VStack align="start" gap={4}>
<Heading size="xl">
<strong>
{translate("dags:runAndTaskActions.markAs.dialog.title", { state, type: "Task Instance" })}:
{translate("dags:runAndTaskActions.markAs.title", { state, type: "Task Instance" })}:
</strong>{" "}
{taskInstance.task_display_name} <Time datetime={taskInstance.start_date} />{" "}
<StateBadge state={state} />
Expand All @@ -108,20 +108,20 @@ const MarkTaskInstanceAsDialog = ({ onClose, open, state, taskInstance }: Props)
options={[
{
disabled: taskInstance.logical_date === null,
label: translate("dags:runAndTaskActions.markAs.dialog.options.past"),
label: translate("dags:runAndTaskActions.options.past"),
value: "past",
},
{
disabled: taskInstance.logical_date === null,
label: translate("dags:runAndTaskActions.markAs.dialog.options.future"),
label: translate("dags:runAndTaskActions.options.future"),
value: "future",
},
{
label: translate("dags:runAndTaskActions.markAs.dialog.options.upstream"),
label: translate("dags:runAndTaskActions.options.upstream"),
value: "upstream",
},
{
label: translate("dags:runAndTaskActions.markAs.dialog.options.downstream"),
label: translate("dags:runAndTaskActions.options.downstream"),
value: "downstream",
},
]}
Expand Down Expand Up @@ -149,7 +149,7 @@ const MarkTaskInstanceAsDialog = ({ onClose, open, state, taskInstance }: Props)
});
}}
>
{translate("dags:runAndTaskActions.markAs.dialog.confirm")}
{translate("modal.confirm")}
</Button>
</Flex>
</Dialog.Body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe("Test SearchBar", () => {

const input = screen.getByTestId("search-dags");

expect(screen.getByText("list.advancedSearch")).toBeDefined();
expect(screen.getByText("search.advanced")).toBeDefined();
expect(screen.queryByTestId("clear-search")).toBeNull();

fireEvent.change(input, { target: { value: "search" } });
Expand Down
11 changes: 8 additions & 3 deletions airflow-core/src/airflow/ui/src/components/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const SearchBar = ({
<>
{Boolean(value) ? (
<CloseButton
aria-label={translate("list.clearSearch")}
aria-label={translate("search.clear")}
colorPalette="gray"
data-testid="clear-search"
onClick={() => {
Expand All @@ -86,10 +86,15 @@ export const SearchBar = ({
) : undefined}
{Boolean(hideAdvanced) ? undefined : (
<Button fontWeight="normal" height="1.75rem" variant="ghost" width={140} {...buttonProps}>
{translate("list.advancedSearch")}
{translate("search.advanced")}
</Button>
)}
{!hotkeyDisabled && <Kbd size="sm">{metaKey}+K</Kbd>}
{!hotkeyDisabled && (
<Kbd size="sm">
{metaKey}
{translate("search.hotkey")}
</Kbd>
)}
</>
}
startElement={<FiSearch />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const SearchDags = ({
}: {
readonly setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
}) => {
const { t: translate } = useTranslation("components");
const { t: translate } = useTranslation("dags");
const queryClient = useQueryClient();
const navigate = useNavigate();
const SEARCH_LIMIT = 10;
Expand Down Expand Up @@ -86,7 +86,7 @@ export const SearchDags = ({
loadOptions={searchDagDebounced}
menuIsOpen
onChange={onSelect}
placeholder={translate("searchDags.placeholder")}
placeholder={translate("search.dags")}
// eslint-disable-next-line unicorn/no-null
value={null} // null is required https://github.com/JedWatson/react-select/issues/3066
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { getMetaKey } from "src/utils";
import { SearchDags } from "./SearchDags";

export const SearchDagsButton = () => {
const { t: translate } = useTranslation("components");
const { t: translate } = useTranslation("dags");
const [isOpen, setIsOpen] = useState(false);
const metaKey = getMetaKey();

Expand All @@ -48,10 +48,10 @@ export const SearchDagsButton = () => {
return (
<Box>
<Button justifyContent="flex-start" onClick={() => setIsOpen(true)} variant="subtle" w={200}>
<MdSearch /> {translate("searchDags.button")}{" "}
<MdSearch /> {translate("search.dags")}{" "}
<Kbd size="sm">
{metaKey}
{translate("searchDags.hotkey")}
{translate("search.hotkey")}
</Kbd>
</Button>
<Dialog.Root onOpenChange={onOpenChange} open={isOpen} size="sm">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ type Props = {

const TriggerDAGButton: React.FC<Props> = ({ dag, withText = true }) => {
const { onClose, onOpen, open } = useDisclosure();
const { t: translate } = useTranslation("dags");
const { t: translate } = useTranslation("components");

return (
<Box>
<ActionButton
actionName={translate("dagActions.trigger.triggerDag")}
actionName={translate("triggerDag.title")}
colorPalette="blue"
icon={<FiPlay />}
onClick={onOpen}
text={translate("dagActions.trigger.button")}
text={translate("triggerDag.button")}
variant="solid"
withText={withText}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export type DagRunTriggerParams = {
};

const TriggerDAGForm = ({ dagDisplayName, dagId, isPaused, onClose, open }: TriggerDAGFormProps) => {
const { t: translate } = useTranslation("components");
const { t: translate } = useTranslation(["common", "components"]);
const [errors, setErrors] = useState<{ conf?: string; date?: unknown }>({});
const [formError, setFormError] = useState(false);
const initialParamsDict = useDagParams(dagId, open);
Expand Down Expand Up @@ -112,7 +112,7 @@ const TriggerDAGForm = ({ dagDisplayName, dagId, isPaused, onClose, open }: Trig
<Field.Root invalid={Boolean(errors.date)} orientation="horizontal">
<Stack>
<Field.Label fontSize="md" style={{ flexBasis: "30%" }}>
{translate("triggerDag.logicalDate")}
{translate("logicalDate")}
</Field.Label>
</Stack>
<Stack css={{ flexBasis: "70%" }}>
Expand All @@ -129,12 +129,12 @@ const TriggerDAGForm = ({ dagDisplayName, dagId, isPaused, onClose, open }: Trig
<Field.Root mt={6} orientation="horizontal">
<Stack>
<Field.Label fontSize="md" style={{ flexBasis: "30%" }}>
{translate("triggerDag.runId")}
{translate("runId")}
</Field.Label>
</Stack>
<Stack css={{ flexBasis: "70%" }}>
<Input {...field} size="sm" />
<Field.HelperText>{translate("triggerDag.runIdHelp")}</Field.HelperText>
<Field.HelperText>{translate("components:triggerDag.runIdHelp")}</Field.HelperText>
</Stack>
</Field.Root>
)}
Expand All @@ -144,8 +144,8 @@ const TriggerDAGForm = ({ dagDisplayName, dagId, isPaused, onClose, open }: Trig
name="note"
render={({ field }) => (
<Field.Root mt={6}>
<Field.Label fontSize="md">{translate("triggerDag.notes")}</Field.Label>
<EditableMarkdown field={field} placeholder={translate("triggerDag.notesPlaceholder")} />
<Field.Label fontSize="md">{translate("note.dagRun")}</Field.Label>
<EditableMarkdown field={field} placeholder={translate("note.placeholder")} />
</Field.Root>
)}
/>
Expand All @@ -169,7 +169,7 @@ const TriggerDAGForm = ({ dagDisplayName, dagId, isPaused, onClose, open }: Trig
disabled={Boolean(errors.conf) || Boolean(errors.date) || formError || isPending}
onClick={() => void handleSubmit(onSubmit)()}
>
<FiPlay /> {translate("triggerDag.trigger")}
<FiPlay /> {translate("components:triggerDag.button")}
</Button>
</HStack>
</Box>
Expand Down
Loading