import{d as w,r as b,eB as _,H as k,b as v,ev as x,f as i,u as l,w as p,a$ as C,f7 as h,ar as y,eD as P}from"./outputWidgets.52d47f16.js";import{d as D}from"./icons.22b07466.js";import{a as M}from"./asyncComputed.4c8b6226.js";import"./router.ea56abc1.js";import"./index.b0e912f1.js";import{M as N}from"./member.bb5ebeb5.js";import{A as d}from"./apiKey.d3dd1ecf.js";import{P as T}from"./project.50f37de1.js";import{C as j}from"./CrudView.f4ed8d29.js";import{A as B}from"./Paragraph.358c5b85.js";import{A as K}from"./Text.1eb3c39b.js";import{M as V}from"./Modal.4734ef4e.js";import"./FormItem.f8e049e8.js";import"./hasIn.1b3df496.js";import"./index.cf4c23b9.js";import"./record.c6473ef2.js";import"./pubsub.aae16efd.js";import"./Form.7de0f394.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.50955cf6.js";import"./url.0e01f007.js";import"./index.e38634fb.js";import"./Title.55fb2f67.js";import"./Base.73331908.js";import"./Typography.3ab66b91.js";import"./index.8bd5fc6f.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]="1134a128-eb28-46c2-99a3-078302f0251a",n._sentryDebugIdIdentifier="sentry-dbid-1134a128-eb28-46c2-99a3-078302f0251a")}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([d.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 d.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 d.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),x(C,null,[i(j,{"entity-name":"API key","create-button-text":"Create API Key",loading:l(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"]),i(l(V),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:p(()=>[]),default:p(()=>[i(l(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}),i(l(K),{code:"",copyable:""},{default:p(()=>[y(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.6374db6b.js.map
