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 y,cV as M,f4 as j}from"./outputWidgets.161060e0.js";import{a as V}from"./asyncComputed.23e92968.js";import"./gateway.f2530f68.js";import"./index.f8b37d25.js";import{M as N}from"./member.c124bb38.js";import{A as p}from"./apiKey.e93bf480.js";import{P as K}from"./project.8c2eb876.js";import{C as T}from"./CrudView.121af814.js";import{M as U}from"./Modal.27701131.js";import"./popupNotifcation.f24dac0e.js";import"./record.6a8bcc7f.js";import"./pubsub.ce004d19.js";import"./string.0c0535f5.js";import"./router.42dba988.js";import"./Form.52ea0ff3.js";import"./hasIn.9bea2804.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.c0209c48.js";import"./BookOutlined.c41eff22.js";import"./url.5fda3169.js";import"./index.f997bfa4.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]="9366255e-0069-465e-8b92-4e144ebb5b14",n._sentryDebugIdIdentifier="sentry-dbid-9366255e-0069-465e-8b92-4e144ebb5b14")}catch{}})();const ae=w({__name:"ApiKeys",setup(n){const a=A(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:b,refetch:c}=V(async()=>Promise.all([p.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)})))),g=async e=>{const t=await p.create({projectId:s,name:e.name});c(),a.value=t.value},I=k(()=>{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: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 p.delete(s,o.id),c()}}]}]}}))!=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:I.value,fields:m,onCreate:g},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.205e5cc4.js.map
