import{d as w,e as A,eu as x,f as _,W as k,b as l,u as d,w as i,aJ as C,eP as P,eI as v,o as h,cW as D,ax as y,cX as M,et as j,cA as N}from"./vue-router.33ac8cf0.js";import{a as K}from"./asyncComputed.9837140d.js";import{A as c}from"./apiKey.608596b4.js";import"./gateway.b01778f9.js";import{M as T}from"./member.ec0899a2.js";import{P as V}from"./project.58eaf0c1.js";import"./tables.aea27d65.js";import{C as B}from"./CrudView.4178d97f.js";import"./popupNotifcation.6b8971b6.js";import"./record.88671b98.js";import"./string.cf4460b1.js";import"./router.431f1655.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.e2bbbfd3.js";import"./BookOutlined.c6692cb9.js";import"./url.d6d42cf8.js";import"./PhDotsThree.vue.34aeb4af.js";import"./index.4deb3bba.js";import"./index.f737d7de.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]="791699db-8d53-4410-aee6-6bda4dbf65da",n._sentryDebugIdIdentifier="sentry-dbid-791699db-8d53-4410-aee6-6bda4dbf65da")}catch{}})();const te=w({__name:"ApiKeys",setup(n){const o=A(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,{loading:f,result:g,refetch:u}=K(async()=>Promise.all([c.list(s),V.get(s).then(e=>T.list(e.organizationId))]).then(([e,t])=>e.map(a=>({apiKey:a,member:t.find(r=>r.authorId===a.ownerId)})))),b=async e=>{const t=await c.create({projectId:s,name:e.name});u(),o.value=t.value},I=_(()=>{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:P(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)=>(h(),k(C,null,[l(B,{"entity-name":"API key","create-button-text":"Create API Key",loading:d(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:I.value,fields:p,onCreate:b},null,8,["loading","table"]),l(d(N),{open:!!o.value,title:"Api key generated",onCancel:t[0]||(t[0]=a=>o.value=null)},{footer:i(()=>[]),default:i(()=>[l(d(D),null,{default:i(()=>[y("Your API key was successfully generated. Use this code to login on your local development environment or deploy using CI")]),_:1}),l(d(M),{code:"",copyable:""},{default:i(()=>[y(j(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys.775bf26a.js.map
