Skip to content
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 @@ -31,6 +31,7 @@ const EditableMarkdownButton = ({
isPending,
mdContent,
onConfirm,
onOpen,
placeholder,
setMdContent,
text,
Expand All @@ -41,6 +42,7 @@ const EditableMarkdownButton = ({
readonly isPending: boolean;
readonly mdContent?: string | null;
readonly onConfirm: () => void;
readonly onOpen: () => void;
readonly placeholder: string;
readonly setMdContent: (value: string) => void;
readonly text: string;
Expand All @@ -54,7 +56,12 @@ const EditableMarkdownButton = ({
<ActionButton
actionName={placeholder}
icon={icon}
onClick={() => setIsOpen(true)}
onClick={() => {
if (!isOpen) {
onOpen();
}
setIsOpen(true);
}}
text={text}
withText={withText}
/>
Expand All @@ -64,6 +71,7 @@ const EditableMarkdownButton = ({
onOpenChange={() => setIsOpen(false)}
open={isOpen}
size="md"
unmountOnExit={true}
>
<Dialog.Content backdrop>
<Dialog.Header bg="blue.muted">
Expand Down
6 changes: 6 additions & 0 deletions airflow-core/src/airflow/ui/src/pages/Run/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export const Header = ({
});
}
}, [dagId, dagRun.note, dagRunId, mutate, note]);

const onOpen = () => {
setNote(dagRun.note ?? "");
};

const containerRef = useRef<HTMLDivElement>();
const containerWidth = useContainerWidth(containerRef);

Expand All @@ -74,6 +79,7 @@ export const Header = ({
isPending={isPending}
mdContent={note}
onConfirm={onConfirm}
onOpen={onOpen}
placeholder={translate("note.placeholder")}
setMdContent={setNote}
text={Boolean(dagRun.note) ? translate("note.label") : translate("note.add")}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ export const Header = ({
}
}, [dagId, dagRunId, mapIndex, mutate, note, taskId, taskInstance.note]);

const onOpen = () => {
setNote(taskInstance.note ?? "");
};

return (
<Box ref={containerRef}>
<HeaderCard
Expand All @@ -99,6 +103,7 @@ export const Header = ({
isPending={isPending}
mdContent={note}
onConfirm={onConfirm}
onOpen={onOpen}
placeholder={translate("note.placeholder")}
setMdContent={setNote}
text={Boolean(taskInstance.note) ? translate("note.label") : translate("note.add")}
Expand Down