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 f,eD as P}from"./outputWidgets.781e41f9.js";import{d as x}from"./index.db0f7a49.js";import{o as D}from"./icons.0ffc383b.js";import{a as M}from"./asyncComputed.d06d5356.js";import"./authorManager.2805bec3.js";import"./index.fc2f40fb.js";import{M as N}from"./member.ed53bda9.js";import{A as c}from"./apiKey.948e5ba3.js";import{P as T}from"./project.373df54c.js";import{C as j}from"./CrudView.331f38ea.js";import{A as B}from"./Title.bf1f8106.js";import{A as K}from"./Text.6168f33a.js";import{M as V}from"./Modal.3a32e945.js";import"./index.cf4c23b9.js";import"./record.71f43d7d.js";import"./pubsub.2273fc34.js";import"./FormItem.341ebdb6.js";import"./hasIn.205b6afa.js";import"./Form.a1506234.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.942344e3.js";import"./router.2dba10c4.js";import"./url.a0d7eae0.js";import"./index.0ad8ad84.js";import"./index.574af34c.js";import"./index.b2c1bb4a.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]="e2fb5e06-0fcd-4eb0-b8cd-5b241c419cec",n._sentryDebugIdIdentifier="sentry-dbid-e2fb5e06-0fcd-4eb0-b8cd-5b241c419cec")}catch{}})();const le=A({__name:"ApiKeys",setup(n){const a=w(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:y,result:b,refetch:p}=M(async()=>Promise.all([c.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)})))),g=async e=>{const t=await c.create({projectId:s,name:e.name});p(),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=b.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 c.delete(s,o.id),p()}}]}]}}))!=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:I.value,fields:m,onCreate:g},null,8,["loading","table"]),i(l(V),{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(K),{code:"",copyable:""},{default:d(()=>[f(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.dd063e54.js.map
