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