import{d as w,e as A,ea as _,f as k,o as x,X as v,b as l,u as d,w as i,aR as C,da as P,aF as f,db as h,e9 as D,cK as M,eI as j,ep as K}from"./vue-router.25496eb3.js";import{a as N}from"./asyncComputed.ee6673cb.js";import{A as c}from"./apiKey.8d123fb8.js";import"./gateway.090a2504.js";import{M as T}from"./member.e1b975f6.js";import{P as V}from"./project.3bc406d7.js";import"./tables.732c3160.js";import{C as B}from"./CrudView.cf099838.js";import"./popupNotifcation.ea7de34e.js";import"./record.0cf3393b.js";import"./string.cb42bbf3.js";import"./router.92b9eafd.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.c4306070.js";import"./BookOutlined.23f627d4.js";import"./url.d7b430c5.js";import"./PhDotsThreeVertical.vue.eb15d37e.js";import"./Badge.0b8e6d1d.js";import"./index.cdda9ded.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]="3da9fe9c-7f7c-4ba0-a62b-f5b6ddfc8ebd",n._sentryDebugIdIdentifier="sentry-dbid-3da9fe9c-7f7c-4ba0-a62b-f5b6ddfc8ebd")}catch{}})();const te=w({__name:"ApiKeys",setup(n){const o=A(null),p=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,result:b,refetch:u}=N(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)})))),g=async e=>{const t=await c.create({projectId:s,name:e.name});u(),o.value=t.value},I=k(()=>{var e,t;return{columns:[{name:"Name"},{name:"Creation date"},{name:"Owner"},{name:"",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:j(a.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:K,dangerous:!0,onClick:async()=>{await c.delete(s,a.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(x(),v(C,null,[l(B,{"entity-name":"API key","create-button-text":"Create API Key",loading:d(y),title:"API Keys",description:"API Keys are used to deploy your project from the local editor.","empty-title":"No API keys here yet",table:I.value,fields:p,create:g},null,8,["loading","table"]),l(d(M),{open:!!o.value,title:"Api key generated",onCancel:t[0]||(t[0]=a=>o.value=null)},{footer:i(()=>[]),default:i(()=>[l(d(P),null,{default:i(()=>[f("Your API key was successfully generated. Use this code to login on your local development environment or deploy using CI")]),_:1}),l(d(h),{code:"",copyable:""},{default:i(()=>[f(D(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys.df96d4bf.js.map
