import{d as w,r as b,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 f,eD as P}from"./outputWidgets.74ac2ec4.js";import{d as D}from"./icons.f62d7c23.js";import{a as M}from"./asyncComputed.f88a4b94.js";import"./router.3342c4c3.js";import"./index.8e718568.js";import{M as N}from"./member.51878182.js";import{A as p}from"./apiKey.720a0eb1.js";import{P as T}from"./project.2dfd0aa5.js";import{C as j}from"./CrudView.300a16f4.js";import{A as B}from"./Paragraph.d67398fc.js";import{A as K}from"./Text.039f7ef4.js";import{M as V}from"./Modal.fae7bce9.js";import"./FormItem.bf6c91bc.js";import"./hasIn.88fbb4e5.js";import"./index.cf4c23b9.js";import"./record.a15934e9.js";import"./pubsub.6d093b2e.js";import"./Form.9d6d8c17.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.30b53c7c.js";import"./url.c37f3fbe.js";import"./index.ba7b32c9.js";import"./Title.e4bf994e.js";import"./Base.bd01be9c.js";import"./index.08be46f9.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]="6a76679f-3fa0-4d6e-a8c9-8ff15dfde4f2",n._sentryDebugIdIdentifier="sentry-dbid-6a76679f-3fa0-4d6e-a8c9-8ff15dfde4f2")}catch{}})();const le=w({__name:"ApiKeys",setup(n){const a=b(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,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},A=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(y),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(()=>[f("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(()=>[f(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.2e40b4b9.js.map
