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 f,eD as P}from"./outputWidgets.1d9bc483.js";import{i as D}from"./icons.f304c7ce.js";import{a as M}from"./asyncComputed.3431552f.js";import"./router.9b42915a.js";import"./index.8feaf127.js";import{M as N}from"./member.3dc8cefd.js";import{A as d}from"./apiKey.35849ade.js";import{P as T}from"./project.c2280a59.js";import{C as j}from"./CrudView.4ddb21c1.js";import{A as B}from"./Paragraph.fe3e888e.js";import{A as K}from"./Text.dd7d318a.js";import{M as V}from"./Modal.d0c8d599.js";import"./Form.b5179437.js";import"./hasIn.720fa991.js";import"./index.cf4c23b9.js";import"./record.19799987.js";import"./pubsub.1ce944f4.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.35e5a90b.js";import"./url.d3539301.js";import"./index.3371bd8d.js";import"./Title.e5c6db47.js";import"./Base.1fa74c0b.js";import"./Typography.a8278e90.js";import"./index.76b6c31d.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]="2eef551e-fe4b-43f8-984e-a154c348e17f",n._sentryDebugIdIdentifier="sentry-dbid-2eef551e-fe4b-43f8-984e-a154c348e17f")}catch{}})();const ie=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([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(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"]),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(()=>[f("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(()=>[f(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ie as default};
//# sourceMappingURL=ApiKeys.b7a1dd6b.js.map
