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 d,aD as C,f8 as h,ar as y,eD as P}from"./outputWidgets.91c9f730.js";import{i as D}from"./icons.e854b740.js";import{a as M}from"./asyncComputed.5cff1726.js";import"./router.e4c5e9fd.js";import"./index.7bd5dae7.js";import{M as N}from"./member.5d7afdf8.js";import{A as p}from"./apiKey.0c9ea5fd.js";import{P as T}from"./project.7d6dd25e.js";import{C as j}from"./CrudView.d1c2398f.js";import{A as B}from"./Paragraph.18e7082b.js";import{A as K}from"./Text.2f03529d.js";import{M as V}from"./Modal.41a7632f.js";import"./Form.f24a1c0a.js";import"./hasIn.d8588324.js";import"./popupNotifcation.e7a2b93a.js";import"./index.cf4c23b9.js";import"./record.48aae23b.js";import"./pubsub.25829540.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.05ceca6e.js";import"./url.bd840ee9.js";import"./index.5a63d36f.js";import"./Title.69e80303.js";import"./Base.79932679.js";import"./Typography.c7c5698a.js";import"./index.946fdb2e.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]="e1d89b88-4a1f-45eb-a9eb-88dd563316e7",n._sentryDebugIdIdentifier="sentry-dbid-e1d89b88-4a1f-45eb-a9eb-88dd563316e7")}catch{}})();const le=A({__name:"ApiKeys",setup(n){const a=w(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:u}=M(async()=>Promise.all([p.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)})))),b=async e=>{const t=await p.create({projectId:s,name:e.name});u(),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 c;return{key:o.id,cells:[{type:"text",text:o.name},{type:"text",text:h(o.createdAt)},{type:"text",text:(c=r==null?void 0:r.email)!=null?c:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:D,dangerous:!0,onClick:async()=>{await p.delete(s,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),x(C,null,[i(j,{"entity-name":"API key","create-button-text":"Create API Key",loading:l(f),title:"API Keys",description:"API Keys are used to deploy your app from the local editor.","empty-title":"No API keys here yet",table:I.value,fields:m,onCreate:b},null,8,["loading","table"]),i(l(V),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[i(l(B),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}),i(l(K),{code:"",copyable:""},{default:d(()=>[y(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.84d5506b.js.map
