import{d as w,e as A,e7 as x,f as _,W as k,b as l,u as i,w as d,aJ as C,es as v,el as P,o as h,d3 as D,ax as y,d4 as M,e6 as j,cE as N}from"./vue-router.d9feb5a3.js";import{a as E}from"./asyncComputed.5aa790b6.js";import{A as c}from"./apiKey.2bbee078.js";import"./gateway.bcb6c1cd.js";import{M as K}from"./member.7f006530.js";import{P as T}from"./project.210608ba.js";import"./tables.97f7d64d.js";import{C as V}from"./CrudView.00ba8ddf.js";import"./popupNotifcation.326ad4ba.js";import"./record.6cf0986e.js";import"./string.c0b64362.js";import"./router.3320320c.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.7780e068.js";import"./BookOutlined.06277ca0.js";import"./url.99c6614b.js";import"./PhDotsThreeVertical.vue.83d724ac.js";import"./index.3ceffa89.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]="3c8939b6-6829-4378-a84b-f9bcb194a9a7",n._sentryDebugIdIdentifier="sentry-dbid-3c8939b6-6829-4378-a84b-f9bcb194a9a7")}catch{}})();const ee=w({__name:"ApiKeys",setup(n){const o=A(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,{loading:f,result:b,refetch:u}=E(async()=>Promise.all([c.list(s),T.get(s).then(e=>K.list(e.organizationId))]).then(([e,t])=>e.map(a=>({apiKey:a,member:t.find(r=>r.authorId===a.ownerId)})))),g=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=b.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:v(a.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:P,dangerous:!0,onClick:async()=>{await c.delete(s,a.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(h(),k(C,null,[l(V,{"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:I.value,fields:p,onCreate:g},null,8,["loading","table"]),l(i(N),{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{ee as default};
//# sourceMappingURL=ApiKeys.bf01c57a.js.map
