import{C as T}from"./CrudView.d77e910d.js";import{a as _}from"./asyncComputed.bb3077bb.js";import{n as i}from"./string.3bd1e390.js";import{G as k}from"./PhPencil.vue.3ceaa978.js";import{d as h,eH as w,eu as I,f as x,c as N,w as l,u as m,eI as S,o as D,b as E,ax as v,bL as B}from"./vue-router.5e8ba7eb.js";import"./gateway.9bb9fef7.js";import{T as d}from"./tables.8dccf3c7.js";import"./router.1e5228d6.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.af476096.js";import"./BookOutlined.bf415405.js";import"./url.4683fc99.js";import"./PhDotsThree.vue.5061c9cb.js";import"./index.d0fd73d7.js";import"./index.806e571e.js";import"./popupNotifcation.b3ef9d8a.js";import"./record.98df87df.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="b4e41642-fe4d-46a1-bf0f-03670b912ab9",o._sentryDebugIdIdentifier="sentry-dbid-b4e41642-fe4d-46a1-bf0f-03670b912ab9")}catch{}})();const W=h({__name:"Tables",setup(o){const t=w(),a=I().params.projectId,{loading:p,result:b,refetch:u}=_(()=>d.list(a)),f=async e=>{const r=await d.create(a,e.name);t.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},s=()=>{t.push({name:"sql",params:{projectId:a}})},y=x(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"",align:"right"}],rows:(r=(e=b.value)==null?void 0:e.map(n=>({key:n.id,cells:[{type:"link",text:n.name,to:{name:"tableEditor",params:{tableId:n.id,projectId:a}}},{type:"actions",actions:[{icon:k,label:"Edit Table",onClick({key:C}){t.push({name:"tableEditor",params:{tableId:C,projectId:a}})}},{icon:S,label:"Delete",dangerous:!0,async onClick(){await n.delete(a,n.id),u()}}]}]})))!=null?r:[]}}),g=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(D(),N(T,{"entity-name":"table",loading:m(p),"docs-path":"cloud/tables",title:"Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:y.value,fields:g,"create-button-text":"Create Table",onCreate:f,onSecondaryClick:s},{more:l(()=>[E(m(B),{onClick:s},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{W as default};
//# sourceMappingURL=Tables.3df8373c.js.map
