import{d as A,r as w,ez as k,G as _,b as h,et as C,f as i,u as l,w as d,b8 as v,aA as f,eB as x}from"./outputWidgets.24bc53e6.js";import{a as P}from"./asyncComputed.e4b96939.js";import{P as D}from"./project.92896cfe.js";import"./router.5678fba5.js";import{M}from"./member.da2f962f.js";import{A as c}from"./apiKey.d7809494.js";import"./columns.29187485.js";import{k as T}from"./icons.346b8028.js";import{C as N}from"./CrudView.acebed42.js";import{f as j}from"./index.b048d0fb.js";import{A as B,a as K}from"./Text.9efc0467.js";import{M as V}from"./transButton.082aab94.js";import"./gateway.c4f59e31.js";import"./activeRecord.7f48ce0d.js";import"./pubsub.6b8c4d65.js";import"./Form.026abd8d.js";import"./Title.d959e45a.js";import"./index.bf56aca1.js";import"./index.cf4c23b9.js";import"./url.12ca99c5.js";import"./index.0ec384bd.js";import"./index.3a0ced65.js";import"./index.b19c9d88.js";import"./index.4b05c792.js";import"./index.d2b2175c.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]="5fc470cc-27eb-403f-a4ed-5c48a9bc4f7a",n._sentryDebugIdIdentifier="sentry-dbid-5fc470cc-27eb-403f-a4ed-5c48a9bc4f7a")}catch{}})();const le=A({__name:"ApiKeys",setup(n){const a=w(null),m=[{key:"name",label:"API key name"}],s=k().params.projectId,{loading:y,result:g,refetch:p}=P(async()=>Promise.all([c.list(s),D.get(s).then(e=>M.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=_(()=>{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:j(o.createdAt,Date.now(),{addSuffix:!0})},{text:(u=r==null?void 0:r.email)!=null?u:"Unknown"},{text:"actions",actions:[{label:"Delete",icon:T,dangerous:!0,onClick:async()=>{await c.delete(s,o.id),p()}}]}]}}))!=null?t:[]}});return(e,t)=>(h(),C(v,null,[i(N,{"entity-name":"API key","create-button-text":"Create API Key",loading:l(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"]),i(l(V),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[i(l(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}),i(l(K),{code:"",copyable:""},{default:d(()=>[f(x(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.edfe9574.js.map
