import{d as y,eA as h,G as g,b as w,c as b,u as _}from"./outputWidgets.84fd06fb.js";import{e as H,d as C}from"./icons.3869c437.js";import{a as x}from"./asyncComputed.da204aa5.js";import{H as c}from"./hooks.0633e441.js";import{C as D}from"./CrudView.500d5f8a.js";import{a as d}from"./ant-design.09f47601.js";import"./record.f0008bb4.js";import"./pubsub.8883f68b.js";import"./Text.9dbcc31d.js";import"./Base.67ffff63.js";import"./transButton.64565967.js";import"./router.a59cab44.js";import"./Title.564982df.js";import"./index.a606b6d8.js";import"./url.53969469.js";import"./index.6b6af4b4.js";import"./index.02fdeca3.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]="600a8017-f039-472a-8e78-4fc9220aff24",o._sentryDebugIdIdentifier="sentry-dbid-600a8017-f039-472a-8e78-4fc9220aff24")}catch{}})();const $=y({__name:"Hooks",setup(o){const i=h(),{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=g(()=>{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)=>(w(),b(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.591b350e.js.map
