import{C as A}from"./CrudView.9ca73714.js";import{d as _,e as k,ec as x,f as v,o as C,Y as P,b as l,u as i,w as d,aS as h,db as D,aG as f,dc as M,ea as j,cL as N,eM as K,eq as T}from"./index.9cc3d5c7.js";import{a as V}from"./asyncComputed.c4d23a56.js";import{A as c}from"./apiKey.89067d54.js";import"./gateway.22c5659c.js";import{M as B}from"./member.39c9d74f.js";import{a as E}from"./project.7816a4cf.js";import"./tables.76f4fbaa.js";import"./router.72eb9cf0.js";import"./Badge.7e1554af.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.de8ed59e.js";import"./BookOutlined.548b6b44.js";import"./url.185ef886.js";import"./PhDotsThreeVertical.vue.a9a966a9.js";import"./index.14f6514a.js";import"./index.ccd42e69.js";import"./popupNotifcation.37bbe14e.js";import"./record.6b6ff6df.js";import"./string.22f3398b.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]="ac92ceaa-1f4f-4e3b-99f2-f05a794fedc6",n._sentryDebugIdIdentifier="sentry-dbid-ac92ceaa-1f4f-4e3b-99f2-f05a794fedc6")}catch{}})();const oe=_({__name:"ApiKeys",setup(n){const o=k(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,y=new B,{loading:g,result:I,refetch:u}=V(async()=>Promise.all([c.list(s),E.get(s).then(e=>y.list(e.organizationId))]).then(([e,t])=>e.map(a=>({apiKey:a,member:t.find(r=>r.authorId===a.ownerId)})))),b=async e=>{const t=await c.create({projectId:s,name:e.name});u(),o.value=t.value},w=v(()=>{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:a,member:r})=>{var m;return{key:a.id,cells:[{type:"text",text:a.name},{type:"text",text:K(a.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 c.delete(s,a.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(C(),P(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:!!o.value,title:"Api key generated",onCancel:t[0]||(t[0]=a=>o.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(D),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(M),{code:"",copyable:""},{default:d(()=>[f(j(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{oe as default};
//# sourceMappingURL=ApiKeys.9d72e562.js.map
