(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6446],{10463:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/datastore-connection/[id]",function(){return t(88228)}])},88228:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return g}});var i=t(24246),l=t(1226),s=t(96306),r=t(86677),a=t(27378),o=t(16134),d=t(17245),c=t(77830),u=t(20682),h=t(94725),f=t(58754),x=t(11274),p=t(26788),y=t(38212),v=t(50881),j=t(41337),m=()=>{let e=(0,o.T)(),{connection:n,connectionOption:t}=(0,o.C)(u.ZZ),[l,r]=(0,a.useState)(void 0),d=(0,a.useMemo)(()=>{let e=[];return(null==l?void 0:l.options)&&l.options.forEach(t=>{let l;switch(t){case p.H5.CONNECTOR_PARAMETERS:l={label:t,key:t,children:(0,i.jsx)(x.s,{})};break;case p.H5.DATASET_CONFIGURATION:l=(null==n?void 0:n.key)?{label:t,key:t,children:(0,i.jsx)(y.Z,{})}:void 0;break;case p.H5.DSR_CUSTOMIZATION:l=(null==n?void 0:n.key)?{label:t,key:t,children:(0,i.jsx)(v.Z,{})}:void 0}l&&e.push(l)}),e},[null==n?void 0:n.key,null==l?void 0:l.options]);return(0,a.useEffect)(()=>{if(t){let n=p.IM.find(e=>e.type===(null==t?void 0:t.type));n&&(r(n),e((0,u.nj)(p.Ss[2])))}return()=>{e((0,u.mc)())}},[t,e]),n&&t?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(f.Z,{heading:"Connection manager",breadcrumbItems:[{title:"All connections",href:c.JR},{title:n.name}]}),(0,i.jsx)(s.X6q,{fontSize:"md",fontWeight:"semibold",maxHeight:"40px",mb:"4px",whiteSpace:"nowrap",children:(0,i.jsxs)(s.xuv,{alignItems:"center",display:"flex",children:[(0,i.jsx)(j.Z,{data:t}),(0,i.jsx)(s.xvT,{ml:"8px",children:n.name})]})}),(0,i.jsx)(s.gCW,{alignItems:"stretch",flex:"1",gap:"18px",children:(0,i.jsx)(s.A5g,{items:d})})]}):null},_=t(21910),g=()=>{let e=(0,o.T)(),n=(0,r.useRouter)(),{id:t}=n.query,{errorAlert:f}=(0,d.VY)(),x=(0,o.C)(u.y_),[p,y]=(0,a.useState)(!0),v=(e,n)=>n.find(n=>{var t;return n.identifier===e.connection_type&&n.identifier!==_.Rj.SAAS||n.identifier===(null===(t=e.saas_config)||void 0===t?void 0:t.type)});return(0,a.useEffect)(()=>{let i=()=>{f("An error occurred while loading ".concat(n.query.id)),n.push(c.JR,void 0,{shallow:!0})},l=async n=>{try{let t=[];t.push(e(h.DM.endpoints.getDatastoreConnectionByKey.initiate(n))),0===x.length&&t.push(e(u.d8.endpoints.getAllConnectionTypes.initiate({search:""})));let l=await Promise.allSettled(t);if(l.every(e=>"fulfilled"===e.status)){e((0,u.lm)(l[0].value.data));let n=[...l[1]?l[1].value.data.items:x],t=v(l[0].value.data,n);e((0,u.yA)(t)),y(!1)}else i()}catch(e){i()}};return t&&l(t),()=>{}},[t]),(0,i.jsxs)(i.Fragment,{children:[p&&(0,i.jsx)(s.xuv,{display:"flex",h:"100vh",justifyContent:"center",children:(0,i.jsx)(s.M5Y,{children:(0,i.jsx)(s.$jN,{})})}),!p&&(0,i.jsx)(l.Z,{children:(0,i.jsx)(m,{})})]})}}},function(e){e.O(0,[431,8765,699,6527,1467,5574,4608,2888,9774,179],function(){return e(e.s=10463)}),_N_E=e.O()}]);