import{d as y,ez as b,G as h,b as g,c as w,u as _}from"./outputWidgets.6d6b4a37.js";import{e as H,d as C}from"./icons.28d0d847.js";import{a as x}from"./asyncComputed.17a6198d.js";import{H as d}from"./hooks.e5458cf8.js";import{C as D}from"./CrudView.230a173f.js";import{a as l}from"./ant-design.c99b7781.js";import"./record.7835c07e.js";import"./pubsub.7d377b25.js";import"./Form.1ff54ed5.js";import"./router.4e9df257.js";import"./index.72c317ca.js";import"./index.0e216cc8.js";import"./Title.b41b4f96.js";import"./url.b5fbb423.js";import"./index.9eddb8ae.js";import"./index.6f6e8ffd.js";import"./index.f2a53bdb.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]="535df7bc-bcdd-48ba-a25c-5f995ca97a80",o._sentryDebugIdIdentifier="sentry-dbid-535df7bc-bcdd-48ba-a25c-5f995ca97a80")}catch{}})();const Y=y({__name:"Hooks",setup(o){const i=b(),{loading:n,result:r,refetch:m}=x(()=>d.list()),s=({key:e})=>i.push({name:"hookEditor",params:{id:e}}),p=async()=>{const e=await d.create();s({key:e.id})},u=async({key:e})=>{var t,c;const a=await l("Do you want to delete the .py file associated with this hook?",{okText:"Yes",cancelText:"No"});await l("Are you sure you want to delete this hook?")&&(await((c=(t=r.value)==null?void 0:t.find(k=>k.id===e))==null?void 0:c.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{Y as default};
//# sourceMappingURL=Hooks.66baca25.js.map
