import{C as w}from"./CrudView-wZnp03a2.js";import{d as A,r as _,S as k,e as x,l as P,m as v,g as r,D as s,G as l,aq as C,$ as p,Z as h,V as D,O as M,F as j,ar as N,an as V}from"./jwt-decode.esm-Dca5fHH5.js";import{a as K}from"./asyncComputed-IJY6wgme.js";import{A as d}from"./apiKey-C93xAKPD.js";import"./router-D5wfdag3.js";import{M as T}from"./member-BNIMJ1hR.js";import{P as B}from"./project-BZzoNeQM.js";import"./tables-BsqTY_wE.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-BnwqPwfA.js";import"./constants-B1LrRAnj.js";import"./url-CoyBb3Dp.js";import"./PhDotsThreeVertical.vue-B1x6I4wD.js";import"./index-ZQBk4l6i.js";import"./index-Cyx2lZTa.js";import"./record-BZIfMWML.js";import"./string-BYR4BIXr.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]="ba9a92fa-aec7-4d5a-b694-3b5359af3f61",o._sentryDebugIdIdentifier="sentry-dbid-ba9a92fa-aec7-4d5a-b694-3b5359af3f61")}catch{}})();const X=A({__name:"ApiKeys",setup(o){const a=_(null),m=[{key:"name",label:"API key name"}],n=k().params.projectId,u=new T,{loading:y,result:f,refetch:c}=K(async()=>Promise.all([d.list(n),B.get(n).then(e=>u.list(e.organizationId))]).then(([e,t])=>e.map(i=>({apiKey:i,member:t.find(I=>I.authorId===i.ownerId)})))),b=async e=>{const t=await d.create({projectId:n,name:e.name});c(),a.value=t.value},g=x(()=>({columns:[{title:"Name"},{title:"Creation date"},{title:"Owner"},{title:"",align:"right"}],rows:f.value?.map(({apiKey:e,member:t})=>({key:e.id,cells:[{type:"text",text:e.name},{type:"text",text:N(e.createdAt)},{type:"text",text:t?.email??"Unknown"},{type:"actions",actions:[{label:"Delete",icon:V,dangerous:!0,onClick:async()=>{await d.delete(n,e.id),c()}}]}]}))??[]}));return(e,t)=>(v(),P(j,null,[r(w,{"entity-name":"API key","create-button-text":"Create API Key",loading:s(y),title:"API Keys",description:"API Keys are used to deploy your project from the local editor.","empty-title":"No API keys here yet",table:g.value,fields:m,create:b},null,8,["loading","table"]),r(s(M),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=i=>a.value=null)},{footer:l(()=>[]),default:l(()=>[r(s(C),null,{default:l(()=>[p("Your API key was successfully generated. Use this code to login on your local development environment or deploy using CI")]),_:1}),r(s(h),{code:"",copyable:""},{default:l(()=>[p(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{X as default};
//# sourceMappingURL=ApiKeys-C0LiK8mA.js.map
