import{C as w}from"./CrudView.2286e2df.js";import{d as _,r as k,ea 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,ec as j,M as N,ed as K,eo as T}from"./jwt-decode.esm.43a112d3.js";import{a as V}from"./asyncComputed.3d996402.js";import{A as c}from"./apiKey.a479b21a.js";import"./router.663c6f19.js";import{M as B}from"./member.47961d18.js";import{a as E}from"./project.bfe6a5a3.js";import"./tables.e2c76137.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.66110338.js";import"./constants.c15d871e.js";import"./url.b9e6dfc2.js";import"./PhDotsThreeVertical.vue.b0448dae.js";import"./index.b0d2e208.js";import"./index.919e954c.js";import"./record.dfeaef8c.js";import"./string.9f615d28.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]="159ebcd2-eb1b-42cb-9b99-9b3abbb67c5c",n._sentryDebugIdIdentifier="sentry-dbid-159ebcd2-eb1b-42cb-9b99-9b3abbb67c5c")}catch{}})();const ee=_({__name:"ApiKeys",setup(n){const a=k(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,b=new B,{loading:f,result:g,refetch:u}=V(async()=>Promise.all([c.list(s),E.get(s).then(e=>b.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(f),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(()=>[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{ee as default};
//# sourceMappingURL=ApiKeys.9c027fd1.js.map
