import{d as A,r as w,eB as C,H as _,b as k,eu as x,f as i,u as l,w as d,aC as P,eR as v,eP as h,aq as y,eE as D}from"./outputWidgets.e9677800.js";import{a as M}from"./asyncComputed.37b7af98.js";import"./router.e014ddc2.js";import"./index.21e91f9c.js";import{M as N}from"./member.9738366a.js";import{A as p}from"./apiKey.7d1e4a2b.js";import{P as j}from"./project.cbeb8ca8.js";import{C as B}from"./CrudView.8e03181d.js";import{A as E}from"./Paragraph.394702f6.js";import{A as K}from"./Text.fd9e90fd.js";import{M as T}from"./Modal.df560cc7.js";import"./Form.9737d51d.js";import"./hasIn.bd3f78ff.js";import"./popupNotifcation.7148cdf9.js";import"./index.cf4c23b9.js";import"./record.767f28b7.js";import"./pubsub.9e36d89a.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.a4277c3a.js";import"./url.89c6b244.js";import"./index.42279d35.js";import"./Title.c954a24a.js";import"./Base.64d54b8f.js";import"./Typography.511f4fec.js";import"./index.1a0bd015.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]="8813bb6c-df3e-4e47-b808-9087535ca280",n._sentryDebugIdIdentifier="sentry-dbid-8813bb6c-df3e-4e47-b808-9087535ca280")}catch{}})();const ie=A({__name:"ApiKeys",setup(n){const a=w(null),m=[{key:"name",label:"API key name"}],s=C().params.projectId,{loading:f,result:g,refetch:c}=M(async()=>Promise.all([p.list(s),j.get(s).then(e=>N.list(e.organizationId))]).then(([e,t])=>e.map(o=>({apiKey:o,member:t.find(r=>r.authorId===o.ownerId)})))),b=async e=>{const t=await p.create({projectId:s,name:e.name});c(),a.value=t.value},I=_(()=>{var e,t;return{columns:[{name:"Name"},{name:"Creation date"},{name:"Owner"},{name:"",align:"right"}],rows:(t=(e=g.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:v(o.createdAt)},{type:"text",text:(u=r==null?void 0:r.email)!=null?u:"Unknown"},{type:"actions",actions:[{label:"Delete",icon:h,dangerous:!0,onClick:async()=>{await p.delete(s,o.id),c()}}]}]}}))!=null?t:[]}});return(e,t)=>(k(),x(P,null,[i(B,{"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:b},null,8,["loading","table"]),i(l(T),{open:!!a.value,title:"Api key generated",onCancel:t[0]||(t[0]=o=>a.value=null)},{footer:d(()=>[]),default:d(()=>[i(l(E),null,{default:d(()=>[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:d(()=>[y(D(a.value),1)]),_:1})]),_:1},8,["open"])],64))}});export{ie as default};
//# sourceMappingURL=ApiKeys.c91ed7a0.js.map
