import{d as w,r as b,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 v,eP as h,aq as f,eE as D}from"./outputWidgets.b1e87772.js";import{a as M}from"./asyncComputed.5830bf45.js";import"./router.a9e5af79.js";import"./index.f89d635d.js";import{M as j}from"./member.99ea3ed3.js";import{A as p}from"./apiKey.959a2241.js";import{P as N}from"./project.dd3b3a90.js";import{C as B}from"./CrudView.cde29d2c.js";import{A as E}from"./Paragraph.72ff08f3.js";import{A as K}from"./Text.a2ac66f5.js";import{M as T}from"./Modal.6f2aaf4e.js";import"./Form.c64de99c.js";import"./hasIn.443af95b.js";import"./popupNotifcation.6e758e81.js";import"./index.cf4c23b9.js";import"./record.2f552fbf.js";import"./pubsub.8b7604ff.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.370ccd6b.js";import"./url.105c4f84.js";import"./index.fae832ba.js";import"./Title.87ff1f7b.js";import"./index.78c9c56d.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]="58c9f37c-a18c-47d1-bedd-ef9344913d03",n._sentryDebugIdIdentifier="sentry-dbid-58c9f37c-a18c-47d1-bedd-ef9344913d03")}catch{}})();const re=w({__name:"ApiKeys",setup(n){const a=b(null),c=[{key:"name",label:"API key name"}],s=C().params.projectId,{loading:y,result:g,refetch:m}=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});m(),a.value=t.value},A=_(()=>{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:v(o.createdAt)},{type:"text",text:(u=r==null?void 0:r.email)!=null?u:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:h,dangerous:!0,onClick:async()=>{await p.delete(s,o.id),m()}}]}]}}))!=null?t:[]}});return(e,t)=>(k(),x(P,null,[l(B,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(y),title:"API Keys",description:"API Keys are used to deploy your project from the local editor.","empty-title":"No API keys here yet",table:A.value,fields:c,onCreate:I},null,8,["loading","table"]),l(i(T),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(E),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(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{re as default};
//# sourceMappingURL=ApiKeys.bf3f7453.js.map
