import{d as w,r as A,eC as C,K as P,b as _,eu as k,f as l,u as i,w as d,aD as x,eU as v,eP as h,cP as D,ar as y,cQ as M,eG as j,ct as K}from"./vue-router.67809441.js";import{a as N}from"./asyncComputed.c6a51599.js";import"./gateway.e3e12758.js";import"./index.faf1d629.js";import{M as T}from"./member.96916995.js";import{A as c}from"./apiKey.06894aba.js";import{P as U}from"./project.ba35830e.js";import{C as V}from"./CrudView.6a433a98.js";import"./popupNotifcation.c8631a6a.js";import"./record.79dce665.js";import"./string.d96a9f97.js";import"./router.f4c6c59f.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.30df229c.js";import"./BookOutlined.aea72855.js";import"./url.bf0f022f.js";import"./index.bad8e5d7.js";import"./index.31900902.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]="6fb0eb5a-a0ba-41b0-8cca-8fc5cde79f11",n._sentryDebugIdIdentifier="sentry-dbid-6fb0eb5a-a0ba-41b0-8cca-8fc5cde79f11")}catch{}})();const ee=w({__name:"ApiKeys",setup(n){const o=A(null),p=[{key:"name",label:"API key name"}],s=C().params.projectId,{loading:f,result:b,refetch:u}=N(async()=>Promise.all([c.list(s),U.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=P(()=>{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:v(a.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:h,dangerous:!0,onClick:async()=>{await c.delete(s,a.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(_(),k(x,null,[l(V,{"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:I.value,fields:p,onCreate:g},null,8,["loading","table"]),l(i(K),{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{ee as default};
//# sourceMappingURL=ApiKeys.96280d19.js.map
