import{C as A}from"./CrudView.b22901d4.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.f34a21df.js";import{a as V}from"./asyncComputed.398aef1d.js";import{A as c}from"./apiKey.c1525272.js";import"./gateway.2694bf1d.js";import{M as B}from"./member.489fda83.js";import{a as E}from"./project.74b7e3d5.js";import"./tables.04ce2dd0.js";import"./router.2b2bf682.js";import"./Badge.71e1a2a7.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.bee69fdc.js";import"./BookOutlined.6615ca40.js";import"./url.6d3c9ba6.js";import"./PhDotsThreeVertical.vue.a865b0cd.js";import"./index.9470b370.js";import"./index.e62b176f.js";import"./popupNotifcation.5e450e3b.js";import"./record.ca0bcbf9.js";import"./string.258cabc4.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]="390a4a1b-9a63-483e-a4cc-95064db7564a",n._sentryDebugIdIdentifier="sentry-dbid-390a4a1b-9a63-483e-a4cc-95064db7564a")}catch{}})();const oe=_({__name:"ApiKeys",setup(n){const o=k(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,f=new B,{loading:g,result:b,refetch:u}=V(async()=>Promise.all([c.list(s),E.get(s).then(e=>f.list(e.organizationId))]).then(([e,t])=>e.map(a=>({apiKey:a,member:t.find(r=>r.authorId===a.ownerId)})))),I=async e=>{const t=await c.create({projectId:s,name:e.name});u(),o.value=t.value},w=C(()=>{var e,t;return{columns:[{title:"Name"},{title:"Creation date"},{title:"Owner"},{title:"",align:"right"}],rows:(t=(e=b.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)=>(v(),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:I},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(()=>[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(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{oe as default};
//# sourceMappingURL=ApiKeys.94d2ba66.js.map
