import{d as w,r as b,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 y,eG as D}from"./outputWidgets.0112c29a.js";import{a as M}from"./asyncComputed.7a4cd8c0.js";import"./router.baccdf57.js";import"./index.01d20c53.js";import{M as T}from"./member.6f48e0d6.js";import{A as p}from"./apiKey.046a1826.js";import{P as j}from"./project.1337f9c2.js";import{C as N}from"./CrudView.24263641.js";import{A as K}from"./Paragraph.a79b7e0d.js";import{A as V}from"./Text.7fd7d6e4.js";import{M as B}from"./Modal.4672b2be.js";import"./Form.f084c7e0.js";import"./hasIn.9ed92b42.js";import"./popupNotifcation.b5f4e167.js";import"./record.63beb4c2.js";import"./pubsub.bc9264fd.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.e7adff9f.js";import"./BookOutlined.cb11abba.js";import"./url.3a6cd3b5.js";import"./index.0b86c71c.js";import"./Title.06b9fc65.js";import"./index.84aac883.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]="d56aaab6-33c0-4eca-82ac-7ad2ee655434",n._sentryDebugIdIdentifier="sentry-dbid-d56aaab6-33c0-4eca-82ac-7ad2ee655434")}catch{}})();const re=w({__name:"ApiKeys",setup(n){const o=b(null),c=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:m}=M(async()=>Promise.all([p.list(s),j.get(s).then(e=>T.list(e.organizationId))]).then(([e,t])=>e.map(a=>({apiKey:a,member:t.find(r=>r.authorId===a.ownerId)})))),I=async e=>{const t=await p.create({projectId:s,name:e.name});m(),o.value=t.value},A=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:h(a.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,a.id),m()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),x(C,null,[l(N,{"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:A.value,fields:c,onCreate:I},null,8,["loading","table"]),l(i(B),{open:!!o.value,title:"Api key generated",onCancel:t[0]||(t[0]=a=>o.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(K),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(V),{code:"",copyable:""},{default:d(()=>[y(D(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{re as default};
//# sourceMappingURL=ApiKeys.fde48a1b.js.map
