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 f,eH as D}from"./outputWidgets.6e1c5425.js";import{a as M}from"./asyncComputed.06ede41f.js";import"./router.4a0ba06b.js";import"./index.76daa7f6.js";import{M as j}from"./member.54aa99a1.js";import{A as p}from"./apiKey.7cdb1236.js";import{P as E}from"./project.ba2bfaa1.js";import{C as N}from"./CrudView.88823d06.js";import{A as T}from"./Paragraph.4ce326b3.js";import{A as K}from"./Text.b10c1140.js";import{M as U}from"./Modal.e50e9e9a.js";import"./Form.b82a2cec.js";import"./hasIn.bf07751b.js";import"./popupNotifcation.76f4dd63.js";import"./record.c7d63161.js";import"./pubsub.4f3043c8.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.3a6e05dd.js";import"./BookOutlined.8202b78f.js";import"./url.5357e9db.js";import"./index.c12e1c2f.js";import"./Title.dfd37452.js";import"./Base.0277cf44.js";import"./index.1442882a.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]="cca6ae3f-53e3-4bbc-990f-ef45aa41bb67",n._sentryDebugIdIdentifier="sentry-dbid-cca6ae3f-53e3-4bbc-990f-ef45aa41bb67")}catch{}})();const se=w({__name:"ApiKeys",setup(n){const a=A(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,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(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: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(()=>[f("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(()=>[f(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{se as default};
//# sourceMappingURL=ApiKeys.bc2cceaf.js.map
