import{d as w,e as A,ed as _,f as k,X as x,b as l,u as d,w as i,aR as v,o as C,d7 as P,aF as y,d8 as h,ec as D,cH as M,eJ as j,er as N}from"./vue-router.c5124aea.js";import{a as K}from"./asyncComputed.492220e2.js";import{A as c}from"./apiKey.f4c1f7ba.js";import"./gateway.f0a8a4c2.js";import{M as T}from"./member.5f10a588.js";import{P as V}from"./project.0a5e591f.js";import"./tables.e3d4a0cb.js";import{C as B}from"./CrudView.c3cfdbe0.js";import"./popupNotifcation.13f7057e.js";import"./record.3c40de6b.js";import"./string.243c4431.js";import"./router.09f8c7fd.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.ee60e4e5.js";import"./BookOutlined.4a8c6e69.js";import"./url.a882d197.js";import"./PhDotsThreeVertical.vue.db7af6ac.js";import"./Badge.2abe7f2d.js";import"./index.31f5d814.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="dcec999c-0d12-450e-be10-837b71d15df7",n._sentryDebugIdIdentifier="sentry-dbid-dcec999c-0d12-450e-be10-837b71d15df7")}catch{}})();const te=w({__name:"ApiKeys",setup(n){const a=A(null),p=[{key:"name",label:"API key name"}],s=_().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(o=>({apiKey:o,member:t.find(r=>r.authorId===o.ownerId)})))),I=async e=>{const t=await c.create({projectId:s,name:e.name});u(),a.value=t.value},b=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:o,member:r})=>{var m;return{key:o.id,cells:[{type:"text",text:o.name},{type:"text",text:j(o.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:N,dangerous:!0,onClick:async()=>{await c.delete(s,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(C(),x(v,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:b.value,fields:p,create:I},null,8,["loading","table"]),l(d(M),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:i(()=>[]),default:i(()=>[l(d(P),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(h),{code:"",copyable:""},{default:i(()=>[y(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys.f37b61c8.js.map
