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.5e8ba7eb.js";import{a as K}from"./asyncComputed.bb3077bb.js";import{A as c}from"./apiKey.832668bf.js";import"./gateway.9bb9fef7.js";import{M as T}from"./member.1f7eb939.js";import{P as V}from"./project.c53d1849.js";import"./tables.8dccf3c7.js";import{C as B}from"./CrudView.d77e910d.js";import"./popupNotifcation.b3ef9d8a.js";import"./record.98df87df.js";import"./string.3bd1e390.js";import"./router.1e5228d6.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.af476096.js";import"./BookOutlined.bf415405.js";import"./url.4683fc99.js";import"./PhDotsThree.vue.5061c9cb.js";import"./index.d0fd73d7.js";import"./index.806e571e.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]="a60a8331-01e2-45fa-8fc4-4a236f0952cc",n._sentryDebugIdIdentifier="sentry-dbid-a60a8331-01e2-45fa-8fc4-4a236f0952cc")}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.5fb7f278.js.map
