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 m=(a,t,e)=>(w(a,typeof t!="symbol"?t+"":t,e),e);import{d as g,ez as h,F as v,b as k,c as I,u as _}from"./outputWidgets.34c6efe4.js";import{a as $}from"./asyncComputed.c2993a02.js";import{C as i}from"./router.5e015991.js";import"./jwt-decode.esm.74bd4619.js";import"./index.56db27ff.js";import{o as C}from"./icons.54b54949.js";import{C as j}from"./CrudView.4c8279a4.js";import"./FormItem.87557e8f.js";import"./hasIn.7f8c0878.js";import"./storage.f2a353cd.js";import"./index.b5389b8f.js";import"./index.cf4c23b9.js";import"./record.24a52f99.js";import"./pubsub.7392fe5a.js";import"./Title.6b365a17.js";import"./Text.4d22598c.js";import"./Form.3d80c841.js";import"./Modal.20b7a2a4.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.d3e3a57a.js";import"./url.e9fe64cc.js";import"./index.95a2f4e1.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]="600f579b-4b94-462b-8a68-a9065a6b9e33",a._sentryDebugIdIdentifier="sentry-dbid-600f579b-4b94-462b-8a68-a9065a6b9e33")}catch{}})();class P{constructor(){m(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 X=g({__name:"EnvVars",setup(a){const e=h().params.projectId,{loading:r,result:l,refetch:u}=$(()=>n.list(e)),d=[{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:"",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:d,onCreate:y},null,8,["loading","table"]))}});export{X as default};
//# sourceMappingURL=EnvVars.841662c4.js.map
