import{d as w,r as A,eB as _,G as k,b as C,eu as h,f as l,u as i,w as d,a_ as v,aq as f,eD as P}from"./outputWidgets.91878a00.js";import{d as x}from"./index.571df689.js";import{g as D}from"./icons.842bb077.js";import{a as M}from"./asyncComputed.6ced1d7b.js";import"./router.77bfbaae.js";import"./index.8262a422.js";import{M as N}from"./member.b6fae053.js";import{A as c}from"./apiKey.df241b7d.js";import{P as T}from"./project.e6aa2cb4.js";import{C as j}from"./CrudView.d6529c3b.js";import{b as B,c as K}from"./Text.24e27494.js";import{M as V}from"./transButton.c9ea1045.js";import"./Base.80d71c98.js";import"./Title.cb0c3b9b.js";import"./record.8ded570d.js";import"./pubsub.862a9619.js";import"./gateway.6c51aaca.js";import"./url.dddb8fdb.js";import"./index.aed07cef.js";import"./index.43a9b125.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]="7641c61b-7734-4593-8e61-cfa84678e3da",n._sentryDebugIdIdentifier="sentry-dbid-7641c61b-7734-4593-8e61-cfa84678e3da")}catch{}})();const ae=w({__name:"ApiKeys",setup(n){const a=A(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,result:g,refetch:p}=M(async()=>Promise.all([c.list(s),T.get(s).then(e=>N.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});p(),a.value=t.value},b=k(()=>{var e,t;return{columns:[{name:"Name"},{name:"Creation date"},{name:"Owner"},{name:"Actions",align:"right"}],rows:(t=(e=g.value)==null?void 0:e.map(({apiKey:o,member:r})=>{var u;return{key:o.id,cells:[{text:o.name},{text:x(o.createdAt)},{text:(u=r==null?void 0:r.email)!=null?u:"Unknown"},{text:"actions",actions:[{label:"Delete",icon:D,dangerous:!0,onClick:async()=>{await c.delete(s,o.id),p()}}]}]}}))!=null?t:[]}});return(e,t)=>(C(),h(v,null,[l(j,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(y),title:"API Keys",description:"API Keys are used to deploy your app from the local editor.","empty-title":"No API keys here yet",table:b.value,fields:m,onCreate:I},null,8,["loading","table"]),l(i(V),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(B),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(K),{code:"",copyable:""},{default:d(()=>[f(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ae as default};
//# sourceMappingURL=ApiKeys.813a170f.js.map
