pierrejeambrun commented on code in PR #74039:
URL: https://github.com/apache/airflow/pull/74039#discussion_r4164783357
##########
airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGButton.tsx:
##########
@@ -92,84 +113,84 @@ export const TriggerDAGButton = ({
onClose();
};
- // If there's a selected DAG Run with config, show menu with options
- if (selectedDagRun?.conf !== undefined) {
- return (
- <Box>
- <Menu.Root>
- <Tooltip content={translate("triggerDag.manualRunDenied")}
disabled={!isManualRunDenied}>
+ // The main part always triggers in one click, as it did before the config
menu existed. When the
+ // selected run carried a config, a caret next to it offers re-triggering
with that config, instead
+ // of turning the whole button into a menu (which cost everyone an extra
click).
+ const triggerButton = withText ? (
+ <Button
+ aria-label={translate("triggerDag.title")}
+ data-testid="trigger-dag-button"
+ disabled={isManualRunDenied}
+ onClick={handleNormalTrigger}
+ variant={variant}
+ >
+ <FiPlay />
+ {translate("triggerDag.button")}
+ </Button>
+ ) : (
+ <IconButton
+ aria-label={translate("triggerDag.title")}
+ data-testid="trigger-dag-button"
+ disabled={isManualRunDenied}
+ onClick={handleNormalTrigger}
+ variant={variant}
+ >
+ <FiPlay />
+ </IconButton>
+ );
+
+ const triggerButtonWithTooltip = (
+ <Tooltip
+ content={isManualRunDenied ? translate("triggerDag.manualRunDenied") :
translate("triggerDag.button")}
+ disabled={withText ? !isManualRunDenied : undefined}
+ >
+ {triggerButton}
+ </Tooltip>
+ );
+
+ return (
+ <>
+ {selectedDagRun?.conf === undefined ? (
+ triggerButtonWithTooltip
+ ) : (
+ <ButtonGroup attached>
Review Comment:
This should be better, thanks for the suggestion, I also fixed the double
width at the frontier between the two button. (So it looks like 1 button with
the parts that two buttons collocated)
<img width="247" height="170" alt="Image"
src="https://github.com/user-attachments/assets/6f1bb6ab-a26a-4bbf-a32d-a40688d1a502"
/>
--
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]