import{d as b,e as A,e7 as x,f as _,W as k,b as l,u as d,w as i,aJ as C,es as v,el as P,o as h,d3 as D,ax as y,d4 as M,e6 as j,cE as N}from"./vue-router.97d0d8a6.js";import{a as E}from"./asyncComputed.72143f3b.js";import{A as c}from"./apiKey.f9b6598e.js";import"./gateway.91a35dd3.js";import{M as K}from"./member.b372aa93.js";import{P as T}from"./project.52eb4019.js";import"./tables.8944c1e2.js";import{C as V}from"./CrudView.797f086e.js";import"./popupNotifcation.80047f06.js";import"./record.a84b6d90.js";import"./string.4a3650cc.js";import"./router.bf9d2a86.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.05d4ef76.js";import"./BookOutlined.868baafb.js";import"./url.6a6403b0.js";import"./PhDotsThree.vue.3d83613d.js";import"./index.557e8025.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]="0f8d2a04-aeed-48b2-8de9-fcfd8aa1a1e2",n._sentryDebugIdIdentifier="sentry-dbid-0f8d2a04-aeed-48b2-8de9-fcfd8aa1a1e2")}catch{}})();const ee=b({__name:"ApiKeys",setup(n){const o=A(null),p=[{key:"name",label:"API key name"}],s=x().params.projectId,{loading:f,result:g,refetch:u}=E(async()=>Promise.all([c.list(s),T.get(s).then(e=>K.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:v(a.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:P,dangerous:!0,onClick:async()=>{await c.delete(s,a.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(h(),k(C,null,[l(V,{"entity-name":"API key","create-button-text":"Create API Key",loading:d(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(d(N),{open:!!o.value,title:"Api key generated",onCancel:t[0]||(t[0]=a=>o.value=null)},{footer:i(()=>[]),default:i(()=>[l(d(D),null,{default:i(()=>[y("Your API key was successfully generated. Use this code to login on your local development environment or deploy using CI")]),_:1}),l(d(M),{code:"",copyable:""},{default:i(()=>[y(j(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ee as default};
//# sourceMappingURL=ApiKeys.08f990a4.js.map
