import{C as T}from"./CrudView.81c72183.js";import{a as _}from"./asyncComputed.83d82971.js";import{n as i}from"./string.10d66498.js";import{G as k}from"./PhPencil.vue.225376db.js";import{d as w,eo as h,ea as I,f as x,o as N,c as D,w as l,u as m,b as E,aF as S,bP as v,ep as A}from"./vue-router.f3adf768.js";import"./gateway.9d2e1477.js";import{T as d}from"./tables.f76abbb4.js";import{a as B}from"./ant-design.79c08f53.js";import"./router.e48ec16b.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.f36536ce.js";import"./BookOutlined.9465c5e6.js";import"./url.05ebda4d.js";import"./PhDotsThreeVertical.vue.0274c806.js";import"./Badge.e393c721.js";import"./index.eac32d6d.js";import"./popupNotifcation.271a2b0b.js";import"./record.c1c318a9.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]="34fbd518-c80a-43eb-b0fa-ab368e383349",o._sentryDebugIdIdentifier="sentry-dbid-34fbd518-c80a-43eb-b0fa-ab368e383349")}catch{}})();const Y=w({__name:"Tables",setup(o){const t=h(),a=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>d.list(a)),f=async e=>{const r=await d.create(a,e.name);t.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},y=()=>{t.push({name:"sql",params:{projectId:a}})},g=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:a}}},{type:"actions",actions:[{icon:k,label:"Edit Table",onClick({key:s}){t.push({name:"tableEditor",params:{tableId:s,projectId:a}})}},{icon:A,label:"Delete",dangerous:!0,async onClick(){!await B("Are you sure you want to delete this table and all its data?")||(await n.delete(a,n.id),b())}}]}]})))!=null?r:[]}}),C=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(N(),D(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:g.value,fields:C,"create-button-text":"Create Table",create:f},{more:l(()=>[E(m(v),{onClick:y},{default:l(()=>[S("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.896737d6.js.map
