import{d as A,r as w,eD as _,I as k,b as v,ev as x,f as l,u as i,w as d,aD as C,eT as h,eR as P,ar as f,eG as D}from"./outputWidgets.a321903e.js";import{a as M}from"./asyncComputed.78ec0807.js";import"./router.2245534d.js";import"./index.579b421e.js";import{M as T}from"./member.480b23d1.js";import{A as p}from"./apiKey.b1659a15.js";import{P as j}from"./project.948c46ba.js";import{C as N}from"./CrudView.b2407c91.js";import{A as K}from"./Paragraph.53f5a9bc.js";import{A as V}from"./Text.b25e1b1d.js";import{M as B}from"./Modal.bcb9f272.js";import"./Form.e0cc6e8e.js";import"./hasIn.62bbbac0.js";import"./popupNotifcation.43dee970.js";import"./record.d39119c8.js";import"./pubsub.df0290b2.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.29f4fec4.js";import"./BookOutlined.425445e6.js";import"./url.d108fea5.js";import"./index.fd9a3d7c.js";import"./Title.e1cf3e99.js";import"./index.211632ef.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]="a874bf54-e022-40fe-b977-4e85da4f54bc",n._sentryDebugIdIdentifier="sentry-dbid-a874bf54-e022-40fe-b977-4e85da4f54bc")}catch{}})();const re=A({__name:"ApiKeys",setup(n){const a=w(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,result:g,refetch:c}=M(async()=>Promise.all([p.list(s),j.get(s).then(e=>T.list(e.organizationId))]).then(([e,t])=>e.map(o=>({apiKey:o,member:t.find(r=>r.authorId===o.ownerId)})))),b=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=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:h(o.createdAt)},{type:"text",text:(u=r==null?void 0:r.email)!=null?u:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:P,dangerous:!0,onClick:async()=>{await p.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),x(C,null,[l(N,{"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:m,onCreate:b},null,8,["loading","table"]),l(i(B),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(K),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(V),{code:"",copyable:""},{default:d(()=>[f(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{re as default};
//# sourceMappingURL=ApiKeys.e209ff60.js.map
