import{C as b}from"./CrudView.65cddc3d.js";import{d as _,r as k,ec as x,c as P,a4 as v,f as l,u as i,b as d,aQ as C,o as h,d6 as D,g as f,d7 as M,ea as j,M as N,ed as K,en as T}from"./jwt-decode.esm.f368ea6d.js";import{a as V}from"./asyncComputed.0b92728b.js";import{A as c}from"./apiKey.631765a8.js";import"./router.e92d73ff.js";import{M as B}from"./member.8cba1dda.js";import{P as E}from"./project.6143d5f3.js";import"./tables.24d02615.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.4c12a84b.js";import"./constants.15500ccf.js";import"./url.036cb91d.js";import"./PhDotsThreeVertical.vue.2c005e69.js";import"./index.6e6b7d7e.js";import"./record.7a582e5f.js";import"./string.cd622100.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]="15af4159-38f7-4a3a-945e-ef31f0644af2",n._sentryDebugIdIdentifier="sentry-dbid-15af4159-38f7-4a3a-945e-ef31f0644af2")}catch{}})();const Z=_({__name:"ApiKeys",setup(n){const o=k(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,y=new B,{loading:g,result:I,refetch:u}=V(async()=>Promise.all([c.list(s),E.get(s).then(e=>y.list(e.organizationId))]).then(([e,t])=>e.map(a=>({apiKey:a,member:t.find(r=>r.authorId===a.ownerId)})))),A=async e=>{const t=await c.create({projectId:s,name:e.name});u(),o.value=t.value},w=P(()=>{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:a,member:r})=>{var m;return{key:a.id,cells:[{type:"text",text:a.name},{type:"text",text:K(a.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 c.delete(s,a.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(h(),v(C,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:w.value,fields:p,create:A},null,8,["loading","table"]),l(i(N),{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(()=>[f("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(()=>[f(j(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{Z as default};
//# sourceMappingURL=ApiKeys.3ebebb5e.js.map
