"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[6140],{13759:(e,a,t)=>{t.r(a),t.d(a,{default:()=>r});var l=t(65043),n=t(89923),s=t(70579);const r=e=>{let{onChange:a}=e;const[t,r]=(0,l.useState)(!1),[o,u]=(0,l.useState)(""),[i,c]=(0,l.useState)(""),[d,m]=(0,l.useState)(""),[g,h]=(0,l.useState)(""),[b,p]=(0,l.useState)(""),[v,f]=(0,l.useState)(""),[x,j]=(0,l.useState)(" "),[C,S]=(0,l.useState)(""),[w,y]=(0,l.useState)("namespace"),[_,k]=(0,l.useState)(""),[E,$]=(0,l.useState)(""),[q,B]=(0,l.useState)(""),D=(0,l.useCallback)((()=>{let e="";return""!==i&&(e=`${e} host=${i}`),""!==d&&(e=`${e} dbname=${d}`),""!==b&&(e=`${e} user=${b}`),""!==v&&(e=`${e} password=${v}`),""!==g&&(e=`${e} port=${g}`)," "!==x&&(e=`${e} sslmode=${x}`),e=`${e} `,e.trim()}),[i,d,b,v,g,x]);return(0,l.useEffect)((()=>{if(""!==o){a([{key:"connection_string",value:o},{key:"table",value:C},{key:"format",value:w},{key:"queue_dir",value:_},{key:"queue_limit",value:E},{key:"comment",value:q}])}}),[o,C,w,_,E,q,a]),(0,l.useEffect)((()=>{const e=D();u(e)}),[b,d,v,g,x,i,u,D]),(0,l.useEffect)((()=>{if(t){const e=D();return void u(e)}const e=((e,a)=>{let t=[];for(const s of a){const a=e.indexOf(s+"=");-1!==a&&t.push(a)}t.sort(((e,a)=>e-a));let l=new Map,n=new Array(t.length);for(let s=0;s<t.length;s++){const a=s+1;a<t.length?n[s]=e.slice(t[s],t[a]):n[s]=e.slice(t[s])}for(let s of n){if(void 0===s)continue;const e=s.slice(0,s.indexOf("=")),a=s.slice(s.indexOf("=")+1).trim();l.set(e,a)}return l})(o,["host","port","dbname","user","password","sslmode"]);c(e.get("host")?e.get("host")+"":""),h(e.get("port")?e.get("port")+"":""),m(e.get("dbname")?e.get("dbname")+"":""),p(e.get("user")?e.get("user")+"":""),f(e.get("password")?e.get("password")+"":""),j(e.get("sslmode")?e.get("sslmode")+"":" ")}),[t]),(0,s.jsxs)(n.Hbc,{containerPadding:!1,withBorders:!1,children:[(0,s.jsx)(n.dOG,{label:"Manually Configure String",checked:t,id:"manualString",name:"manualString",onChange:e=>{r(e.target.checked)},value:"manualString"}),t?(0,s.jsx)(l.Fragment,{children:(0,s.jsx)(n.cl_,{id:"connection-string",name:"connection_string",label:"Connection String",value:o,onChange:e=>{u(e.target.value)}})}):(0,s.jsxs)(l.Fragment,{children:[(0,s.jsx)(n.xA9,{item:!0,xs:12,children:(0,s.jsxs)(n.azJ,{withBorders:!0,useBackground:!0,sx:{overflowY:"auto",height:170,marginBottom:12},children:[(0,s.jsx)(n.cl_,{id:"host",name:"host",label:"",placeholder:"Enter Host",value:i,onChange:e=>{c(e.target.value)}}),(0,s.jsx)(n.cl_,{id:"db-name",name:"db-name",label:"",placeholder:"Enter DB Name",value:d,onChange:e=>{m(e.target.value)}}),(0,s.jsx)(n.cl_,{id:"port",name:"port",label:"",placeholder:"Enter Port",value:g,onChange:e=>{h(e.target.value)}}),(0,s.jsx)(n.l6P,{value:x,label:"",id:"sslmode",name:"sslmode",onChange:e=>{e&&j(e+"")},options:[{label:"Enter SSL Mode",value:" "},{label:"Require",value:"require"},{label:"Disable",value:"disable"},{label:"Verify CA",value:"verify-ca"},{label:"Verify Full",value:"verify-full"}]}),(0,s.jsx)(n.cl_,{id:"user",name:"user",label:"",placeholder:"Enter User",value:b,onChange:e=>{p(e.target.value)}}),(0,s.jsx)(n.cl_,{id:"password",name:"password",label:"",type:"password",placeholder:"Enter Password",value:v,onChange:e=>{f(e.target.value)}})]})}),(0,s.jsx)(n.EmB,{label:"Connection String",multiLine:!0,children:o})]}),(0,s.jsx)(n.cl_,{id:"table",name:"table",label:"Table",placeholder:"Enter Table Name",value:C,tooltip:"DB table name to store/update events, table is auto-created",onChange:e=>{S(e.target.value)}}),(0,s.jsx)(n.z6M,{currentValue:w,id:"format",name:"format",label:"Format",onChange:e=>{y(e.target.value)},tooltip:"'namespace' reflects current bucket/object list and 'access' reflects a journal of object operations, defaults to 'namespace'",selectorOptions:[{label:"Namespace",value:"namespace"},{label:"Access",value:"access"}]}),(0,s.jsx)(n.cl_,{id:"queue-dir",name:"queue_dir",label:"Queue Dir",placeholder:"Enter Queue Directory",value:_,tooltip:"Staging directory for undelivered messages e.g. '/home/events'",onChange:e=>{k(e.target.value)}}),(0,s.jsx)(n.cl_,{id:"queue-limit",name:"queue_limit",label:"Queue Limit",placeholder:"Enter Queue Limit",type:"number",value:E,tooltip:"Maximum limit for undelivered messages, defaults to '10000'",onChange:e=>{$(e.target.value)}}),(0,s.jsx)(n.hFj,{id:"comment",name:"comment",label:"Comment",placeholder:"Enter custom notes if any",value:q,onChange:e=>{B(e.target.value)}})]})}}}]);
//# sourceMappingURL=6140.ff277d79.chunk.js.map