import{d as A,e as b,ea as _,f as k,o as x,X as v,b as l,u as i,w as d,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.e3ef87f0.js";import{a as K}from"./asyncComputed.e840076d.js";import{A as p}from"./apiKey.eeb482c2.js";import"./gateway.e3730daa.js";import{M as T}from"./member.d7c647e6.js";import{P as V}from"./project.1af02886.js";import"./tables.8b5b16f2.js";import{C as B}from"./CrudView.6dee12dd.js";import"./popupNotifcation.bf248d47.js";import"./record.9f354c97.js";import"./string.5524ff61.js";import"./router.7553e78c.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.7e26700d.js";import"./BookOutlined.2206ef88.js";import"./url.d7fc9f74.js";import"./PhDotsThreeVertical.vue.4a059a70.js";import"./Badge.e09547ac.js";import"./index.45410f8d.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]="44d5553e-4791-4712-a4d6-381420164a39",n._sentryDebugIdIdentifier="sentry-dbid-44d5553e-4791-4712-a4d6-381420164a39")}catch{}})();const te=A({__name:"ApiKeys",setup(n){const o=b(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(a=>({apiKey:a,member:t.find(r=>r.authorId===a.ownerId)})))),I=async e=>{const t=await p.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:j(a.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,a.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(x(),v(C,null,[l(B,{"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:c,create:I},null,8,["loading","table"]),l(i(M),{open:!!o.value,title:"Api key generated",onCancel:t[0]||(t[0]=a=>o.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(P),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(h),{code:"",copyable:""},{default:d(()=>[y(D(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys.3a8bceff.js.map
