import{d as w,e as A,eB as x,f as _,W as k,b as l,u as i,w as d,aJ as C,eW as P,eP as v,o as h,cU as D,ax as y,cV as M,eA as j,cy as N}from"./vue-router.78d58ff0.js";import{a as V}from"./asyncComputed.95993e52.js";import{A as c}from"./apiKey.30a2a914.js";import"./gateway.3d93841d.js";import"./tables.aed54935.js";import{M as B}from"./member.81e254a7.js";import{P as K}from"./project.bfa0c03b.js";import{C as T}from"./CrudView.f04f853e.js";import"./popupNotifcation.466d80c0.js";import"./record.6c05e3f5.js";import"./string.b574f1fa.js";import"./router.ce687edb.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.c6ea29d9.js";import"./BookOutlined.238416cb.js";import"./url.f92f4d36.js";import"./PhDotsThree.vue.4c71ca22.js";import"./index.8e2351ec.js";import"./index.e96c19f7.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]="87fe1594-cb54-4127-8002-34c8fc35fb45",n._sentryDebugIdIdentifier="sentry-dbid-87fe1594-cb54-4127-8002-34c8fc35fb45")}catch{}})();const te=w({__name:"ApiKeys",setup(n){const a=A(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,{loading:f,result:g,refetch:u}=V(async()=>Promise.all([c.list(s),K.get(s).then(e=>B.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 c.create({projectId:s,name:e.name});u(),a.value=t.value},b=_(()=>{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:o,member:r})=>{var m;return{key:o.id,cells:[{type:"text",text:o.name},{type:"text",text:P(o.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,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(h(),k(C,null,[l(T,{"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:b.value,fields:p,onCreate: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{te as default};
//# sourceMappingURL=ApiKeys.530c6fb0.js.map
