import{d as A,r as w,eG as _,y as k,b as x,ey as C,f as i,u as l,w as d,aG as v,eX as P,eS as h,au as y,eJ as D}from"./outputWidgets.52571dac.js";import{a as M}from"./asyncComputed.2a2a1288.js";import"./gateway.9b472f57.js";import"./index.803d0576.js";import{M as j}from"./member.8daf34d1.js";import{A as p}from"./apiKey.b3458e83.js";import{P as N}from"./project.048e4ccc.js";import{C as G}from"./CrudView.6cb8ad38.js";import{A as K}from"./Paragraph.7aa2ce32.js";import{A as T}from"./Text.0586c869.js";import{M as V}from"./Modal.514213ca.js";import"./popupNotifcation.e85fac74.js";import"./record.2a93f29c.js";import"./pubsub.be7004e9.js";import"./router.0ae1ef4a.js";import"./Form.9e43a28b.js";import"./hasIn.f1c353ba.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.a5567333.js";import"./BookOutlined.7e4ac738.js";import"./url.5cc70021.js";import"./index.89edc4ba.js";import"./Title.8fbc2e7d.js";import"./Base.e64db743.js";import"./index.f3e1df2a.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]="3c353b6f-ee61-456b-b663-0e91b82a5fec",n._sentryDebugIdIdentifier="sentry-dbid-3c353b6f-ee61-456b-b663-0e91b82a5fec")}catch{}})();const ie=A({__name:"ApiKeys",setup(n){const a=w(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:b,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)})))),g=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=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:P(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)=>(x(),C(v,null,[i(G,{"entity-name":"API key","create-button-text":"Create API Key",loading:l(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:g},null,8,["loading","table"]),i(l(V),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[i(l(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}),i(l(T),{code:"",copyable:""},{default:d(()=>[y(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ie as default};
//# sourceMappingURL=ApiKeys.fc0021c0.js.map
