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 P,eS as h,eP as v,aq as y,eD as D}from"./outputWidgets.63450c6a.js";import{a as M}from"./asyncComputed.4686243d.js";import"./router.b1520023.js";import"./index.f9342278.js";import{M as j}from"./member.b8b7fef1.js";import{A as p}from"./apiKey.e7132ef7.js";import{P as N}from"./project.b916cf67.js";import{C as T}from"./CrudView.6bcc0a2a.js";import{A as K}from"./Paragraph.b0baea90.js";import{A as V}from"./Text.3d888762.js";import{M as B}from"./Modal.138f2689.js";import"./Form.bd89de9c.js";import"./hasIn.1b20766f.js";import"./popupNotifcation.ee18d946.js";import"./index.cf4c23b9.js";import"./record.884a3745.js";import"./pubsub.9ff806ef.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.336161d1.js";import"./BookOutlined.fe4a32cf.js";import"./url.181b4bfa.js";import"./index.aeb802d2.js";import"./Title.05596582.js";import"./index.078560f6.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]="64729d00-639e-4464-acea-e92e983cbd68",n._sentryDebugIdIdentifier="sentry-dbid-64729d00-639e-4464-acea-e92e983cbd68")}catch{}})();const se=w({__name:"ApiKeys",setup(n){const a=b(null),m=[{key:"name",label:"API key name"}],s=C().params.projectId,{loading:f,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: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 p.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(k(),x(P,null,[l(T,{"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: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(()=>[y("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(()=>[y(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{se as default};
//# sourceMappingURL=ApiKeys.84050f23.js.map
