import{C as A}from"./CrudView.c9a70a38.js";import{d as _,f as k,e4 as x,g as P,K as v,b as l,u as i,w as d,aL as C,o as h,d4 as D,az as y,d5 as M,eb as j,cE as K,eR as N,es as E}from"./index.b7bd503f.js";import{a as T}from"./asyncComputed.d7c4e941.js";import{A as c}from"./apiKey.0a4162de.js";import"./gateway.6db311e2.js";import{M as V}from"./member.409d2e96.js";import{P as z}from"./project.1a8e28e5.js";import"./columns.c99cb402.js";import"./router.7c58172b.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.a6841fb4.js";import"./url.c0ede6d9.js";import"./PhDotsThreeVertical.vue.5c0a03a4.js";import"./Badge.53ab4d2d.js";import"./index.173038d0.js";import"./index.78ee4489.js";import"./popupNotifcation.bbf38424.js";import"./record.c86f39d9.js";import"./string.9a3a939b.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]="7833315a-56bf-42e0-af09-3925e1690c6f",n._sentryDebugIdIdentifier="sentry-dbid-7833315a-56bf-42e0-af09-3925e1690c6f")}catch{}})();const oe=_({__name:"ApiKeys",setup(n){const a=k(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,f=new V,{loading:g,result:I,refetch:u}=T(async()=>Promise.all([c.list(s),z.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 c.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:N(o.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:E,dangerous:!0,onClick:async()=>{await c.delete(s,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(h(),v(C,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(K),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(D),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(M),{code:"",copyable:""},{default:d(()=>[y(j(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{oe as default};
//# sourceMappingURL=ApiKeys.de616df2.js.map
