import{d as A,r as w,eB as C,H as _,b as k,eu as x,f as l,u as i,w as d,aC as P,eR as h,eP as v,aq as y,eE as D}from"./outputWidgets.225dd371.js";import{a as M}from"./asyncComputed.8a54909a.js";import"./router.8e23138d.js";import"./index.2924e62a.js";import{M as j}from"./member.7868c9ce.js";import{A as p}from"./apiKey.8a2acbd7.js";import{P as N}from"./project.623c07f1.js";import{C as T}from"./CrudView.72bd6d5e.js";import{A as B}from"./Paragraph.253f2b2e.js";import{A as E}from"./Text.a0f2d781.js";import{M as K}from"./Modal.0a797886.js";import"./Form.12e2d16e.js";import"./hasIn.1e38e049.js";import"./popupNotifcation.6873325b.js";import"./index.cf4c23b9.js";import"./record.b805ac15.js";import"./pubsub.3bce7ea8.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.c28d2d29.js";import"./url.29c1f37b.js";import"./index.8e2737d3.js";import"./Title.bbb77099.js";import"./index.42c8bfb7.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]="424f2c3e-3db3-4ede-8ce0-16968a8238bf",n._sentryDebugIdIdentifier="sentry-dbid-424f2c3e-3db3-4ede-8ce0-16968a8238bf")}catch{}})();const re=A({__name:"ApiKeys",setup(n){const a=w(null),m=[{key:"name",label:"API key name"}],s=C().params.projectId,{loading:f,result:g,refetch:c}=M(async()=>Promise.all([p.list(s),N.get(s).then(e=>j.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},b=_(()=>{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:v,dangerous:!0,onClick:async()=>{await p.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(k(),x(P,null,[l(T,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(f),title:"API Keys",description:"API Keys are used to deploy your project from the local editor.","empty-title":"No API keys here yet",table:b.value,fields:m,onCreate:I},null,8,["loading","table"]),l(i(K),{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(E),{code:"",copyable:""},{default:d(()=>[y(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{re as default};
//# sourceMappingURL=ApiKeys.ba527b8c.js.map
