import{d as w,e as A,eB as _,f as k,o as x,eu as C,b as l,u as i,w as d,aE as v,eV as P,eN as h,cQ as D,as as y,cR as M,eA as N,cu as j}from"./vue-router.74c693f1.js";import{a as V}from"./asyncComputed.7b5c3427.js";import"./gateway.707771fc.js";import"./index.0791082e.js";import{M as B}from"./member.c554032e.js";import{A as c}from"./apiKey.eb1e9ae2.js";import{P as E}from"./project.d7713957.js";import{C as K}from"./CrudView.f360b43c.js";import"./popupNotifcation.d39bbf9b.js";import"./record.0d85e3b6.js";import"./string.b1ebfabb.js";import"./router.77dea3d2.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.97a16843.js";import"./BookOutlined.7a96a9c1.js";import"./url.8b7ee03b.js";import"./index.ad2af8a3.js";import"./index.33768c38.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[o]="560712fa-164e-4fad-bb93-c8500f4c948c",n._sentryDebugIdIdentifier="sentry-dbid-560712fa-164e-4fad-bb93-c8500f4c948c")}catch{}})();const ee=w({__name:"ApiKeys",setup(n){const o=A(null),u=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:p}=V(async()=>Promise.all([c.list(s),E.get(s).then(e=>B.list(e.organizationId))]).then(([e,t])=>e.map(a=>({apiKey:a,member:t.find(r=>r.authorId===a.ownerId)})))),I=async e=>{const t=await c.create({projectId:s,name:e.name});p(),o.value=t.value},b=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:a,member:r})=>{var m;return{key:a.id,cells:[{type:"text",text:a.name},{type:"text",text:P(a.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:h,dangerous:!0,onClick:async()=>{await c.delete(s,a.id),p()}}]}]}}))!=null?t:[]}});return(e,t)=>(x(),C(v,null,[l(K,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(f),title:"API Keys",description:"API Keys are used to deploy your project from the local editor.","empty-title":"No API keys here yet",table:b.value,fields:u,onCreate:I},null,8,["loading","table"]),l(i(j),{open:!!o.value,title:"Api key generated",onCancel:t[0]||(t[0]=a=>o.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(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ee as default};
//# sourceMappingURL=ApiKeys.ec2c78f6.js.map
