var f=Object.defineProperty;var w=(a,t,e)=>t in a?f(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.fdae7e91.js";import{a as $}from"./asyncComputed.43537aae.js";import"./authorManager.adc33c37.js";import"./index.30fe2a77.js";import{C as i}from"./gateway.8c35b4b8.js";import{l as C}from"./icons.59384d21.js";import{C as j}from"./CrudView.e3fe23cf.js";import"./index.cf4c23b9.js";import"./record.f963a373.js";import"./pubsub.61789656.js";import"./Title.e4079793.js";import"./Text.2d7466b9.js";import"./FormItem.45b6065e.js";import"./hasIn.e6601643.js";import"./Form.d4070d32.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.ed9adb70.js";import"./router.ae435e74.js";import"./index.6f560850.js";import"./url.f60fbe92.js";import"./index.42add8ec.js";import"./index.9026b0b4.js";import"./index.a700463c.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]="a07dbd88-439c-4c6e-8ec5-36568714fb56",a._sentryDebugIdIdentifier="sentry-dbid-a07dbd88-439c-4c6e-8ec5-36568714fb56")}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 Y=g({__name:"EnvVars",setup(a){const e=h().params.projectId,{loading:r,result:l,refetch:u}=$(()=>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),u()}const b=v(()=>{var o,s;return{columns:[{name:"Key"},{name:"Actions",align:"right"}],rows:(s=(o=l.value)==null?void 0:o.map(p=>({key:p.key,cells:[{text:p.key},{text:"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{Y as default};
//# sourceMappingURL=EnvVars.8c632073.js.map
