import{C as A}from"./CrudView.8dac6e2f.js";import{d as _,e as k,ec as x,f as v,o as C,Y as P,b as l,u as i,w as d,aS as h,db as D,aG as f,dc as M,ea as j,cL as N,eM as K,eq as T}from"./index.82b3148c.js";import{a as V}from"./asyncComputed.b31540a4.js";import{A as c}from"./apiKey.8232ab5a.js";import"./gateway.8733a5f3.js";import{M as B}from"./member.0ec96179.js";import{a as E}from"./project.24dc9c6f.js";import"./tables.b60a390b.js";import"./router.aacfb520.js";import"./Badge.8b0acfd8.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.b4d03e94.js";import"./BookOutlined.e58a4796.js";import"./url.3209a6f7.js";import"./PhDotsThreeVertical.vue.c0360e2e.js";import"./index.39ceca4f.js";import"./index.867114ba.js";import"./popupNotifcation.e1bf1f8c.js";import"./record.cb9a902e.js";import"./string.ab0c206a.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="f61f34d9-9f8b-4ef4-ae6b-8e8182c65c84",n._sentryDebugIdIdentifier="sentry-dbid-f61f34d9-9f8b-4ef4-ae6b-8e8182c65c84")}catch{}})();const ae=_({__name:"ApiKeys",setup(n){const a=k(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,y=new B,{loading:g,result:b,refetch:u}=V(async()=>Promise.all([c.list(s),E.get(s).then(e=>y.list(e.organizationId))]).then(([e,t])=>e.map(o=>({apiKey:o,member:t.find(r=>r.authorId===o.ownerId)})))),I=async e=>{const t=await c.create({projectId:s,name:e.name});u(),a.value=t.value},w=v(()=>{var e,t;return{columns:[{title:"Name"},{title:"Creation date"},{title:"Owner"},{title:"",align:"right"}],rows:(t=(e=b.value)==null?void 0:e.map(({apiKey:o,member:r})=>{var m;return{key:o.id,cells:[{type:"text",text:o.name},{type:"text",text:K(o.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:T,dangerous:!0,onClick:async()=>{await c.delete(s,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(C(),P(h,null,[l(A,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(g),title:"API Keys",description:"API Keys are used to deploy your project from the local editor.","empty-title":"No API keys here yet",table:w.value,fields:p,create:I},null,8,["loading","table"]),l(i(N),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(D),null,{default:d(()=>[f("Your API key was successfully generated. Use this code to login on your local development environment or deploy using CI")]),_:1}),l(i(M),{code:"",copyable:""},{default:d(()=>[f(j(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ae as default};
//# sourceMappingURL=ApiKeys.c5834cb5.js.map
