import{d as w,r as b,eA as C,H as _,b as k,eu as x,f as l,u as i,w as d,aC as h,eS as v,eQ as P,aq as f,eD as D}from"./outputWidgets.260a3c99.js";import{a as M}from"./asyncComputed.61df0e0c.js";import"./router.c6bba0da.js";import"./index.16d63baf.js";import{M as j}from"./member.4cd879bd.js";import{A as p}from"./apiKey.e8632e9d.js";import{P as N}from"./project.51fda797.js";import{C as T}from"./CrudView.9c881ed3.js";import{A as K}from"./Paragraph.482f5128.js";import{A as V}from"./Text.3b774738.js";import{M as B}from"./Modal.6a26a016.js";import"./Form.46e378f9.js";import"./hasIn.8ab3cbf4.js";import"./popupNotifcation.87bdba7f.js";import"./index.cf4c23b9.js";import"./record.608c7c8c.js";import"./pubsub.ab27f2c0.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.e08dd3ee.js";import"./BookOutlined.9a33e452.js";import"./url.13938513.js";import"./index.34fd2dd9.js";import"./Title.9673e08a.js";import"./index.a74fba23.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]="e70791a1-b8df-4ccf-a083-af61f460675c",n._sentryDebugIdIdentifier="sentry-dbid-e70791a1-b8df-4ccf-a083-af61f460675c")}catch{}})();const se=w({__name:"ApiKeys",setup(n){const a=b(null),m=[{key:"name",label:"API key name"}],s=C().params.projectId,{loading:y,result:g,refetch:c}=M(async()=>Promise.all([p.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 p.create({projectId:s,name:e.name});c(),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: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)=>(k(),x(h,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:m,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.760e7f84.js.map
