import{d as b,e as A,ea as _,f as k,o as x,X as v,b as l,u as d,w as i,aR as C,d7 as P,aF as y,d8 as h,e9 as D,cH as M,eI as j,ep as N}from"./vue-router.2dfeb709.js";import{a as K}from"./asyncComputed.d236b901.js";import{A as p}from"./apiKey.6f7517b8.js";import"./gateway.f21c3c00.js";import{M as T}from"./member.f0aa2f19.js";import{P as V}from"./project.c5a11136.js";import"./tables.843bcdcf.js";import{C as B}from"./CrudView.f65519c2.js";import"./popupNotifcation.b6ed4c39.js";import"./record.a5650be1.js";import"./string.92e45c6b.js";import"./router.dafb8c51.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.b5277234.js";import"./BookOutlined.25147a11.js";import"./url.052bc6c8.js";import"./PhDotsThreeVertical.vue.b5648f64.js";import"./Badge.4e64bc72.js";import"./index.5e221b09.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]="20566af8-2d90-4dd1-99d6-1989fd8b0277",n._sentryDebugIdIdentifier="sentry-dbid-20566af8-2d90-4dd1-99d6-1989fd8b0277")}catch{}})();const te=b({__name:"ApiKeys",setup(n){const a=A(null),c=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:u}=K(async()=>Promise.all([p.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 p.create({projectId:s,name:e.name});u(),a.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: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 p.delete(s,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(x(),v(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:w.value,fields:c,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.78cb97db.js.map
