import{C as x}from"./CrudView.ca91f805.js";import{d as I,r as A,i as e,ei as C,c as h,ac as D,f as c,u as t,b as d,aY as M,o as P,de as T,g as y,t as f,df as j,M as V,ek as B,er as E}from"./jwt-decode.esm.32f71954.js";import{a as N}from"./asyncComputed.f9fa4c71.js";import{A as p}from"./apiKey.975dfeae.js";import"./router.29e08ea4.js";import{M as $}from"./member.91dd2bc0.js";import{a as z}from"./project.b14b799c.js";import"./tables.94d324c3.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.c50f6a0a.js";import"./constants.b5d83622.js";import"./url.79cc02c3.js";import"./PhDotsThreeVertical.vue.e305b3a2.js";import"./index.c59ca45b.js";import"./index.2400150a.js";import"./record.41c9caee.js";import"./string.ff0b4ef9.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[o]="cb940cdb-27ca-4992-9105-275cb248ccd3",s._sentryDebugIdIdentifier="sentry-dbid-cb940cdb-27ca-4992-9105-275cb248ccd3")}catch{}})();const te=I({__name:"ApiKeys",setup(s){const o=A(null),_=[{key:"name",label:e.translate("i18n_apikeysview_field_name")}],l=C().params.projectId,w=new $,{loading:v,result:b,refetch:m}=N(async()=>Promise.all([p.list(l),z.get(l).then(a=>w.list(a.organizationId))]).then(([a,n])=>a.map(i=>({apiKey:i,member:n.find(r=>r.authorId===i.ownerId)})))),k=async a=>{const n=await p.create({projectId:l,name:a.name});m(),o.value=n.value},g=h(()=>{var a,n;return{columns:[{title:e.translate("i18n_apikeysview_column_name")},{title:e.translate("i18n_apikeysview_column_creation_date")},{title:e.translate("i18n_apikeysview_column_owner")},{title:"",align:"right"}],rows:(n=(a=b.value)==null?void 0:a.map(({apiKey:i,member:r})=>{var u;return{key:i.id,cells:[{type:"text",text:i.name},{type:"text",text:B(i.createdAt)},{type:"text",text:(u=r==null?void 0:r.email)!=null?u:e.translate("i18n_apikeysview_owner_unknown")},{type:"actions",actions:[{label:e.translate("i18n_apikeysview_action_delete"),icon:E,dangerous:!0,onClick:async()=>{await p.delete(l,i.id),m()}}]}]}}))!=null?n:[]}});return(a,n)=>(P(),D(M,null,[c(x,{"entity-name":t(e).translate("i18n_apikeysview_entity_name"),"create-button-text":t(e).translate("i18n_apikeysview_create_button"),loading:t(v),title:t(e).translate("i18n_apikeysview_title"),description:t(e).translate("i18n_apikeysview_description"),"empty-title":t(e).translate("i18n_apikeysview_empty_title"),table:g.value,fields:_,create:k},null,8,["entity-name","create-button-text","loading","title","description","empty-title","table"]),c(t(V),{open:!!o.value,title:t(e).translate("i18n_apikeysview_modal_title"),onCancel:n[0]||(n[0]=i=>o.value=null)},{footer:d(()=>[]),default:d(()=>[c(t(T),null,{default:d(()=>[y(f(t(e).translate("i18n_apikeysview_modal_description")),1)]),_:1}),c(t(j),{code:"",copyable:""},{default:d(()=>[y(f(o.value),1)]),_:1})]),_:1},8,["open","title"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys.e05d1ca1.js.map
