import{d as b,r as w,eA as C,H as _,b as k,eu as x,f as l,u as i,w as d,aC as P,eR as h,eP as v,aq as f,eD as D}from"./outputWidgets.3681a2a5.js";import{a as M}from"./asyncComputed.317e87c5.js";import"./router.ef5c7692.js";import"./index.63f126f8.js";import{M as j}from"./member.d3bac61c.js";import{A as c}from"./apiKey.b39bfbed.js";import{P as N}from"./project.8bd8a1e2.js";import{C as T}from"./CrudView.b5e99bd9.js";import{A as K}from"./Paragraph.326f3875.js";import{A as V}from"./Text.1bf2a6e4.js";import{M as B}from"./Modal.7229d3ef.js";import"./Form.c15ea82d.js";import"./hasIn.127ddf2a.js";import"./popupNotifcation.d8032226.js";import"./index.cf4c23b9.js";import"./record.220fa006.js";import"./pubsub.916b1e4d.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.b3245b51.js";import"./BookOutlined.2d246e57.js";import"./url.ec571b6b.js";import"./index.4f6b4519.js";import"./Title.142e78f1.js";import"./index.f44ff305.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]="01c0d80f-697f-4af4-aebc-9dcc09be2cf2",n._sentryDebugIdIdentifier="sentry-dbid-01c0d80f-697f-4af4-aebc-9dcc09be2cf2")}catch{}})();const se=b({__name:"ApiKeys",setup(n){const a=w(null),p=[{key:"name",label:"API key name"}],s=C().params.projectId,{loading:y,result:g,refetch:m}=M(async()=>Promise.all([c.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)})))),A=async e=>{const t=await c.create({projectId:s,name:e.name});m(),a.value=t.value},I=_(()=>{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:v,dangerous:!0,onClick:async()=>{await c.delete(s,o.id),m()}}]}]}}))!=null?t:[]}});return(e,t)=>(k(),x(P,null,[l(T,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(y),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:A},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(()=>[f("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(()=>[f(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{se as default};
//# sourceMappingURL=ApiKeys.11c3fc4b.js.map
