import{C as w}from"./CrudView.178ed8b6.js";import{d as _,r as k,eb as x,c as v,a5 as C,f as l,u as i,b as d,aR as P,o as h,d9 as D,g as y,da as M,ed as j,M as N,ee as K,ep as T}from"./jwt-decode.esm.95147216.js";import{a as V}from"./asyncComputed.15a1493f.js";import{A as c}from"./apiKey.d74cc22b.js";import"./router.09c25b35.js";import{M as B}from"./member.43ebbec6.js";import{a as E}from"./project.47c68ce9.js";import"./tables.7fcaf771.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.bfb97102.js";import"./constants.5f7db9f7.js";import"./url.8c481a5a.js";import"./PhDotsThreeVertical.vue.3f13d85f.js";import"./index.b1615145.js";import"./index.574c12ce.js";import"./record.44df96f2.js";import"./string.c6b418fe.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]="bda2f933-e151-46c3-9ca7-4efe6c2929da",n._sentryDebugIdIdentifier="sentry-dbid-bda2f933-e151-46c3-9ca7-4efe6c2929da")}catch{}})();const ee=_({__name:"ApiKeys",setup(n){const o=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([c.list(s),E.get(s).then(e=>f.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},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: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(),C(P,null,[l(w,{"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:p,create:b},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(()=>[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(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ee as default};
//# sourceMappingURL=ApiKeys.bdd7759b.js.map
