import{d as A,e as b,eu as x,f as _,W as k,b as l,u as i,w as d,aJ as C,eP as P,eI as v,o as h,cW as D,ax as y,cX as M,et as j,cA as N}from"./vue-router.4fd4520f.js";import{a as K}from"./asyncComputed.7c051de7.js";import{A as c}from"./apiKey.71a44137.js";import"./gateway.2e2b2bcf.js";import"./tables.cb9d1914.js";import{M as T}from"./member.2d73db5f.js";import{P as V}from"./project.7b5c9328.js";import{C as B}from"./CrudView.1ccf505e.js";import"./popupNotifcation.b3d7898e.js";import"./record.ab5bf640.js";import"./string.3be91b30.js";import"./router.bb3a61e7.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.50bbaf08.js";import"./BookOutlined.3f1562e1.js";import"./url.d2bb0884.js";import"./PhDotsThree.vue.cfccf254.js";import"./index.b858c0db.js";import"./index.ced107b2.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]="c4a9ba1e-1f80-4add-a665-c18ced663fc0",n._sentryDebugIdIdentifier="sentry-dbid-c4a9ba1e-1f80-4add-a665-c18ced663fc0")}catch{}})();const te=A({__name:"ApiKeys",setup(n){const o=b(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,{loading:f,result:g,refetch:u}=K(async()=>Promise.all([c.list(s),V.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=_(()=>{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:P(a.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:v,dangerous:!0,onClick:async()=>{await c.delete(s,a.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(h(),k(C,null,[l(B,{"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{te as default};
//# sourceMappingURL=ApiKeys.2ff74aec.js.map
