import{d as A,e as b,eA as _,f as k,o as x,et as C,b as l,u as i,w as d,aD as P,eV as h,eN as v,cP as D,ar as y,cQ as M,ez as N,ct as j}from"./vue-router.637ad36e.js";import{a as T}from"./asyncComputed.0b7f3eaf.js";import{A as c}from"./apiKey.e84685b5.js";import"./gateway.e1c89e24.js";import"./tables.0c659977.js";import{M as V}from"./member.32a75069.js";import{P as K}from"./project.83f082ba.js";import{C as z}from"./CrudView.3cb1fb74.js";import"./popupNotifcation.498cf509.js";import"./record.833ab838.js";import"./string.876500c9.js";import"./router.3a426b39.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.9833e445.js";import"./BookOutlined.c02a6591.js";import"./url.c1cbace3.js";import"./index.ba283bad.js";import"./index.faf7cd82.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]="c507dee6-7f50-4a3c-a1fe-74a1e1c2002d",n._sentryDebugIdIdentifier="sentry-dbid-c507dee6-7f50-4a3c-a1fe-74a1e1c2002d")}catch{}})();const ee=A({__name:"ApiKeys",setup(n){const o=b(null),p=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:u}=T(async()=>Promise.all([c.list(s),K.get(s).then(e=>V.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});u(),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 m;return{key:a.id,cells:[{type:"text",text:a.name},{type:"text",text:h(a.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:v,dangerous:!0,onClick:async()=>{await c.delete(s,a.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(x(),C(P,null,[l(z,{"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(j),{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(N(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ee as default};
//# sourceMappingURL=ApiKeys.1e28b42f.js.map
