import{d as A,r as w,eB as _,G as k,b as v,ev as C,f as i,u as l,w as d,bq as h,aq as f,eD as P}from"./outputWidgets.396f5ce1.js";import{d as x}from"./index.f3919413.js";import{g as D}from"./icons.37b6f90f.js";import{a as M}from"./asyncComputed.95737324.js";import"./router.898a5ca4.js";import"./index.d80eeb49.js";import{M as N}from"./member.60f79ce4.js";import{A as m}from"./apiKey.7a8bcd26.js";import{P as T}from"./project.e7f48580.js";import{C as j}from"./CrudView.ece8081d.js";import{A as B,a as K}from"./Text.4e180dc2.js";import{M as V}from"./Modal.c02a2840.js";import"./FormItem.a8de7296.js";import"./hasIn.63a13365.js";import"./index.cf4c23b9.js";import"./record.1aff3d29.js";import"./pubsub.06faa612.js";import"./gateway.a0e7cb55.js";import"./Form.716e7fa5.js";import"./url.4e42e1d0.js";import"./index.645b3e28.js";import"./index.a44632c5.js";import"./Title.819eb0fe.js";import"./Base.ee1dde08.js";import"./index.f0384574.js";import"./index.a23873b5.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]="f9b3d295-8f46-4dc5-ab73-d0e0c269f90c",n._sentryDebugIdIdentifier="sentry-dbid-f9b3d295-8f46-4dc5-ab73-d0e0c269f90c")}catch{}})();const de=A({__name:"ApiKeys",setup(n){const a=w(null),p=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,result:g,refetch:c}=M(async()=>Promise.all([m.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 m.create({projectId:s,name:e.name});c(),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 m.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),C(h,null,[i(j,{"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:p,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(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{de as default};
//# sourceMappingURL=ApiKeys.5e649b62.js.map
