import{d as k,ez as y,G as h,b as g,c as w,u as _}from"./outputWidgets.723dbd35.js";import{e as H,d as C}from"./icons.d199659e.js";import{a as x}from"./asyncComputed.6087fd05.js";import{H as d}from"./hooks.6577fbee.js";import{C as D}from"./CrudView.ca2cf6ee.js";import{a as c}from"./ant-design.64772334.js";import"./record.c3c42720.js";import"./pubsub.97441533.js";import"./Form.71a7af16.js";import"./router.c09623bf.js";import"./index.b41dfd0a.js";import"./index.d0473694.js";import"./Title.ad9727d9.js";import"./url.c8598ea1.js";import"./index.4913d787.js";import"./index.f91ebf4c.js";import"./index.c827a0f6.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]="68578a4b-aab7-49a6-8e21-43db8febe91b",o._sentryDebugIdIdentifier="sentry-dbid-68578a4b-aab7-49a6-8e21-43db8febe91b")}catch{}})();const Y=k({__name:"Hooks",setup(o){const i=y(),{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,l;const a=await c("Do you want to delete the .py file associated with this hook?",{okText:"Yes",cancelText:"No"});await c("Are you sure you want to delete this hook?")&&(await((l=(t=r.value)==null?void 0:t.find(b=>b.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{Y as default};
//# sourceMappingURL=Hooks.852500a6.js.map
