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 y,cV as M,f4 as j}from"./outputWidgets.abde7be7.js";import{a as V}from"./asyncComputed.e188c84d.js";import"./gateway.e5c93921.js";import"./index.2e366912.js";import{M as N}from"./member.cd96ab58.js";import{A as c}from"./apiKey.bb85ff40.js";import{P as K}from"./project.0d7f508d.js";import{C as T}from"./CrudView.d2e5841c.js";import{M as U}from"./Modal.b9769244.js";import"./popupNotifcation.51a8836c.js";import"./record.4adc9d27.js";import"./pubsub.7f579dee.js";import"./router.aff593c1.js";import"./Form.8489fb6d.js";import"./hasIn.b8f131ab.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.2107de83.js";import"./BookOutlined.ef6ccb36.js";import"./url.578d50c3.js";import"./index.42ebfb5e.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]="a257a939-8259-4156-9dab-f937d8ec2982",n._sentryDebugIdIdentifier="sentry-dbid-a257a939-8259-4156-9dab-f937d8ec2982")}catch{}})();const ae=b({__name:"ApiKeys",setup(n){const o=A(null),p=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,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(f),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(()=>[y("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(()=>[y(j(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ae as default};
//# sourceMappingURL=ApiKeys.4023c093.js.map
