import{d as b,e as A,ed as _,f as k,X as x,b as l,u as i,w as d,aR as v,o as C,d7 as P,aF as f,d8 as h,ec as D,cH as M,eJ as j,er as N}from"./vue-router.663e4641.js";import{a as K}from"./asyncComputed.91dd9b14.js";import{A as c}from"./apiKey.6c4e52f3.js";import"./gateway.b2447a0d.js";import{M as T}from"./member.51ed5274.js";import{P as V}from"./project.5ce04779.js";import"./tables.302d4487.js";import{C as B}from"./CrudView.a0f1d792.js";import"./popupNotifcation.83d36381.js";import"./record.48f7790f.js";import"./string.3b77754c.js";import"./router.d3a61be6.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.53c977b2.js";import"./BookOutlined.a08e774b.js";import"./url.23e7d6b6.js";import"./PhDotsThreeVertical.vue.ba797c3e.js";import"./Badge.24c8de5e.js";import"./index.108b4fb6.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]="0b8f560c-047e-4e97-8e5f-90f17acf5f50",n._sentryDebugIdIdentifier="sentry-dbid-0b8f560c-047e-4e97-8e5f-90f17acf5f50")}catch{}})();const te=b({__name:"ApiKeys",setup(n){const a=A(null),p=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,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},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 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:i(y),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:p,create:I},null,8,["loading","table"]),l(i(M),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(P),null,{default:d(()=>[f("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(()=>[f(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys.d5703263.js.map
