import{d as b,r as w,ez as _,F as h,b as k,et as x,f as l,u as i,w as d,bo as C,ao as y,eB as v}from"./outputWidgets.4b203988.js";import{d as P}from"./index.08241909.js";import{o as D}from"./icons.b5300508.js";import{a as M}from"./asyncComputed.e3f401af.js";import"./router.b5e476b6.js";import"./jwt-decode.esm.74bd4619.js";import"./index.7a3abf72.js";import{M as T}from"./member.7fee19e0.js";import{A as p}from"./apiKey.d7e33307.js";import{P as N}from"./project.bf6c1ad8.js";import{C as j}from"./CrudView.54167740.js";import{A as B}from"./Title.aa160519.js";import{A as K}from"./Text.574763d2.js";import{M as V}from"./Modal.96464eb7.js";import"./FormItem.dacf5a0e.js";import"./hasIn.c2d80060.js";import"./storage.e938f042.js";import"./index.cf4c23b9.js";import"./record.3809e80c.js";import"./pubsub.3a2fa885.js";import"./Form.ed264728.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.0a96fdb4.js";import"./url.fcdccb50.js";import"./index.50465e1e.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]="4482e58d-96db-4ef9-969a-245e2d6fec36",n._sentryDebugIdIdentifier="sentry-dbid-4482e58d-96db-4ef9-969a-245e2d6fec36")}catch{}})();const le=b({__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),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: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 p.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(k(),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: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(v(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.dc7d6bc3.js.map
