dsql-admin/dsql-app/.local_dist/static/chunks/pages/su/envar-cf23a0d85f1b95f7.js

1 line
5.2 KiB
JavaScript
Raw Permalink Normal View History

2024-12-09 09:39:09 +00:00
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3641],{4224:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/su/envar",function(){return n(3581)}])},7296:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(5737).A)("CloudUpload",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m16 16-4-4-4 4",key:"119tzi"}]])},6831:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(5737).A)("DatabaseBackup",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 12a9 3 0 0 0 5 2.69",key:"1ui2ym"}],["path",{d:"M21 9.3V5",key:"6k6cib"}],["path",{d:"M3 5v14a9 3 0 0 0 6.47 2.88",key:"i62tjy"}],["path",{d:"M12 12v4h4",key:"1bxaet"}],["path",{d:"M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16",key:"1f4ei9"}]])},8622:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(5737).A)("FileWarning",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},7206:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(5737).A)("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]])},4858:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(5737).A)("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]])},2750:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(5737).A)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},2595:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(5737).A)("SquareChevronRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]])},4909:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(5737).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},3581:(e,t,n)=>{"use strict";let r;n.r(t),n.d(t,{__N_SSP:()=>l,default:()=>p});var a=n(4848),i=n(6540),s=n(2016),u=n(620);n(3501);var c=n(3698);function o(e){let{envObject:t,envKey:n}=e,[s,o]=i.useState(!1),[d,l]=i.useState(!1),[p,h]=i.useState(t[n]),[y,k]=i.useState(!1);return(0,a.jsx)(i.Fragment,{children:(0,a.jsxs)("form",{className:"grid grid-cols-2 items-center gap2 w-full hover:bg-slate-100 py-2 px-4 relative",onSubmit:e=>{e.preventDefault(),s&&(l(!0),setTimeout(()=>{l(!1)},1e3))},children:[d&&(0,a.jsx)(u.A,{width:"20px"}),(0,a.jsx)("span",{children:n}),(0,a.jsxs)("div",{children:[(0,a.jsx)("input",{type:s?"text":"password",onFocus:e=>{"password"==e.target.type&&(e.target.type="text"),k(!0),o(!0)},onBlur:e=>{window.clearTimeout(r),r=setTimeout(()=>{"text"==e.target.type&&(e.target.type="password"),k(!1),o(!1)},2e3)},value:p,onChange:e=>{h(e.target.value)}}),y?(0,a.jsx)("div",{className:"button secondary",onClick:e=>{e.preventDefault(),s&&(l(!0),(0,c.A)("/api/admin/updateEnv",{method:"post",body:{key:n,value:p}}).then(e=>{e.success?window.location.reload():window.alert(e.error)}).finally(()=>{setTimeout(()=>{l(!1)},1e3)}))},children:"Update"}):(0,a.jsx)("div",{className:"button outlined",onClick:e=>{o(!s),k(!0)},children:"Reveal"})]})]})})}function d(e){let{data:t}=e,{envObject:n}=t,[r,s]=i.useState(n),u=Object.keys(r);return(0,a.jsxs)(i.Fragment,{children:[(0,a.jsxs)("div",{className:"w-full justify-between",children:[(0,a.jsx)("h2",{className:"text-2xl m-0",children:"Environment Variables"}),(0,a.jsx)("button",{onClick:e=>{let t=window.prompt("What is the new ENV name?"),n=window.prompt("ENV Value");t&&n&&s(e=>{let r={...e};return r[t]=n,r})},children:"Add Environment Variable"}