import{d as b,e as A,ed as _,f as k,X as x,b as l,u as i,w as d,aR as v,o as C,d7 as P,aF as f,d8 as h,ec as D,cH as M,eJ as j,er as N}from"./vue-router.85c27f05.js";import{a as K}from"./asyncComputed.cef7b9d8.js";import{A as p}from"./apiKey.59ef865b.js";import"./gateway.aa5a907a.js";import{M as T}from"./member.b1f6d6f2.js";import{P as V}from"./project.947f659b.js";import"./tables.8aae1278.js";import{C as B}from"./CrudView.dfc4572e.js";import"./popupNotifcation.db970277.js";import"./record.b6b15302.js";import"./string.76b61cc9.js";import"./router.6a11826f.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.2ed94dec.js";import"./BookOutlined.3c422224.js";import"./url.2f0a55dd.js";import"./PhDotsThreeVertical.vue.ceb80819.js";import"./Badge.6a9a7808.js";import"./index.b39fb56f.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]="f9a81700-0f14-4421-97f3-1fe755535b4d",n._sentryDebugIdIdentifier="sentry-dbid-f9a81700-0f14-4421-97f3-1fe755535b4d")}catch{}})();const te=b({__name:"ApiKeys",setup(n){const a=A(null),c=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,result:g,refetch:u}=K(async()=>Promise.all([p.list(s),V.get(s).then(e=>T.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 p.create({projectId:s,name:e.name});u(),a.value=t.value},w=k(()=>{var e,t;return{columns:[{name:"Name"},{name:"Creation date"},{name:"Owner"},{name:"",align:"right"}],rows:(t=(e=g.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:j(o.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:N,dangerous:!0,onClick:async()=>{await p.delete(s,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(C(),x(v,null,[l(B,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(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:w.value,fields:c,create:I},null,8,["loading","table"]),l(i(M),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(P),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(h),{code:"",copyable:""},{default:d(()=>[f(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys.07149b6c.js.map
