bbovenzi commented on code in PR #35393:
URL: https://github.com/apache/airflow/pull/35393#discussion_r1394580912


##########
airflow/www/static/js/dag/details/dagRun/MarkRunAs.tsx:
##########
@@ -58,42 +65,95 @@ const MarkRunAs = ({ runId, state, ...otherProps }: Props) 
=> {
     markSuccess({ confirmed: true });
   };
 
+  const confirmAction = () => {
+    if (confirmingAction === "failed") {
+      markAsFailed();
+    } else if (confirmingAction === "success") {
+      markAsSuccess();
+    }
+    setShowConfirmationModal(false);
+  };
+
   useKeysPress(keyboardShortcutIdentifier.dagMarkSuccess, () => {
-    if (state !== "success") markAsSuccess();
+    if (state !== "success") {
+      if (!doNotShowAgainSuccess) {
+        setConfirmingAction("success");
+        setShowConfirmationModal(true);
+      } else markAsSuccess();
+    }
   });
   useKeysPress(keyboardShortcutIdentifier.dagMarkFailed, () => {
-    if (state !== "failed") markAsFailed();
+    if (state !== "failed") {
+      if (!doNotShowAgainFailed) {
+        setConfirmingAction("failed");
+        setShowConfirmationModal(true);
+      } else markAsFailed();
+    }
   });
 
   const markLabel = "Manually set dag run state";
   return (
-    <Menu>
-      <MenuButton
-        as={Button}
-        colorScheme="blue"
-        transition="all 0.2s"
-        title={markLabel}
-        aria-label={markLabel}
-        disabled={!canEdit || isMarkFailedLoading || isMarkSuccessLoading}
-        {...otherProps}
-        mt={2}
+    <>
+      <Menu>
+        <MenuButton
+          as={Button}
+          colorScheme="blue"
+          transition="all 0.2s"
+          title={markLabel}
+          aria-label={markLabel}
+          disabled={!canEdit || isMarkFailedLoading || isMarkSuccessLoading}
+          {...otherProps}
+          mt={2}
+        >
+          <Flex>
+            Mark state as...
+            <MdArrowDropDown size="16px" />
+          </Flex>
+        </MenuButton>
+        <MenuList>
+          <MenuItem onClick={markAsFailed} isDisabled={state === "failed"}>
+            <SimpleStatus state="failed" mr={2} />
+            failed
+          </MenuItem>
+          <MenuItem onClick={markAsSuccess} isDisabled={state === "success"}>
+            <SimpleStatus state="success" mr={2} />
+            success
+          </MenuItem>
+        </MenuList>
+      </Menu>
+      <ActionModal
+        isOpen={showConfirmationModal}
+        onClose={() => setShowConfirmationModal(false)}
+        header="Confirmation"
+        submitButton={
+          <Button
+            onClick={confirmAction}
+            colorScheme={
+              (confirmingAction === "success" && "green") ||
+              (confirmingAction === "failed" && "red") ||
+              "grey"
+            }
+          >
+            Mark as {confirmingAction}
+          </Button>
+        }
+        doNotShowAgain={
+          confirmingAction === "success"
+            ? doNotShowAgainSuccess
+            : doNotShowAgainFailed
+        }
+        onDoNotShowAgainChange={(value) => {
+          if (confirmingAction === "success") {
+            setDoNotShowAgainSuccess(value);
+          } else if (confirmingAction === "failed") {
+            setDoNotShowAgainFailed(value);
+          }
+        }}
       >
-        <Flex>
-          Mark state as...
-          <MdArrowDropDown size="16px" />
-        </Flex>
-      </MenuButton>
-      <MenuList>
-        <MenuItem onClick={markAsFailed} isDisabled={state === "failed"}>
-          <SimpleStatus state="failed" mr={2} />
-          failed
-        </MenuItem>
-        <MenuItem onClick={markAsSuccess} isDisabled={state === "success"}>
-          <SimpleStatus state="success" mr={2} />
-          success
-        </MenuItem>
-      </MenuList>
-    </Menu>
+        This marks the DAG run as {confirmingAction}. Are you sure you want to

Review Comment:
   Go for it!



-- 
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]

Reply via email to