import{d as w,r as A,f1 as _,y as k,b as x,eV as C,f as l,u as i,w as d,ay as v,fj as P,fd as h,cU as D,am as f,cV as M,f4 as j}from"./outputWidgets.9e7bd3a6.js";import{a as V}from"./asyncComputed.fb556333.js";import"./gateway.8fcf86ab.js";import"./index.d38a0669.js";import{M as N}from"./member.7fd328a4.js";import{A as p}from"./apiKey.7067e0ca.js";import{P as K}from"./project.361304cf.js";import{C as T}from"./CrudView.6565f625.js";import{M as U}from"./Modal.41211848.js";import"./popupNotifcation.24d18d49.js";import"./record.dce94ddc.js";import"./pubsub.f3af3eeb.js";import"./string.6d0759d4.js";import"./router.27283135.js";import"./Form.dfca34ad.js";import"./hasIn.35808092.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.548b5f6c.js";import"./BookOutlined.5c7ce856.js";import"./url.1f5e31bf.js";import"./index.a28fbaa6.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]="a5047bf1-753b-4882-b068-cf452e10a345",n._sentryDebugIdIdentifier="sentry-dbid-a5047bf1-753b-4882-b068-cf452e10a345")}catch{}})();const ae=w({__name:"ApiKeys",setup(n){const a=A(null),c=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,result:g,refetch:m}=V(async()=>Promise.all([p.list(s),K.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 p.create({projectId:s,name:e.name});m(),a.value=t.value},I=k(()=>{var e,t;return{columns:[{name:"Name"},{name:"Creation date"},{name:"Owner"},{name:"",align:"right"}],rows:(t=(e=g.value)==null?void 0:e.map(({apiKey:o,member:r})=>{var u;return{key:o.id,cells:[{type:"text",text:o.name},{type:"text",text:P(o.createdAt)},{type:"text",text:(u=r==null?void 0:r.email)!=null?u:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:h,dangerous:!0,onClick:async()=>{await p.delete(s,o.id),m()}}]}]}}))!=null?t:[]}});return(e,t)=>(x(),C(v,null,[l(T,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(y),title:"API Keys",description:"API Keys are used to deploy your project from the local editor.","empty-title":"No API keys here yet",table:I.value,fields:c,onCreate:b},null,8,["loading","table"]),l(i(U),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(D),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(M),{code:"",copyable:""},{default:d(()=>[f(j(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ae as default};
//# sourceMappingURL=ApiKeys.27d7389c.js.map
