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 u=(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.470cd725.js";import{a as $}from"./asyncComputed.72d91ef9.js";import"./authorManager.176ccd94.js";import"./index.d44cde0e.js";import{C as i}from"./gateway.6d700df7.js";import{o as C}from"./icons.732210f6.js";import{C as j}from"./CrudView.e08250db.js";import"./index.cf4c23b9.js";import"./record.19f593f6.js";import"./pubsub.bb7b27fb.js";import"./Title.edbac04b.js";import"./Text.fbb768c7.js";import"./FormItem.bd89e955.js";import"./hasIn.6bd3aa8a.js";import"./Form.bf13abb6.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.702cb95e.js";import"./router.bb51d819.js";import"./index.672f7932.js";import"./url.28fafd73.js";import"./index.e48b3db7.js";import"./index.2d4e9800.js";import"./index.52ab7ae6.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]="4876c5ad-bde8-4137-a596-2df039f2c4fb",a._sentryDebugIdIdentifier="sentry-dbid-4876c5ad-bde8-4137-a596-2df039f2c4fb")}catch{}})();class P{constructor(){u(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 o{constructor(t,e){this.projectId=t,this.dto=e}static async list(t){return(await c.list(t)).map(r=>new o(t,r))}static async create(t,e,r){const l=await c.create({projectId:t,name:e,value:r});return new o(t,l)}static async get(t,e){const r=await c.get(e);return new o(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:p}=$(()=>o.list(e)),m=[{label:"Variable name",key:"key"},{label:"Variable value",key:"value",type:"password"}];async function y({key:n,value:s}){await o.create(e,n,s),p()}const f=v(()=>{var n,s;return{columns:[{name:"Key"},{name:"Actions",align:"right"}],rows:(s=(n=l.value)==null?void 0:n.map(d=>({key:d.key,cells:[{text:d.key},{text:"Actions",actions:[{icon:C,label:"Delete",async onClick(){await d.delete(),p()},dangerous:!0}]}]})))!=null?s:[]}});return(n,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{Y as default};
//# sourceMappingURL=EnvVars.f9f03a19.js.map
