import{d as A,r as w,eG as _,D as k,b as x,ey as C,f as l,u as i,w as d,aG as h,eX as v,eS as P,au as y,eJ as D}from"./outputWidgets.e5f9ffc6.js";import{a as M}from"./asyncComputed.2210bd1a.js";import"./router.dd631582.js";import"./index.889e1616.js";import{M as j}from"./member.6ddaedd3.js";import{A as p}from"./apiKey.ff8d9875.js";import{P as N}from"./project.d3db1205.js";import{C as T}from"./CrudView.542c4e4e.js";import{A as G}from"./Paragraph.1cbc8077.js";import{A as K}from"./Text.e6c27a3b.js";import{M as V}from"./Modal.e18542c5.js";import"./Form.b45c0335.js";import"./hasIn.54609e4a.js";import"./popupNotifcation.9671db62.js";import"./record.3c5b5204.js";import"./pubsub.75396d00.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.670b5628.js";import"./BookOutlined.7d01e6a5.js";import"./url.c11ddd9f.js";import"./index.2570caf9.js";import"./Title.f988141d.js";import"./Base.d0d329e2.js";import"./index.f056a823.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]="6a222176-975a-44db-a4ed-c1a78bbd6d12",n._sentryDebugIdIdentifier="sentry-dbid-6a222176-975a-44db-a4ed-c1a78bbd6d12")}catch{}})();const se=A({__name:"ApiKeys",setup(n){const a=w(null),m=[{key:"name",label:"API key name"}],s=_().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)})))),b=async e=>{const t=await p.create({projectId:s,name:e.name});c(),a.value=t.value},I=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: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)=>(x(),C(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:b},null,8,["loading","table"]),l(i(V),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(G),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(K),{code:"",copyable:""},{default:d(()=>[y(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{se as default};
//# sourceMappingURL=ApiKeys.06c9008e.js.map
