import{C as A}from"./CrudView.f8c62bd5.js";import{d as _,f as k,e4 as x,g as v,K as C,b as l,u as i,w as d,aL as P,o as h,d4 as D,az as y,d5 as M,eb as N,cE as j,eN as K,ep as E}from"./index.e310aebb.js";import{a as T}from"./asyncComputed.6b1d4165.js";import{A as c}from"./apiKey.4d183c24.js";import"./gateway.4d0dc75b.js";import{M as V}from"./member.c84b9c44.js";import{a as z}from"./project.3b35cd7f.js";import"./columns.b1346706.js";import"./router.2399bbbf.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.d13fff5d.js";import"./url.fb968ca0.js";import"./PhDotsThreeVertical.vue.86ea10eb.js";import"./Badge.a954551a.js";import"./index.3d882fa8.js";import"./index.850d1dd3.js";import"./popupNotifcation.fa3e65fc.js";import"./record.d2935dfa.js";import"./string.a01d17aa.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]="26aa72ee-32ba-4d9c-954c-9bfd353d1715",n._sentryDebugIdIdentifier="sentry-dbid-26aa72ee-32ba-4d9c-954c-9bfd353d1715")}catch{}})();const oe=_({__name:"ApiKeys",setup(n){const a=k(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,f=new V,{loading:g,result:b,refetch:u}=T(async()=>Promise.all([c.list(s),z.get(s).then(e=>f.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:E,dangerous:!0,onClick:async()=>{await c.delete(s,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(h(),C(P,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(j),{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(()=>[y("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(()=>[y(N(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{oe as default};
//# sourceMappingURL=ApiKeys.f3a5187f.js.map
