import{d as w,r as b,eB as _,H as h,b as k,ev as v,f as l,u as i,w as d,a$ as x,f7 as C,ar as y,eD as P}from"./outputWidgets.dbd82eb7.js";import{o as D}from"./icons.fd03d9d3.js";import{a as M}from"./asyncComputed.35cc7f64.js";import"./router.a2f17c4c.js";import"./index.447cf405.js";import{M as T}from"./member.51997812.js";import{A as p}from"./apiKey.4cbe9604.js";import{P as N}from"./project.8635418a.js";import{C as j}from"./CrudView.152393ef.js";import{A as B}from"./Paragraph.1b3bd714.js";import{A as K}from"./Text.2567a5bf.js";import{M as V}from"./Modal.856041d0.js";import"./FormItem.07260c6b.js";import"./hasIn.0a3acbb0.js";import"./index.cf4c23b9.js";import"./record.a4c5bdc0.js";import"./pubsub.56ebc718.js";import"./Form.a9061abd.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.230a8eb3.js";import"./url.1be4a3aa.js";import"./index.a1b32efe.js";import"./Title.8245238f.js";import"./Base.9ecb2d1e.js";import"./index.517bb670.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]="b9af9278-45a9-4c72-ae39-1f9d4d765583",n._sentryDebugIdIdentifier="sentry-dbid-b9af9278-45a9-4c72-ae39-1f9d4d765583")}catch{}})();const le=w({__name:"ApiKeys",setup(n){const a=b(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:c}=M(async()=>Promise.all([p.list(s),N.get(s).then(e=>T.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},A=h(()=>{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:C(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)=>(k(),v(x,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:A.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.a27a2b25.js.map
