import{d as e,r as f,n as p,j as t,d6 as C,q as s}from"./index-C88DWJny.js";const m=({operation:n,project:a})=>{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:a?[s.operations,a]:[s.operations]})})};return n.status!=="Running"?null:t.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:t.jsx("p",{children:"This will cancel the operation."}),confirmButtonLabel:"Cancel operation",onConfirm:u,cancelButtonLabel:"Go back"},shiftClickEnabled:!0,showShiftClickHint:!0,children:t.jsx("span",{children:"Cancel"})})};export{m as C};
