import{C as x}from"./CrudView.a7272ae3.js";import{d as I,r as A,i as e,c as C,ac as D,f as p,u as a,b as d,aY as M,eA as h,o as P,de as T,g as y,t as f,df as j,M as V,eC as B,eL as E}from"./jwt-decode.esm.fbcfeaec.js";import{a as N}from"./asyncComputed.5a2bb5ad.js";import{A as c}from"./apiKey.1a7d0915.js";import"./router.ed823a0a.js";import{M as $}from"./member.62d0039c.js";import{a as z}from"./project.ea5e8538.js";import"./tables.76beaff5.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.28a130ec.js";import"./constants.b8ded506.js";import"./url.90414523.js";import"./PhDotsThreeVertical.vue.1f08b241.js";import"./index.561c6514.js";import"./index.d9ce41fc.js";import"./record.63a637c8.js";import"./string.b10c2096.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]="f87ff2e7-b397-4d0c-8105-fcb855224a03",s._sentryDebugIdIdentifier="sentry-dbid-f87ff2e7-b397-4d0c-8105-fcb855224a03")}catch{}})();const te=I({__name:"ApiKeys",setup(s){const o=A(null),m=[{key:"name",label:e.translate("i18n_apikeysview_field_name")}],r=h().params.projectId,w=new $,{loading:v,result:b,refetch:_}=N(async()=>Promise.all([c.list(r),z.get(r).then(n=>w.list(n.organizationId))]).then(([n,t])=>n.map(i=>({apiKey:i,member:t.find(l=>l.authorId===i.ownerId)})))),k=async n=>{const t=await c.create({projectId:r,name:n.name});_(),o.value=t.value},g=C(()=>{var n,t;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:(t=(n=b.value)==null?void 0:n.map(({apiKey:i,member:l})=>{var u;return{key:i.id,cells:[{type:"text",text:i.name},{type:"text",text:B(i.createdAt)},{type:"text",text:(u=l==null?void 0:l.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(r,i.id),_()}}]}]}}))!=null?t:[]}});return(n,t)=>(P(),D(M,null,[p(x,{"entity-name":a(e).translate("i18n_apikeysview_entity_name"),"create-button-text":a(e).translate("i18n_apikeysview_create_button"),loading:a(v),title:a(e).translate("i18n_apikeysview_title"),description:a(e).translate("i18n_apikeysview_description"),"empty-title":a(e).translate("i18n_apikeysview_empty_title"),table:g.value,fields:m,create:k},null,8,["entity-name","create-button-text","loading","title","description","empty-title","table"]),p(a(V),{open:!!o.value,title:a(e).translate("i18n_apikeysview_modal_title"),onCancel:t[0]||(t[0]=i=>o.value=null)},{footer:d(()=>[...t[1]||(t[1]=[])]),default:d(()=>[p(a(T),null,{default:d(()=>[y(f(a(e).translate("i18n_apikeysview_modal_description")),1)]),_:1}),p(a(j),{code:"",copyable:""},{default:d(()=>[y(f(o.value),1)]),_:1})]),_:1},8,["open","title"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys.1dce59ad.js.map
