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 y,eD as P}from"./outputWidgets.e33755f8.js";import{d as x}from"./index.9f6d3055.js";import{g as D}from"./icons.f6b19bc0.js";import{a as M}from"./asyncComputed.8bd4aeca.js";import"./authorManager.62b862f9.js";import"./index.0a6756f7.js";import{M as N}from"./member.e4e6430b.js";import{A as m}from"./apiKey.71cba876.js";import{P as T}from"./project.8cd2a0dc.js";import{C as j}from"./CrudView.2f0c3c83.js";import{A as B,a as K}from"./Text.03e848c4.js";import{M as V}from"./Modal.e934f1f6.js";import"./index.cf4c23b9.js";import"./record.fe2d13ca.js";import"./pubsub.d8fbcc91.js";import"./gateway.f3da19f9.js";import"./FormItem.fdb358e6.js";import"./hasIn.5c4a4bf3.js";import"./Form.e78b9235.js";import"./router.8c7b3fad.js";import"./url.3d250afc.js";import"./index.98828044.js";import"./index.58a4a13c.js";import"./Title.ac2baa04.js";import"./index.4b06b554.js";import"./index.72b0b8fe.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]="aa5939b4-bcc7-41b1-9493-677ca108d892",n._sentryDebugIdIdentifier="sentry-dbid-aa5939b4-bcc7-41b1-9493-677ca108d892")}catch{}})();const de=A({__name:"ApiKeys",setup(n){const a=w(null),p=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,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)})))),b=async e=>{const t=await m.create({projectId:s,name:e.name});c(),a.value=t.value},I=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(f),title:"API Keys",description:"API Keys are used to deploy your app from the local editor.","empty-title":"No API keys here yet",table:I.value,fields:p,onCreate:b},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(()=>[y("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(()=>[y(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{de as default};
//# sourceMappingURL=ApiKeys.424d5a01.js.map
