import{d as w,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 y,d8 as h,ec as D,cH as M,eJ as j,er as N}from"./vue-router.5a4c25bd.js";import{a as K}from"./asyncComputed.e7982546.js";import{A as c}from"./apiKey.39c1d309.js";import"./gateway.4a165dbb.js";import{M as T}from"./member.cfe58b7d.js";import{P as V}from"./project.7af833c1.js";import"./tables.05444807.js";import{C as B}from"./CrudView.0b35daa2.js";import"./popupNotifcation.ec4350da.js";import"./record.9d54035b.js";import"./string.ca5e661a.js";import"./router.584b518e.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.96deb7fb.js";import"./BookOutlined.c70fc2eb.js";import"./url.bd3666a7.js";import"./PhDotsThreeVertical.vue.28a9879a.js";import"./Badge.4ffe633d.js";import"./index.1a8c47ea.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]="277d1c70-b91b-447a-9f0b-2ac08321d7ee",n._sentryDebugIdIdentifier="sentry-dbid-277d1c70-b91b-447a-9f0b-2ac08321d7ee")}catch{}})();const te=w({__name:"ApiKeys",setup(n){const o=A(null),p=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:u}=K(async()=>Promise.all([c.list(s),V.get(s).then(e=>T.list(e.organizationId))]).then(([e,t])=>e.map(a=>({apiKey:a,member:t.find(r=>r.authorId===a.ownerId)})))),b=async e=>{const t=await c.create({projectId:s,name:e.name});u(),o.value=t.value},I=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:j(a.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 c.delete(s,a.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(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:I.value,fields:p,create:b},null,8,["loading","table"]),l(i(M),{open:!!o.value,title:"Api key generated",onCancel:t[0]||(t[0]=a=>o.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(P),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(h),{code:"",copyable:""},{default:d(()=>[y(D(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys.f796f867.js.map
