import{d as A,r as w,eB as _,H as k,b as v,ev as x,f as l,u as i,w as d,a$ as C,f7 as h,ar as y,eD as P}from"./outputWidgets.84fe9cdf.js";import{o as D}from"./icons.fb80f0dd.js";import{a as M}from"./asyncComputed.6b982433.js";import"./router.55b997dc.js";import"./index.46fac088.js";import{M as N}from"./member.854bcb77.js";import{A as p}from"./apiKey.2cb02ec3.js";import{P as T}from"./project.27c9517e.js";import{C as j}from"./CrudView.d7e7652b.js";import{A as B}from"./Paragraph.7a7aafbc.js";import{A as K}from"./Text.6c3b9f60.js";import{M as V}from"./Modal.47a21763.js";import"./FormItem.3f0afd7c.js";import"./hasIn.892e96d0.js";import"./index.cf4c23b9.js";import"./record.d584e714.js";import"./pubsub.e099f5f1.js";import"./Form.ff60b0b9.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.41277f9f.js";import"./url.8de5cd7a.js";import"./index.7b2adc4e.js";import"./Title.59475fea.js";import"./Base.3448c1ef.js";import"./index.2424aba1.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]="531bd04a-ea0d-47ba-94c6-aaf62386245a",n._sentryDebugIdIdentifier="sentry-dbid-531bd04a-ea0d-47ba-94c6-aaf62386245a")}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:c}=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)})))),I=async e=>{const t=await p.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:h(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 p.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),x(C,null,[l(j,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(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:b.value,fields:m,onCreate:I},null,8,["loading","table"]),l(i(V),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(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}),l(i(K),{code:"",copyable:""},{default:d(()=>[y(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.4a897d20.js.map
