import{C as T}from"./CrudView.89b2d509.js";import{a as _}from"./asyncComputed.f77117da.js";import{n as i}from"./string.1c036a5c.js";import{G as k}from"./PhPencil.vue.87821228.js";import{d as h,eH as w,eu as I,f as x,c as N,w as l,u as c,eI as S,o as D,b as E,ax as v,bL as B}from"./vue-router.6a68d184.js";import"./gateway.46301256.js";import{T as d}from"./tables.97d8f468.js";import"./router.2b01b91e.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.7a74a897.js";import"./BookOutlined.12518a78.js";import"./url.dbab9c15.js";import"./PhDotsThree.vue.d10fe455.js";import"./index.f7061722.js";import"./index.4be87654.js";import"./popupNotifcation.782e5078.js";import"./record.048ae4ac.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[a]="2c10c78f-3777-480c-b2c8-05f3ad86bd9d",o._sentryDebugIdIdentifier="sentry-dbid-2c10c78f-3777-480c-b2c8-05f3ad86bd9d")}catch{}})();const W=h({__name:"Tables",setup(o){const a=w(),t=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>d.list(t)),f=async e=>{const r=await d.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},s=()=>{a.push({name:"sql",params:{projectId:t}})},y=x(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"",align:"right"}],rows:(r=(e=u.value)==null?void 0:e.map(n=>({key:n.id,cells:[{type:"link",text:n.name,to:{name:"tableEditor",params:{tableId:n.id,projectId:t}}},{type:"actions",actions:[{icon:k,label:"Edit Table",onClick({key:C}){a.push({name:"tableEditor",params:{tableId:C,projectId:t}})}},{icon:S,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),b()}}]}]})))!=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:c(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(c(B),{onClick:s},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{W as default};
//# sourceMappingURL=Tables.1216a6b8.js.map
