var f=Object.defineProperty;var w=(a,e,t)=>e in a?f(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var d=(a,e,t)=>(w(a,typeof e!="symbol"?e+"":e,t),t);import{d as g,ez as h,F as v,b as k,c as I,u as _}from"./outputWidgets.b703ca45.js";import{a as $}from"./asyncComputed.557fdbc3.js";import{C as i}from"./router.c2e4e322.js";import"./jwt-decode.esm.74bd4619.js";import"./index.58a6f7ec.js";import{o as C}from"./icons.5202cd65.js";import{C as j}from"./CrudView.93e41830.js";import"./FormItem.39e0b98f.js";import"./hasIn.66135dec.js";import"./storage.4f0beb94.js";import"./index.cd3799ce.js";import"./index.cf4c23b9.js";import"./record.6a34e5b4.js";import"./pubsub.781c61cb.js";import"./Title.c76d824d.js";import"./Text.4646803d.js";import"./Form.44bc3190.js";import"./Modal.c03e4b0a.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.69b7b47b.js";import"./url.7a748c18.js";import"./index.5255b475.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="dee746c3-3fcb-4e4b-91f3-66106eb629e1",a._sentryDebugIdIdentifier="sentry-dbid-dee746c3-3fcb-4e4b-91f3-66106eb629e1")}catch{}})();class P{constructor(){d(this,"urlPath","env-vars")}async create(e){return i.post(`projects/${e.projectId}/${this.urlPath}`,{name:e.name,value:e.value})}async delete(e,t){await i.delete(`projects/${e}/${this.urlPath}/${t}`)}async list(e){return i.get(`projects/${e}/${this.urlPath}`)}async get(e){return i.get(`${this.urlPath}/${e}`)}}const c=new P;class n{constructor(e,t){this.projectId=e,this.dto=t}static async list(e){return(await c.list(e)).map(r=>new n(e,r))}static async create(e,t,r){const l=await c.create({projectId:e,name:t,value:r});return new n(e,l)}static async get(e,t){const r=await c.get(t);return new n(e,r)}get key(){return this.dto.name}get value(){return this.dto.value}async delete(){await c.delete(this.projectId,this.key)}}const X=g({__name:"EnvVars",setup(a){const t=h().params.projectId,{loading:r,result:l,refetch:u}=$(()=>n.list(t)),m=[{label:"Variable name",key:"key"},{label:"Variable value",key:"value",type:"password"}];async function y({key:o,value:s}){await n.create(t,o,s),u()}const b=v(()=>{var o,s;return{columns:[{name:"Key"},{name:"",align:"right"}],rows:(s=(o=l.value)==null?void 0:o.map(p=>({key:p.key,cells:[{type:"text",text:p.key},{type:"actions",actions:[{icon:C,label:"Delete",async onClick(){await p.delete(),u()},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:b.value,"create-button-text":"Add Environment Variable",fields:m,onCreate:y},null,8,["loading","table"]))}});export{X as default};
//# sourceMappingURL=EnvVars.d9af340b.js.map
