import{C as w}from"./CrudView.c0824225.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,d7 as D,g as f,d8 as M,ed as j,M as N,ee as K,em as T}from"./jwt-decode.esm.d4517a10.js";import{a as V}from"./asyncComputed.cf5282fc.js";import{A as c}from"./apiKey.72f497ca.js";import"./router.424f7da9.js";import{M as B}from"./member.48d6f2cd.js";import{a as E}from"./project.619b7244.js";import"./tables.1f68ec62.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.3668aee4.js";import"./constants.7d38ec8b.js";import"./url.e8732f77.js";import"./PhDotsThreeVertical.vue.ab4580a5.js";import"./index.fb182bd1.js";import"./index.4176fe88.js";import"./record.7f43486c.js";import"./string.0acf5572.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]="bc8b19fe-df30-4bb0-9231-8ff34c70b1f3",n._sentryDebugIdIdentifier="sentry-dbid-bc8b19fe-df30-4bb0-9231-8ff34c70b1f3")}catch{}})();const ee=_({__name:"ApiKeys",setup(n){const a=k(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,y=new B,{loading:b,result:g,refetch:u}=V(async()=>Promise.all([c.list(s),E.get(s).then(e=>y.list(e.organizationId))]).then(([e,t])=>e.map(o=>({apiKey:o,member:t.find(r=>r.authorId===o.ownerId)})))),I=async e=>{const t=await c.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=g.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 c.delete(s,o.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(b),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:I},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(()=>[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(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ee as default};
//# sourceMappingURL=ApiKeys.e975c4f3.js.map
