import{d as A,r as w,eB as _,H as k,b as v,ev as x,f as i,u as l,w as p,aD as C,eP as P,ar as f,eD as h}from"./outputWidgets.84400f3d.js";import{i as D}from"./icons.51c500b8.js";import{a as M}from"./asyncComputed.f2a51feb.js";import"./router.6e29c40f.js";import"./index.575f21cf.js";import{M as N}from"./member.448de3ec.js";import{A as d}from"./apiKey.e3163889.js";import{P as T}from"./project.6de3a389.js";import{C as j}from"./CrudView.ff2ba196.js";import{A as B}from"./Paragraph.4b47bceb.js";import{A as K}from"./Text.471d0d00.js";import{M as V}from"./Modal.d808afee.js";import"./Form.d05a1b22.js";import"./hasIn.bbea906d.js";import"./popupNotifcation.d06c16fd.js";import"./index.cf4c23b9.js";import"./record.a1f907ea.js";import"./pubsub.87032f37.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.6b27b5c3.js";import"./url.32b2d17f.js";import"./index.fa6ccec8.js";import"./Title.77255753.js";import"./Base.5abbd37f.js";import"./Typography.d06ce724.js";import"./index.f01295b9.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]="794e98c1-a65f-4090-9380-bc92fcf426b1",n._sentryDebugIdIdentifier="sentry-dbid-794e98c1-a65f-4090-9380-bc92fcf426b1")}catch{}})();const le=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([d.list(s),T.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 d.create({projectId:s,name:e.name});c(),a.value=t.value},b=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:D,dangerous:!0,onClick:async()=>{await d.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),x(C,null,[i(j,{"entity-name":"API key","create-button-text":"Create API Key",loading:l(y),title:"API Keys",description:"API Keys are used to deploy your app from the local editor.","empty-title":"No API keys here yet",table:b.value,fields:m,onCreate:I},null,8,["loading","table"]),i(l(V),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:p(()=>[]),default:p(()=>[i(l(B),null,{default:p(()=>[f("Your API key was successfully generated. Use this code to login on your local development environment or deploy using CI")]),_:1}),i(l(K),{code:"",copyable:""},{default:p(()=>[f(h(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.7df82dcb.js.map
