import{d as b,q as A,eC as C,J as P,o as _,eu as k,b as l,u as i,w as d,aD as x,eU as v,eP as h,cP as D,ar as y,cQ as M,eG as j,ct as N}from"./vue-router.6b399b0b.js";import{a as K}from"./asyncComputed.c7982027.js";import"./gateway.34f2a318.js";import"./index.c3b84c4d.js";import{M as T}from"./member.7fe830a9.js";import{A as c}from"./apiKey.a79631a3.js";import{P as U}from"./project.ab1d5905.js";import{C as V}from"./CrudView.30543074.js";import"./popupNotifcation.17b9c327.js";import"./record.f5201a57.js";import"./string.79d7b0e1.js";import"./router.ab3f179a.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.e21048fc.js";import"./BookOutlined.7993dbf1.js";import"./url.2f4a4260.js";import"./index.57cdc892.js";import"./index.2e72b67b.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]="8a41725f-3a17-46f4-a730-48bd52c74702",n._sentryDebugIdIdentifier="sentry-dbid-8a41725f-3a17-46f4-a730-48bd52c74702")}catch{}})();const ee=b({__name:"ApiKeys",setup(n){const o=A(null),p=[{key:"name",label:"API key name"}],s=C().params.projectId,{loading:f,result:g,refetch:u}=K(async()=>Promise.all([c.list(s),U.get(s).then(e=>T.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=P(()=>{var e,t;return{columns:[{name:"Name"},{name:"Creation date"},{name:"Owner"},{name:"",align:"right"}],rows:(t=(e=g.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:v(a.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:h,dangerous:!0,onClick:async()=>{await c.delete(s,a.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(_(),k(x,null,[l(V,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(f),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,onCreate: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{ee as default};
//# sourceMappingURL=ApiKeys.ef944302.js.map
