import{d as A,r as w,eB as _,H as k,b as v,ev as x,f as i,u as l,w as p,aD as C,eQ as h,ar as y,eD as P}from"./outputWidgets.74b0761d.js";import{i as D}from"./icons.fd5c09b0.js";import{a as M}from"./asyncComputed.fbb4ba44.js";import"./router.e97d6286.js";import"./index.c51517e3.js";import{M as N}from"./member.5bc6fef4.js";import{A as d}from"./apiKey.1661d314.js";import{P as T}from"./project.abf3ccd9.js";import{C as j}from"./CrudView.742df36b.js";import{A as B}from"./Paragraph.5d2768c0.js";import{A as K}from"./Text.b007494b.js";import{M as V}from"./Modal.80395829.js";import"./Form.a24c61ad.js";import"./hasIn.d2130316.js";import"./popupNotifcation.2bb5bdcc.js";import"./index.cf4c23b9.js";import"./record.acc69298.js";import"./pubsub.4c1d9617.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.9e6cb829.js";import"./url.0584bb06.js";import"./index.0327679a.js";import"./Title.a6d4b5b0.js";import"./Base.4463d78c.js";import"./Typography.5e0282a3.js";import"./index.2189f45b.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]="391e1263-b12e-40eb-b4b0-8b880ab68c1f",n._sentryDebugIdIdentifier="sentry-dbid-391e1263-b12e-40eb-b4b0-8b880ab68c1f")}catch{}})();const le=A({__name:"ApiKeys",setup(n){const a=w(null),m=[{key:"name",label:"API key name"}],s=_().params.projectId,{loading:f,result:b,refetch:c}=M(async()=>Promise.all([d.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 d.create({projectId:s,name:e.name});c(),a.value=t.value},I=k(()=>{var e,t;return{columns:[{name:"Name"},{name:"Creation date"},{name:"Owner"},{name:"",align:"right"}],rows:(t=(e=b.value)==null?void 0:e.map(({apiKey:o,member:r})=>{var u;return{key:o.id,cells:[{type:"text",text:o.name},{type:"text",text:h(o.createdAt)},{type:"text",text:(u=r==null?void 0:r.email)!=null?u:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:D,dangerous:!0,onClick:async()=>{await d.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(v(),x(C,null,[i(j,{"entity-name":"API key","create-button-text":"Create API Key",loading:l(f),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:p(()=>[]),default:p(()=>[i(l(B),null,{default:p(()=>[y("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:p(()=>[y(P(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{le as default};
//# sourceMappingURL=ApiKeys.fb8eb2a1.js.map
