import{d as w,r as b,eB as _,H as k,b as v,ev as x,f as i,u as l,w as d,aD as C,f8 as h,ar as y,eD as P}from"./outputWidgets.34ebc37e.js";import{i as D}from"./icons.8f30991f.js";import{a as M}from"./asyncComputed.35a4b27a.js";import"./router.719f3d63.js";import"./index.081cf5ad.js";import{M as N}from"./member.ead4eef7.js";import{A as p}from"./apiKey.9160f79d.js";import{P as T}from"./project.0e75a566.js";import{C as j}from"./CrudView.8134f016.js";import{A as B}from"./Paragraph.2cb0b8ab.js";import{A as K}from"./Text.979656fd.js";import{M as V}from"./Modal.70683480.js";import"./Form.38063bb5.js";import"./hasIn.58ff2131.js";import"./popupNotifcation.9ce529ca.js";import"./index.cf4c23b9.js";import"./record.cbdf5e50.js";import"./pubsub.35a24abb.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.52f83311.js";import"./url.c45872e6.js";import"./index.5fefec1c.js";import"./Title.0157a531.js";import"./Base.1bb23522.js";import"./Typography.316976a3.js";import"./index.e0c340f2.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]="b928a5e1-ef5c-4250-a727-7100dde13c26",n._sentryDebugIdIdentifier="sentry-dbid-b928a5e1-ef5c-4250-a727-7100dde13c26")}catch{}})();const le=w({__name:"ApiKeys",setup(n){const a=b(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:c}=M(async()=>Promise.all([p.list(s),T.get(s).then(e=>N.list(e.organizationId))]).then(([e,t])=>e.map(o=>({apiKey:o,member:t.find(r=>r.authorId===o.ownerId)})))),I=async e=>{const t=await p.create({projectId:s,name:e.name});c(),a.value=t.value},A=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:D,dangerous:!0,onClick:async()=>{await p.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),x(C,null,[i(j,{"entity-name":"API key","create-button-text":"Create API Key",loading:l(f),title:"API Keys",description:"API Keys are used to deploy your app from the local editor.","empty-title":"No API keys here yet",table:A.value,fields:m,onCreate:I},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(B),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(K),{code:"",copyable:""},{default:d(()=>[y(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.e74bc415.js.map
