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.3acae187.js";import{d as x}from"./index.30e21000.js";import{g as D}from"./icons.238cb834.js";import{a as M}from"./asyncComputed.4acb40f3.js";import"./router.330b5ee2.js";import"./index.330e6f4e.js";import{M as N}from"./member.3c94dbe0.js";import{A as m}from"./apiKey.717eb87b.js";import{P as T}from"./project.7c8c0251.js";import{C as j}from"./CrudView.ad3897c2.js";import{b as K,c as V}from"./index.d2e87b7c.js";import{M as z}from"./Title.b0254e64.js";import"./Form.01134ed5.js";import"./record.8667ddd6.js";import"./pubsub.bc590f31.js";import"./gateway.d73b54c4.js";import"./url.ba80c662.js";import"./index.a63dba09.js";import"./index.72042afd.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]="9b6505ff-39db-4ba3-b418-aa67d56bd6a4",n._sentryDebugIdIdentifier="sentry-dbid-9b6505ff-39db-4ba3-b418-aa67d56bd6a4")}catch{}})();const oe=A({__name:"ApiKeys",setup(n){const a=w(null),p=[{key:"name",label:"API key name"}],s=C().params.projectId,{loading:y,result:b,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)})))),g=async e=>{const t=await m.create({projectId:s,name:e.name});c(),a.value=t.value},I=_(()=>{var e,t;return{columns:[{name:"Name"},{name:"Creation date"},{name:"Owner"},{name:"Actions",align:"right"}],rows:(t=(e=b.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)=>(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:p,onCreate:g},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.3725a878.js.map
