import{d as b,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.049ac64d.js";import{a as V}from"./asyncComputed.ea730548.js";import"./gateway.c0f62b43.js";import"./index.060492c3.js";import{M as N}from"./member.c80f56a4.js";import{A as c}from"./apiKey.f48b2c4f.js";import{P as K}from"./project.45e8c172.js";import{C as T}from"./CrudView.ea10c7da.js";import{M as U}from"./Modal.dcfdf87a.js";import"./popupNotifcation.836c9a92.js";import"./record.5a9ec5fd.js";import"./pubsub.0c3367ed.js";import"./string.3fb102a6.js";import"./router.2632e2a3.js";import"./Form.8d97bd19.js";import"./hasIn.8c8d3925.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.07720f16.js";import"./BookOutlined.d451bbc7.js";import"./url.bfc1d6a1.js";import"./index.dae82177.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[o]="f0aa6254-cd7d-4823-9bdf-f63c7aed17d6",n._sentryDebugIdIdentifier="sentry-dbid-f0aa6254-cd7d-4823-9bdf-f63c7aed17d6")}catch{}})();const oe=b({__name:"ApiKeys",setup(n){const o=A(null),p=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,result:g,refetch:m}=V(async()=>Promise.all([c.list(s),K.get(s).then(e=>N.list(e.organizationId))]).then(([e,t])=>e.map(a=>({apiKey:a,member:t.find(r=>r.authorId===a.ownerId)})))),I=async e=>{const t=await c.create({projectId:s,name:e.name});m(),o.value=t.value},w=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:a,member:r})=>{var u;return{key:a.id,cells:[{type:"text",text:a.name},{type:"text",text:P(a.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 c.delete(s,a.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:w.value,fields:p,onCreate:I},null,8,["loading","table"]),l(i(U),{open:!!o.value,title:"Api key generated",onCancel:t[0]||(t[0]=a=>o.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(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{oe as default};
//# sourceMappingURL=ApiKeys.e0f5419b.js.map
