import{C as b}from"./CrudView.326cc18b.js";import{d as _,e as k,ea as x,f as v,o as C,Y as P,b as l,u as i,w as d,aS as h,db as D,aG as y,dc as M,e9 as j,cL as N,eF as K,ep as T}from"./index.c4f9f025.js";import{a as V}from"./asyncComputed.bfad5b5f.js";import{A as p}from"./apiKey.11873024.js";import"./gateway.408bdde1.js";import{M as B}from"./member.14b8075b.js";import{a as E}from"./project.993b67c9.js";import"./tables.95f3c281.js";import"./router.a2550079.js";import"./Badge.f662d019.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.00c3f4e2.js";import"./BookOutlined.ec23cf35.js";import"./url.b319ee4d.js";import"./PhDotsThreeVertical.vue.d3a732a1.js";import"./index.6797054a.js";import"./index.c251cf6d.js";import"./popupNotifcation.ebc30b56.js";import"./record.8b302d80.js";import"./string.45b9e9dc.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]="930547a0-06e1-4f19-98a6-642f63470668",n._sentryDebugIdIdentifier="sentry-dbid-930547a0-06e1-4f19-98a6-642f63470668")}catch{}})();const ae=_({__name:"ApiKeys",setup(n){const a=k(null),c=[{key:"name",label:"API key name"}],s=x().params.projectId,f=new B,{loading:g,result:I,refetch:u}=V(async()=>Promise.all([p.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)})))),w=async e=>{const t=await p.create({projectId:s,name:e.name});u(),a.value=t.value},A=v(()=>{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 p.delete(s,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(C(),P(h,null,[l(b,{"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:A.value,fields:c,create:w},null,8,["loading","table"]),l(i(N),{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(j(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ae as default};
//# sourceMappingURL=ApiKeys.57d6a1f8.js.map
