import{d as A,r as w,eB as _,G as k,b as v,ev as C,f as i,u as l,w as d,bq as h,aq as y,eD as P}from"./outputWidgets.3eae54a8.js";import{d as x}from"./index.89d7b0fc.js";import{o as D}from"./icons.e8458af4.js";import{a as M}from"./asyncComputed.951244d5.js";import"./authorManager.8abbaff3.js";import"./index.5a75491f.js";import{M as N}from"./member.8dea9638.js";import{A as m}from"./apiKey.2de5efed.js";import{P as T}from"./project.7a2f8853.js";import{C as j}from"./CrudView.328264f4.js";import{A as B,M as K}from"./Title.ee79f8a8.js";import{A as V}from"./Text.6e609d9b.js";import"./index.cf4c23b9.js";import"./record.a0b21aff.js";import"./pubsub.4b1da012.js";import"./gateway.350ede4a.js";import"./FormItem.8edd4e05.js";import"./hasIn.d5bc6fc2.js";import"./Form.f1aa0eff.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.1fe6b9cc.js";import"./router.409ab4a0.js";import"./url.0fe4f7e9.js";import"./index.77404c97.js";import"./index.3d7ce90e.js";import"./index.2d394d39.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]="6943cac4-848b-44db-8932-88b1998544dc",n._sentryDebugIdIdentifier="sentry-dbid-6943cac4-848b-44db-8932-88b1998544dc")}catch{}})();const le=A({__name:"ApiKeys",setup(n){const a=w(null),p=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:g,refetch:c}=M(async()=>Promise.all([m.list(s),T.get(s).then(e=>N.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 m.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:"Actions",align:"right"}],rows:(t=(e=g.value)==null?void 0:e.map(({apiKey:o,member:r})=>{var u;return{key:o.id,cells:[{text:o.name},{text:x(o.createdAt)},{text:(u=r==null?void 0:r.email)!=null?u:"Unknown"},{text:"actions",actions:[{label:"Delete",icon:D,dangerous:!0,onClick:async()=>{await m.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),C(h,null,[i(j,{"entity-name":"API key","create-button-text":"Create API Key",loading:l(f),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:p,onCreate:b},null,8,["loading","table"]),i(l(K),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[i(l(B),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}),i(l(V),{code:"",copyable:""},{default:d(()=>[y(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.0fc2b782.js.map
