import{d as A,r as w,eB as _,G as h,b as k,ev as v,f as l,u as i,w as d,bq as x,aq as f,eD as C}from"./outputWidgets.3c34606b.js";import{d as P}from"./index.dd5bce3f.js";import{o as D}from"./icons.e6ec075a.js";import{a as M}from"./asyncComputed.8707f293.js";import"./router.56692652.js";import"./index.c3f2d302.js";import{M as T}from"./member.82071d24.js";import{A as p}from"./apiKey.4e217f07.js";import{P as N}from"./project.d605460b.js";import{C as j}from"./CrudView.7c2b0e6f.js";import{A as B}from"./Title.f4855332.js";import{A as K}from"./Text.aa4a1cf1.js";import{M as V}from"./Modal.10b1f4fc.js";import"./FormItem.895a8678.js";import"./hasIn.01f4de81.js";import"./index.cf4c23b9.js";import"./record.c46cf28f.js";import"./pubsub.28c1e0e3.js";import"./Form.d74c49d4.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.36eacc0b.js";import"./url.425cd9cb.js";import"./index.507e77a0.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]="6ad57209-b01b-40ef-93f3-dbc00a9e12f0",n._sentryDebugIdIdentifier="sentry-dbid-6ad57209-b01b-40ef-93f3-dbc00a9e12f0")}catch{}})();const re=A({__name:"ApiKeys",setup(n){const a=w(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,result:g,refetch:c}=M(async()=>Promise.all([p.list(s),N.get(s).then(e=>T.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=h(()=>{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:P(o.createdAt)},{type:"text",text:(u=r==null?void 0:r.email)!=null?u:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:D,dangerous:!0,onClick:async()=>{await p.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(k(),v(x,null,[l(j,{"entity-name":"API key","create-button-text":"Create API Key",loading:i(y),title:"API Keys",description:"API Keys are used to deploy your app from the local editor.","empty-title":"No API keys here yet",table:I.value,fields:m,onCreate:b},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(B),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(C(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{re as default};
//# sourceMappingURL=ApiKeys.7daf96dd.js.map
