var b=Object.defineProperty;var w=(a,t,e)=>t in a?b(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var d=(a,t,e)=>(w(a,typeof t!="symbol"?t+"":t,e),e);import{d as g,eB as h,G as v,b as k,c as I,u as _}from"./outputWidgets.ed48fa42.js";import{a as $}from"./asyncComputed.bb2b1403.js";import{C as i}from"./router.1b12d634.js";import"./index.5e38be4e.js";import{o as C}from"./icons.92b5bc38.js";import{C as j}from"./CrudView.2b6e0547.js";import"./FormItem.c1c36356.js";import"./hasIn.a220eabf.js";import"./index.60984836.js";import"./index.cf4c23b9.js";import"./record.2ea2ab4d.js";import"./pubsub.90864e85.js";import"./Title.89d211e5.js";import"./Text.b5b9d884.js";import"./Form.471d6bcc.js";import"./Modal.f08a6e4a.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.8c8873a1.js";import"./url.c9588410.js";import"./index.2264b72c.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="f1ef4216-1a04-4514-a655-e71f0b183677",a._sentryDebugIdIdentifier="sentry-dbid-f1ef4216-1a04-4514-a655-e71f0b183677")}catch{}})();class P{constructor(){d(this,"urlPath","env-vars")}async create(t){return i.post(`projects/${t.projectId}/${this.urlPath}`,{name:t.name,value:t.value})}async delete(t,e){await i.delete(`projects/${t}/${this.urlPath}/${e}`)}async list(t){return i.get(`projects/${t}/${this.urlPath}`)}async get(t){return i.get(`${this.urlPath}/${t}`)}}const c=new P;class n{constructor(t,e){this.projectId=t,this.dto=e}static async list(t){return(await c.list(t)).map(r=>new n(t,r))}static async create(t,e,r){const l=await c.create({projectId:t,name:e,value:r});return new n(t,l)}static async get(t,e){const r=await c.get(e);return new n(t,r)}get key(){return this.dto.name}get value(){return this.dto.value}async delete(){await c.delete(this.projectId,this.key)}}const U=g({__name:"EnvVars",setup(a){const e=h().params.projectId,{loading:r,result:l,refetch:p}=$(()=>n.list(e)),m=[{label:"Variable name",key:"key"},{label:"Variable value",key:"value",type:"password"}];async function y({key:o,value:s}){await n.create(e,o,s),p()}const f=v(()=>{var o,s;return{columns:[{name:"Key"},{name:"",align:"right"}],rows:(s=(o=l.value)==null?void 0:o.map(u=>({key:u.key,cells:[{type:"text",text:u.key},{type:"actions",actions:[{icon:C,label:"Delete",async onClick(){await u.delete(),p()},dangerous:!0}]}]})))!=null?s:[]}});return(o,s)=>(k(),I(j,{"entity-name":"Env var",loading:_(r),title:"Environment Variables",description:"Set environment variables for your project.","empty-title":"No environment variables set",table:f.value,"create-button-text":"Add Environment Variable",fields:m,onCreate:y},null,8,["loading","table"]))}});export{U as default};
//# sourceMappingURL=EnvVars.7d15c9fe.js.map
