VedantMadane commented on PR #60591:
URL: https://github.com/apache/airflow/pull/60591#issuecomment-3780845087
I've added the shift+C hotkey shortcut as requested. Here are the changes:
**Changes to ClearAllMappedTaskInstancesButton.tsx:**
1. Added import for useHotkeys:
```typescript
import { useHotkeys } from "react-hotkeys-hook";
```
2. Added isHotkeyEnabled prop to Props type:
```typescript
readonly isHotkeyEnabled?: boolean;
```
3. Updated function parameters:
```typescript
const ClearAllMappedTaskInstancesButton = ({ dagId, dagRunId,
isHotkeyEnabled = false, taskId, withText = true }: Props) => {
```
4. Implemented the hotkey hook (add after translate declaration, before
return):
```typescript
useHotkeys(
"shift+c",
() => {
onOpen();
},
{ enabled: isHotkeyEnabled },
);
```
This follows the same pattern as ClearTaskInstanceButton.tsx. The hotkey
will only be active when isHotkeyEnabled prop is set to true.
I've also created a patch file that can be applied directly. Let me know if
you'd like me to push this directly or if you prefer to apply it yourself!
--
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]