import{d as y,eA as b,G as h,b as g,c as w,u as _}from"./outputWidgets.6c6bbcfd.js";import{e as H,d as C}from"./icons.89c226d3.js";import{a as x}from"./asyncComputed.77186ed9.js";import{H as c}from"./hooks.4a014954.js";import{C as D}from"./CrudView.520a43a0.js";import{a as d}from"./ant-design.ff909c2a.js";import"./record.5aef9f17.js";import"./pubsub.ccb56b51.js";import"./Text.51d0b007.js";import"./Base.d198dcc9.js";import"./transButton.2945a1d9.js";import"./router.98f12fd8.js";import"./Title.307e6445.js";import"./index.d102918e.js";import"./url.bf2db6c1.js";import"./index.9883e2bc.js";import"./index.0e6e05b9.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},i=new Error().stack;i&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[i]="8ba63660-a9b8-4e60-9268-583c624fcb71",o._sentryDebugIdIdentifier="sentry-dbid-8ba63660-a9b8-4e60-9268-583c624fcb71")}catch{}})();const $=y({__name:"Hooks",setup(o){const i=b(),{loading:n,result:r,refetch:m}=x(()=>c.list()),s=({key:e})=>i.push({name:"hookEditor",params:{id:e}}),p=async()=>{const e=await c.create();s({key:e.id})},u=async({key:e})=>{var t,l;const a=await d("Do you want to delete the .py file associated with this hook?",{okText:"Yes",cancelText:"No"});await d("Are you sure you want to delete this hook?")&&(await((l=(t=r.value)==null?void 0:t.find(k=>k.id===e))==null?void 0:l.delete(a)),m())},f=h(()=>{var e,a;return{columns:[{name:"Hook Name"},{name:"Path"},{name:"File"},{name:"Actions",align:"right"}],rows:(a=(e=r.value)==null?void 0:e.map(t=>({key:t.id,cells:[{text:t.title,link:`/_editor/hook/${encodeURIComponent(t.id)}`},{text:t.path},{text:t.file},{text:"",actions:[{icon:H,label:"Edit Hook",onClick:s},{icon:C,label:"Delete",onClick:u,dangerous:!0}]}]})))!=null?a:[]}});return(e,a)=>(g(),w(D,{loading:_(n),title:"Hooks",description:"Trigger your Python scripts with a request.","create-button-text":"Create Hook","empty-title":"No hooks here yet",table:f.value,"entity-name":"Hook",onCreate:p},null,8,["loading","table"]))}});export{$ as default};
//# sourceMappingURL=Hooks.b30a36c2.js.map
