import{d as A,r as w,eD as _,I as k,b as v,ev as x,f as l,u as i,w as d,aD as C,eT as h,eR as P,ar as y,eG as D}from"./outputWidgets.be3472c2.js";import{a as M}from"./asyncComputed.a619212b.js";import"./router.87bf43b6.js";import"./index.86288308.js";import{M as T}from"./member.4233f4e5.js";import{A as p}from"./apiKey.03d0ec3e.js";import{P as j}from"./project.8bc67c1c.js";import{C as N}from"./CrudView.08af3b90.js";import{A as K}from"./Paragraph.7601abde.js";import{A as V}from"./Text.c9febe27.js";import{M as B}from"./Modal.304207b8.js";import"./Form.254a7379.js";import"./hasIn.bddd0a1a.js";import"./popupNotifcation.9025cc7b.js";import"./record.820df198.js";import"./pubsub.1063a0da.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.f9aebc41.js";import"./BookOutlined.53049b66.js";import"./url.7fe1be7b.js";import"./index.ba676107.js";import"./Title.65752aa0.js";import"./index.6773e8c7.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]="9e6ccad5-e3ba-41b1-9fdf-e4a800c1b306",n._sentryDebugIdIdentifier="sentry-dbid-9e6ccad5-e3ba-41b1-9fdf-e4a800c1b306")}catch{}})();const re=A({__name:"ApiKeys",setup(n){const a=w(null),c=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:m}=M(async()=>Promise.all([p.list(s),j.get(s).then(e=>T.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});m(),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:h(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),m()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),x(C,null,[l(N,{"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:c,onCreate:b},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{re as default};
//# sourceMappingURL=ApiKeys.8ed10fbf.js.map
