import{d as A,r as w,eB as C,H as _,b as k,eu as x,f as i,u as l,w as d,aC as P,eR as v,eP as h,aq as f,eE as D}from"./outputWidgets.f017b1ba.js";import{a as M}from"./asyncComputed.9ec0ae7d.js";import"./router.bd5e0bcd.js";import"./index.2d300106.js";import{M as N}from"./member.513202f6.js";import{A as p}from"./apiKey.346c290b.js";import{P as j}from"./project.cffa897f.js";import{C as B}from"./CrudView.ab7e0ba9.js";import{A as E}from"./Paragraph.3ffb559e.js";import{A as K}from"./Text.01ac3fdf.js";import{M as T}from"./Modal.334f8812.js";import"./Form.c4ae4d63.js";import"./hasIn.a2b4c2f9.js";import"./popupNotifcation.d47f45e7.js";import"./index.cf4c23b9.js";import"./record.e2bcfa5f.js";import"./pubsub.4d72db7b.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.377064a4.js";import"./url.42b30a4e.js";import"./index.5cbbe314.js";import"./Title.4002b692.js";import"./Base.bb2b5283.js";import"./Typography.5dfc411f.js";import"./index.b5d890a4.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]="cc259ffb-b8cb-43be-a6af-59d6cfe16147",n._sentryDebugIdIdentifier="sentry-dbid-cc259ffb-b8cb-43be-a6af-59d6cfe16147")}catch{}})();const ie=A({__name:"ApiKeys",setup(n){const a=w(null),m=[{key:"name",label:"API key name"}],s=C().params.projectId,{loading:y,result:b,refetch:c}=M(async()=>Promise.all([p.list(s),j.get(s).then(e=>N.list(e.organizationId))]).then(([e,t])=>e.map(o=>({apiKey:o,member:t.find(r=>r.authorId===o.ownerId)})))),g=async e=>{const t=await p.create({projectId:s,name:e.name});c(),a.value=t.value},I=_(()=>{var e,t;return{columns:[{name:"Name"},{name:"Creation date"},{name:"Owner"},{name:"",align:"right"}],rows:(t=(e=b.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),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(k(),x(P,null,[i(B,{"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:I.value,fields:m,onCreate:g},null,8,["loading","table"]),i(l(T),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[i(l(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}),i(l(K),{code:"",copyable:""},{default:d(()=>[f(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ie as default};
//# sourceMappingURL=ApiKeys.5a8d2905.js.map
