import{C as x}from"./CrudView.f8f7347d.js";import{d as I,r as A,i as e,ei as C,c as h,ac as D,f as p,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.b9bb33e7.js";import{a as N}from"./asyncComputed.7ddee0b0.js";import{A as c}from"./apiKey.1bb9c6d2.js";import"./router.135b49e3.js";import{M as $}from"./member.a66ab498.js";import{a as z}from"./project.f3f1cd2e.js";import"./tables.d6f8baad.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.264a92d9.js";import"./constants.0deee127.js";import"./url.7fa35693.js";import"./PhDotsThreeVertical.vue.e9b1faec.js";import"./index.b57ea477.js";import"./index.cb46e99b.js";import"./record.c01e7f08.js";import"./string.04644599.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]="e66e256b-5f0e-41aa-98a4-fca12b95856e",s._sentryDebugIdIdentifier="sentry-dbid-e66e256b-5f0e-41aa-98a4-fca12b95856e")}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:k,refetch:m}=N(async()=>Promise.all([c.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)})))),b=async a=>{const n=await c.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=k.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 c.delete(l,i.id),m()}}]}]}}))!=null?n:[]}});return(a,n)=>(P(),D(M,null,[p(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:b},null,8,["entity-name","create-button-text","loading","title","description","empty-title","table"]),p(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(()=>[p(t(T),null,{default:d(()=>[y(f(t(e).translate("i18n_apikeysview_modal_description")),1)]),_:1}),p(t(j),{code:"",copyable:""},{default:d(()=>[y(f(o.value),1)]),_:1})]),_:1},8,["open","title"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys.0ebb0b5f.js.map
