import{d as b,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 f,eD as P}from"./outputWidgets.470cd725.js";import{d as x}from"./index.672f7932.js";import{o as D}from"./icons.732210f6.js";import{a as M}from"./asyncComputed.72d91ef9.js";import"./authorManager.176ccd94.js";import"./index.d44cde0e.js";import{M as N}from"./member.494808c2.js";import{A as m}from"./apiKey.5c591d4d.js";import{P as T}from"./project.f4c30a7f.js";import{C as j}from"./CrudView.e08250db.js";import{A as B,M as K}from"./Title.edbac04b.js";import{A as V}from"./Text.fbb768c7.js";import"./index.cf4c23b9.js";import"./record.19f593f6.js";import"./pubsub.bb7b27fb.js";import"./gateway.6d700df7.js";import"./FormItem.bd89e955.js";import"./hasIn.6bd3aa8a.js";import"./Form.bf13abb6.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.702cb95e.js";import"./router.bb51d819.js";import"./url.28fafd73.js";import"./index.e48b3db7.js";import"./index.2d4e9800.js";import"./index.52ab7ae6.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]="4066a95a-48f8-458d-918c-c6037153be0d",n._sentryDebugIdIdentifier="sentry-dbid-4066a95a-48f8-458d-918c-c6037153be0d")}catch{}})();const le=b({__name:"ApiKeys",setup(n){const a=w(null),p=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,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)})))),I=async e=>{const t=await m.create({projectId:s,name:e.name});c(),a.value=t.value},A=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(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:A.value,fields:p,onCreate:I},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(()=>[f("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(()=>[f(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.46ca5136.js.map
