import{d as e,r as f,n as p,j as a,da as C,q as s}from"./index-Dz5JRQhj.js";const m=({operation:n,project:t})=>{const c=e.useNotify(),l=e.useToastNotification(),[i,o]=f.useState(!1),r=p(),u=()=>{o(!0),C(n.id).then(()=>{l.success("Operation cancelled")}).catch(d=>{c.failure("Operation cancellation failed",d)}).finally(()=>{o(!1),r.invalidateQueries({queryKey:t?[s.operations,t]:[s.operations]})})};return n.status!=="Running"?null:a.jsx(e.ConfirmationButton,{onHoverText:n.may_cancel?"Cancel operation":"Cannot cancel operation at this stage",className:"u-no-margin--bottom",loading:i,disabled:!n.may_cancel||i,confirmationModalProps:{title:"Confirm cancel",children:a.jsx("p",{children:"This will cancel the operation."}),confirmButtonLabel:"Cancel operation",onConfirm:u,cancelButtonLabel:"Go back"},shiftClickEnabled:!0,showShiftClickHint:!0,children:a.jsx("span",{children:"Cancel"})})};export{m as C};
