import{d as A,r as w,ez as _,F as h,b as k,et as x,f as l,u as i,w as p,bo as C,ao as y,eB as v}from"./outputWidgets.517466a4.js";import{d as P}from"./index.c09b1845.js";import{o as D}from"./icons.18ac3d6d.js";import{a as M}from"./asyncComputed.4cc49353.js";import"./router.7372192a.js";import"./jwt-decode.esm.74bd4619.js";import"./index.93c4bd99.js";import{M as T}from"./member.e7522fff.js";import{A as d}from"./apiKey.4466b3e3.js";import{P as N}from"./project.d9b77799.js";import{C as j}from"./CrudView.3319d010.js";import{A as B}from"./Title.50fff1e9.js";import{A as K}from"./Text.b4fa08c4.js";import{M as V}from"./Modal.c37f1dd1.js";import"./FormItem.ebe02103.js";import"./hasIn.41d385a0.js";import"./storage.a7faa4ce.js";import"./index.cf4c23b9.js";import"./record.00f55d8c.js";import"./pubsub.1c68a664.js";import"./Form.dedf0123.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.541da426.js";import"./url.f9726388.js";import"./index.1de61334.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]="914fb062-8b74-48c7-97ba-a67fe31853bb",n._sentryDebugIdIdentifier="sentry-dbid-914fb062-8b74-48c7-97ba-a67fe31853bb")}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:b,refetch:c}=M(async()=>Promise.all([d.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)})))),g=async e=>{const t=await d.create({projectId:s,name:e.name});c(),a.value=t.value},I=h(()=>{var e,t;return{columns:[{name:"Name"},{name:"Creation date"},{name:"Owner"},{name:"",align:"right"}],rows:(t=(e=b.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)=>(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:I.value,fields:m,onCreate:g},null,8,["loading","table"]),l(i(V),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:p(()=>[]),default:p(()=>[l(i(B),null,{default:p(()=>[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:p(()=>[y(v(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.776f5fe2.js.map
