import{C as A}from"./CrudView.81ab71a6.js";import{d as _,e as k,ea as x,f as C,o as v,Y as P,b as l,u as i,w as c,aS as h,db as D,aG as y,dc as M,e9 as j,cL as N,eC as K,ep as T}from"./index.b466b20d.js";import{a as V}from"./asyncComputed.4467697c.js";import{A as d}from"./apiKey.aa3e6e50.js";import"./gateway.973a0055.js";import{M as B}from"./member.eaf720ad.js";import{a as E}from"./project.eb1f21da.js";import"./tables.1fa225bd.js";import"./router.3cd4b4c4.js";import"./Badge.4eadbb30.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.47b5b5cb.js";import"./BookOutlined.948f0a8b.js";import"./url.0fe255f2.js";import"./PhDotsThreeVertical.vue.d63caaa3.js";import"./index.a02e478f.js";import"./index.12405f10.js";import"./popupNotifcation.d1201e83.js";import"./record.fd6fbc29.js";import"./string.42378387.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]="cc9dcac1-6bed-4c51-a7e0-901372233c21",n._sentryDebugIdIdentifier="sentry-dbid-cc9dcac1-6bed-4c51-a7e0-901372233c21")}catch{}})();const ae=_({__name:"ApiKeys",setup(n){const a=k(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,f=new B,{loading:g,result:I,refetch:u}=V(async()=>Promise.all([d.list(s),E.get(s).then(e=>f.list(e.organizationId))]).then(([e,t])=>e.map(o=>({apiKey:o,member:t.find(r=>r.authorId===o.ownerId)})))),b=async e=>{const t=await d.create({projectId:s,name:e.name});u(),a.value=t.value},w=C(()=>{var e,t;return{columns:[{title:"Name"},{title:"Creation date"},{title:"Owner"},{title:"",align:"right"}],rows:(t=(e=I.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 d.delete(s,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),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:b},null,8,["loading","table"]),l(i(N),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:c(()=>[]),default:c(()=>[l(i(D),null,{default:c(()=>[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:c(()=>[y(j(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ae as default};
//# sourceMappingURL=ApiKeys.2ee54a4c.js.map
