import{d as A,r as w,eA as C,G as _,b as k,eu as h,f as l,u as i,w as d,b6 as v,az as f,eC as P}from"./outputWidgets.723dbd35.js";import{d as x}from"./index.b41dfd0a.js";import{g as D}from"./icons.d199659e.js";import{a as M}from"./asyncComputed.6087fd05.js";import"./router.c09623bf.js";import"./index.f80aedcf.js";import{M as N}from"./member.21ceaf3b.js";import{A as c}from"./apiKey.6f6daa5c.js";import{P as T}from"./project.47055dba.js";import{C as j}from"./CrudView.ca2cf6ee.js";import{b as K,c as V}from"./index.d0473694.js";import{M as z}from"./Title.ad9727d9.js";import"./Form.71a7af16.js";import"./record.c3c42720.js";import"./pubsub.97441533.js";import"./gateway.ed2ccaa3.js";import"./url.c8598ea1.js";import"./index.4913d787.js";import"./index.f91ebf4c.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]="db297abe-f217-495f-9572-67c17e1172ac",n._sentryDebugIdIdentifier="sentry-dbid-db297abe-f217-495f-9572-67c17e1172ac")}catch{}})();const oe=A({__name:"ApiKeys",setup(n){const a=w(null),m=[{key:"name",label:"API key name"}],s=C().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)})))),b=async e=>{const t=await c.create({projectId:s,name:e.name});p(),a.value=t.value},I=_(()=>{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)=>(k(),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:I.value,fields:m,onCreate:b},null,8,["loading","table"]),l(i(z),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(K),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(V),{code:"",copyable:""},{default:d(()=>[f(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{oe as default};
//# sourceMappingURL=ApiKeys.18fbf427.js.map
