import{d as g,eA as C,eB as T,H as k,b as _,c as I,u as h}from"./outputWidgets.84fe9cdf.js";import{t as w,o as x}from"./icons.fb80f0dd.js";import{a as S}from"./asyncComputed.6b982433.js";import"./router.55b997dc.js";import{T as s}from"./tables.b2cb30a8.js";import"./index.46fac088.js";import{C as v}from"./CrudView.d7e7652b.js";import{n as i}from"./string.c5b719a8.js";import"./FormItem.3f0afd7c.js";import"./hasIn.892e96d0.js";import"./record.d584e714.js";import"./pubsub.e099f5f1.js";import"./index.cf4c23b9.js";import"./Paragraph.7a7aafbc.js";import"./Base.3448c1ef.js";import"./Form.ff60b0b9.js";import"./Modal.47a21763.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.41277f9f.js";import"./url.8de5cd7a.js";import"./index.7b2adc4e.js";import"./Title.59475fea.js";import"./Text.6c3b9f60.js";import"./index.2424aba1.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]="c95da9fb-d4a2-475a-ac99-8a2d56b470f1",o._sentryDebugIdIdentifier="sentry-dbid-c95da9fb-d4a2-475a-ac99-8a2d56b470f1")}catch{}})();const $=g({__name:"Tables",setup(o){const a=C(),t=T().params.projectId,{loading:m,result:d,refetch:c}=S(()=>s.list(t)),p=async e=>{const r=await s.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},u=()=>{a.push({name:"sql",params:{projectId:t}})},b=k(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"",align:"right"}],rows:(r=(e=d.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:w,label:"Edit Table",onClick({key:y}){a.push({name:"tableEditor",params:{tableId:y,projectId:t}})}},{icon:x,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),c()}}]}]})))!=null?r:[]}}),f=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(_(),I(v,{"entity-name":"table",loading:h(m),"docs-path":"tables/overview",title:"Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:b.value,fields:f,"create-button-text":"Create Table","secondary-button-text":"Run SQL",onCreate:p,onSecondaryClick:u},null,8,["loading","table"]))}});export{$ as default};
//# sourceMappingURL=Tables.d60b312f.js.map
