import{d as b,r as A,f1 as _,y as k,b as x,eV as C,f as l,u as i,w as d,ay as v,fj as P,fd as h,cU as D,am as y,cV as M,f4 as j}from"./outputWidgets.ac6cd083.js";import{a as V}from"./asyncComputed.9193ddba.js";import"./gateway.7df23bb5.js";import"./index.b64d2bf2.js";import{M as N}from"./member.26b3992d.js";import{A as c}from"./apiKey.9a6a71ac.js";import{P as K}from"./project.5e33bc35.js";import{C as T}from"./CrudView.d6db1351.js";import{M as U}from"./Modal.1a3291a2.js";import"./popupNotifcation.bfef6e4c.js";import"./record.9a0f3e6a.js";import"./pubsub.ead516dd.js";import"./string.0e36ef9a.js";import"./router.e7c73114.js";import"./Form.f2d1ae9b.js";import"./hasIn.aae3ac3f.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.1b2ad75a.js";import"./BookOutlined.ea51c13c.js";import"./url.d933d93f.js";import"./index.24c3a2c4.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]="05b2ce9c-4d0d-42a3-97f2-297cc210897c",n._sentryDebugIdIdentifier="sentry-dbid-05b2ce9c-4d0d-42a3-97f2-297cc210897c")}catch{}})();const ae=b({__name:"ApiKeys",setup(n){const a=A(null),p=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:m}=V(async()=>Promise.all([c.list(s),K.get(s).then(e=>N.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});m(),a.value=t.value},w=k(()=>{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 u;return{key:o.id,cells:[{type:"text",text:o.name},{type:"text",text:P(o.createdAt)},{type:"text",text:(u=r==null?void 0:r.email)!=null?u:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:h,dangerous:!0,onClick:async()=>{await c.delete(s,o.id),m()}}]}]}}))!=null?t:[]}});return(e,t)=>(x(),C(v,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:w.value,fields:p,onCreate:I},null,8,["loading","table"]),l(i(U),{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{ae as default};
//# sourceMappingURL=ApiKeys.8d24c055.js.map
