import{d as w,r as b,eG as _,D as k,b as x,ey as C,f as l,u as i,w as d,aG as h,eX as v,eS as P,au as y,eJ as D}from"./outputWidgets.7323a17d.js";import{a as M}from"./asyncComputed.a50f21d4.js";import"./router.7bb92c0e.js";import"./index.c9f11f2b.js";import{M as j}from"./member.493faa08.js";import{A as p}from"./apiKey.2effa860.js";import{P as N}from"./project.dfdecc43.js";import{C as T}from"./CrudView.e2192329.js";import{A as G}from"./Paragraph.1e67eefb.js";import{A as K}from"./Text.a0b69008.js";import{M as V}from"./Modal.8e6a9189.js";import"./Form.4d35a934.js";import"./hasIn.adc00278.js";import"./popupNotifcation.4e57751c.js";import"./record.1f033572.js";import"./pubsub.2c3883f4.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.d07c372f.js";import"./BookOutlined.22bb6522.js";import"./url.50c4a8f0.js";import"./index.42443749.js";import"./Title.88a7d0e4.js";import"./Base.003f7172.js";import"./index.211f7220.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]="f856b7a7-ee97-4ee1-8828-7a12f8d2da05",n._sentryDebugIdIdentifier="sentry-dbid-f856b7a7-ee97-4ee1-8828-7a12f8d2da05")}catch{}})();const se=w({__name:"ApiKeys",setup(n){const a=b(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:u}=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)})))),I=async e=>{const t=await p.create({projectId:s,name:e.name});u(),a.value=t.value},A=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 c;return{key:o.id,cells:[{type:"text",text:o.name},{type:"text",text:v(o.createdAt)},{type:"text",text:(c=r==null?void 0:r.email)!=null?c:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:P,dangerous:!0,onClick:async()=>{await p.delete(s,o.id),u()}}]}]}}))!=null?t:[]}});return(e,t)=>(x(),C(h,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:A.value,fields:m,onCreate:I},null,8,["loading","table"]),l(i(V),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[l(i(G),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.9d3b819e.js.map
