import{d as e,r as f,h,j as t,bK as p,q as s}from"./index-DET0E_3l.js";const m=({operation:n,project:a})=>{const c=e.useNotify(),l=e.useToastNotification(),[i,o]=f.useState(!1),r=h(),u=()=>{o(!0),p(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};
