import{d as w,r as A,ey as k,y as C,b as _,eq as x,f as l,u as i,w as d,aw as v,eQ as P,eL as h,cK as D,ak as y,cL as M,eC as j,co as K}from"./outputWidgets.f7b80e9f.js";import{a as N}from"./asyncComputed.bd2b6e70.js";import"./gateway.58b63376.js";import"./index.f21af923.js";import{M as T}from"./member.8c321696.js";import{A as c}from"./apiKey.592eab38.js";import{P as V}from"./project.4ecb704a.js";import{C as B}from"./CrudView.858975e6.js";import"./popupNotifcation.6f5b518c.js";import"./record.188928bf.js";import"./pubsub.10df5fd2.js";import"./string.18a9daee.js";import"./router.6fb3acdf.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.b36f7510.js";import"./BookOutlined.12f9401e.js";import"./url.882128c4.js";import"./index.288a68e3.js";import"./index.86fdb625.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[o]="4facf291-05c8-4baa-8016-797beba584ef",n._sentryDebugIdIdentifier="sentry-dbid-4facf291-05c8-4baa-8016-797beba584ef")}catch{}})();const te=w({__name:"ApiKeys",setup(n){const o=A(null),p=[{key:"name",label:"API key name"}],s=k().params.projectId,{loading:f,result:g,refetch:u}=N(async()=>Promise.all([c.list(s),V.get(s).then(e=>T.list(e.organizationId))]).then(([e,t])=>e.map(a=>({apiKey:a,member:t.find(r=>r.authorId===a.ownerId)})))),b=async e=>{const t=await c.create({projectId:s,name:e.name});u(),o.value=t.value},I=C(()=>{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:a,member:r})=>{var m;return{key:a.id,cells:[{type:"text",text:a.name},{type:"text",text:P(a.createdAt)},{type:"text",text:(m=r==null?void 0:r.email)!=null?m:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:h,dangerous:!0,onClick:async()=>{await c.delete(s,a.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(_(),x(v,null,[l(B,{"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:p,onCreate:b},null,8,["loading","table"]),l(i(K),{open:!!o.value,title:"Api key generated",onCancel:t[0]||(t[0]=a=>o.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(D),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(M),{code:"",copyable:""},{default:d(()=>[y(j(o.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys.dedd95f0.js.map
