import{C as A}from"./CrudView.c10ee41e.js";import{d as _,e as k,ea as x,f as C,o as v,Y as P,b as l,u as i,w as d,aS as h,db as D,aG as y,dc as M,e9 as j,cL as N,eC as K,ep as T}from"./index.abaf3ad4.js";import{a as V}from"./asyncComputed.84aa5ffe.js";import{A as p}from"./apiKey.b12ef2b9.js";import"./gateway.21d52798.js";import{M as B}from"./member.acb88ab2.js";import{a as E}from"./project.0a0bc2f8.js";import"./tables.2b820ae9.js";import"./router.3b57fb6b.js";import"./Badge.05c5a8ba.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.a65e24ff.js";import"./BookOutlined.2ea62891.js";import"./url.8ee60884.js";import"./PhDotsThreeVertical.vue.b754dcc2.js";import"./index.12f607b2.js";import"./index.877779f4.js";import"./popupNotifcation.4879d617.js";import"./record.fee51533.js";import"./string.7a9e8232.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]="03c1f902-9a1a-4ba6-8db8-18e44fe6230b",n._sentryDebugIdIdentifier="sentry-dbid-03c1f902-9a1a-4ba6-8db8-18e44fe6230b")}catch{}})();const ae=_({__name:"ApiKeys",setup(n){const a=k(null),c=[{key:"name",label:"API key name"}],s=x().params.projectId,f=new B,{loading:b,result:g,refetch:u}=V(async()=>Promise.all([p.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)})))),I=async e=>{const t=await p.create({projectId:s,name:e.name});u(),a.value=t.value},w=C(()=>{var e,t;return{columns:[{title:"Name"},{title:"Creation date"},{title:"Owner"},{title:"",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: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 p.delete(s,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),P(h,null,[l(A,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(b),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(N),{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{ae as default};
//# sourceMappingURL=ApiKeys.a71c1b0c.js.map
