import{d as w,r as A,eE as _,J as k,b as x,ew as C,f as l,u as i,w as d,aE as h,eU as v,eS as P,as as y,eH as D}from"./outputWidgets.f4ff73cb.js";import{a as M}from"./asyncComputed.1c2e733f.js";import"./router.579c91e6.js";import"./index.4ca46dd8.js";import{M as j}from"./member.e7a10b24.js";import{A as p}from"./apiKey.bc84394f.js";import{P as E}from"./project.d72d766b.js";import{C as N}from"./CrudView.153891cb.js";import{A as T}from"./Paragraph.0762ff9a.js";import{A as K}from"./Text.b0ae0f80.js";import{M as U}from"./Modal.fb9d97fb.js";import"./Form.c8ea7c3d.js";import"./hasIn.c05f2ad3.js";import"./popupNotifcation.d7d31af4.js";import"./record.06ee4427.js";import"./pubsub.f8e50115.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.273d3e2a.js";import"./BookOutlined.eb157924.js";import"./url.f4aa4fed.js";import"./index.38a388d2.js";import"./Title.8356c432.js";import"./Base.2cf6cca2.js";import"./index.72e9756f.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]="f0400080-f831-4d04-b4c6-beb7ac17bc49",n._sentryDebugIdIdentifier="sentry-dbid-f0400080-f831-4d04-b4c6-beb7ac17bc49")}catch{}})();const se=w({__name:"ApiKeys",setup(n){const a=A(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:c}=M(async()=>Promise.all([p.list(s),E.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(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:m,onCreate:b},null,8,["loading","table"]),l(i(U),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(T),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.13d87ccd.js.map
