import{d as w,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 f,cV as M,f4 as j}from"./outputWidgets.bff33647.js";import{a as V}from"./asyncComputed.ce6d6eed.js";import"./gateway.fd75c1ba.js";import"./index.b40d3bd7.js";import{M as N}from"./member.05645a72.js";import{A as c}from"./apiKey.d7699537.js";import{P as K}from"./project.59dce00d.js";import{C as T}from"./CrudView.8a89e4ec.js";import{M as U}from"./Modal.b7012161.js";import"./popupNotifcation.29ddd2ec.js";import"./record.29a71a1c.js";import"./pubsub.897f848f.js";import"./router.8006b2c4.js";import"./Form.70e7f6b0.js";import"./hasIn.edcda2a9.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.2be6635f.js";import"./BookOutlined.62d0439b.js";import"./url.9e111d9b.js";import"./index.652b8bc4.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]="45ba1012-facd-4054-ad20-dd85159b9bff",n._sentryDebugIdIdentifier="sentry-dbid-45ba1012-facd-4054-ad20-dd85159b9bff")}catch{}})();const ae=w({__name:"ApiKeys",setup(n){const o=A(null),p=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,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(a=>({apiKey:a,member:t.find(r=>r.authorId===a.ownerId)})))),b=async e=>{const t=await c.create({projectId:s,name:e.name});m(),o.value=t.value},I=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:a,member:r})=>{var u;return{key:a.id,cells:[{type:"text",text:a.name},{type:"text",text:P(a.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,a.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(y),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:b},null,8,["loading","table"]),l(i(U),{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(()=>[f("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(()=>[f(j(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ae as default};
//# sourceMappingURL=ApiKeys.d7eaa6e3.js.map
