import{C as A}from"./CrudView.423d8744.js";import{d as _,e as k,ea as x,f as P,o as v,Y as C,b as l,u as i,w as c,aS as h,db as D,aG as y,dc as M,e9 as j,cL as N,eI as K,ep as T}from"./index.d0f12294.js";import{a as V}from"./asyncComputed.703c33fd.js";import{A as d}from"./apiKey.12cb6e13.js";import"./gateway.ae1d6857.js";import{M as B}from"./member.8ffb8c1d.js";import{P as E}from"./project.fad91605.js";import"./tables.318f703e.js";import"./router.375df57e.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.d6f2b20e.js";import"./BookOutlined.7c922f07.js";import"./url.121c9984.js";import"./PhDotsThreeVertical.vue.d0b16f96.js";import"./Badge.f6241be2.js";import"./index.a82e0ed1.js";import"./popupNotifcation.a0a6244b.js";import"./record.8c284c67.js";import"./string.d9c83adf.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]="6055e87c-5189-43e7-aec0-7cdc19ce0c1b",n._sentryDebugIdIdentifier="sentry-dbid-6055e87c-5189-43e7-aec0-7cdc19ce0c1b")}catch{}})();const oe=_({__name:"ApiKeys",setup(n){const a=k(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,f=new B,{loading:g,result:I,refetch:u}=V(async()=>Promise.all([d.list(s),E.get(s).then(e=>f.list(e.organizationId))]).then(([e,t])=>e.map(o=>({apiKey:o,member:t.find(r=>r.authorId===o.ownerId)})))),b=async e=>{const t=await d.create({projectId:s,name:e.name});u(),a.value=t.value},w=P(()=>{var e,t;return{columns:[{title:"Name"},{title:"Creation date"},{title:"Owner"},{title:"",align:"right"}],rows:(t=(e=I.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:K(o.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:T,dangerous:!0,onClick:async()=>{await d.delete(s,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),C(h,null,[l(A,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(g),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:b},null,8,["loading","table"]),l(i(N),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:c(()=>[]),default:c(()=>[l(i(D),null,{default:c(()=>[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:c(()=>[y(j(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{oe as default};
//# sourceMappingURL=ApiKeys.ade071dc.js.map
