var b=Object.defineProperty;var g=(a,t,e)=>t in a?b(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var p=(a,t,e)=>(g(a,typeof t!="symbol"?t+"":t,e),e);import{d as w,eA as h,G as v,b as k,c as I,u as _}from"./outputWidgets.6d6b4a37.js";import{a as $}from"./asyncComputed.17a6198d.js";import"./router.4e9df257.js";import"./index.2cafcd9c.js";import{C as i}from"./gateway.7a58b0c8.js";import{g as C}from"./icons.28d0d847.js";import{C as j}from"./CrudView.230a173f.js";import"./Form.1ff54ed5.js";import"./index.72c317ca.js";import"./record.7835c07e.js";import"./pubsub.7d377b25.js";import"./index.0e216cc8.js";import"./Title.b41b4f96.js";import"./url.b5fbb423.js";import"./index.9eddb8ae.js";import"./index.6f6e8ffd.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]="bfd6d7ff-7ff2-4943-bb87-4b32a3f41924",a._sentryDebugIdIdentifier="sentry-dbid-bfd6d7ff-7ff2-4943-bb87-4b32a3f41924")}catch{}})();class A{constructor(){p(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 A;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 O=w({__name:"EnvVars",setup(a){const e=h().params.projectId,{loading:r,result:l,refetch:d}=$(()=>n.list(e)),m=[{label:"Variable name",key:"key"},{label:"Variable value",key:"value",type:"password"}];async function f({key:s,value:o}){await n.create(e,s,o),d()}const y=v(()=>{var s,o;return{columns:[{name:"Key"},{name:"Actions",align:"right"}],rows:(o=(s=l.value)==null?void 0:s.map(u=>({key:u.key,cells:[{text:u.key},{text:"Actions",actions:[{icon:C,label:"Delete",async onClick(){await u.delete(),d()},dangerous:!0}]}]})))!=null?o:[]}});return(s,o)=>(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:y.value,"create-button-text":"Add Environment Variable",fields:m,onCreate:f},null,8,["loading","table"]))}});export{O as default};
//# sourceMappingURL=EnvVars.0b4ebdf0.js.map
