import{d as b,r as w,eA as C,H as _,b as k,eu as x,f as l,u as i,w as d,aC as h,eS as v,eQ as P,aq as y,eD as D}from"./outputWidgets.b2f2adf2.js";import{a as M}from"./asyncComputed.0eb432f7.js";import"./router.778927b3.js";import"./index.914bcef3.js";import{M as j}from"./member.b8a6c7d2.js";import{A as p}from"./apiKey.94a8887f.js";import{P as N}from"./project.2bff5717.js";import{C as T}from"./CrudView.5c233833.js";import{A as K}from"./Paragraph.038d3c4a.js";import{A as V}from"./Text.9554a64b.js";import{M as B}from"./Modal.29dbfea8.js";import"./Form.151a806c.js";import"./hasIn.2f264b73.js";import"./popupNotifcation.45645a97.js";import"./index.cf4c23b9.js";import"./record.01220836.js";import"./pubsub.56b36b75.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.204f99fb.js";import"./BookOutlined.312749b0.js";import"./url.de379c40.js";import"./index.c47b0dc1.js";import"./Title.d1ce9cd1.js";import"./index.0f294ac7.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]="c4d12733-eb23-4343-8757-9c51f8c0b560",n._sentryDebugIdIdentifier="sentry-dbid-c4d12733-eb23-4343-8757-9c51f8c0b560")}catch{}})();const se=b({__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)})))),A=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=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:P,dangerous:!0,onClick:async()=>{await p.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(k(),x(h,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:I.value,fields:m,onCreate:A},null,8,["loading","table"]),l(i(B),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(K),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(V),{code:"",copyable:""},{default:d(()=>[y(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{se as default};
//# sourceMappingURL=ApiKeys.a9df912a.js.map
