"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["components/pages/DatabasesPage/ConnectionInfo"],{1055:(e,n,t)=>{t.r(n),t.d(n,{default:()=>d});var s=t(271),o=t(89),a=t(272),r=t.n(a),c=t(270);const l=o.Locale.getSection("components.buttons"),i=({id:e,content:n,icon:t="copy",className:o,tooltip:a=l.lmsg("copyToClipboard"),onCopy:r=()=>{},children:i})=>(0,c.jsx)(s.Button,{className:o,ghost:!0,icon:t,tooltip:a,onClick:()=>{(0,s.copyToClipboard)(n),r()},"data-action":"copy-to-clipboard"+(e?`-${e}`:""),children:i});i.propTypes={id:r().string,content:r().string.isRequired,className:r().string,icon:r().oneOfType([r().node,r().string,r().object]),tooltip:r().oneOfType([r().string,r().node]),onCopy:r().func,children:r().node};const d=i},1383:(e,n,t)=>{t.r(n),t.d(n,{default:()=>u});var s=t(271),o=t(272),a=t.n(o),r=t(548),c=t(1055),l=t(89),i=t(270);const d=({data:e,children:n,childrenAsButton:t=!1,component:o=s.Paragraph,id:a,...d})=>(0,i.jsxs)(o,{...d,children:[!t&&n," ",(0,i.jsx)(c.default,{id:a,content:e,onCopy:()=>(0,r.addToast)({intent:"success",message:l.Locale.getSection("components.buttons").lmsg("copied")}),children:t&&n})]});d.propTypes={childrenAsButton:a().bool,component:a().oneOf([a().node,a().string]),data:a().string.isRequired,children:a().node.isRequired,id:a().string};const u=d},1021:(e,n,t)=>{t.r(n),t.d(n,{default:()=>r});var s=t(270),o=t(592),a=t(271);const r=({onClose:e,isOpen:n=!0,closeOnFormSuccess:t=!0,closeUrl:r="..",form:c,...l})=>{const i=(0,o.useNavigate)(),[d,u]=(0,s.useState)(n),p=(0,s.useRef)(null),m=(0,s.useCallback)(((...n)=>{const t=e??(()=>i(r,{preventScrollReset:!0}));u(!1),p.current=setTimeout((()=>{t(...n),p.current=null}),300)}),[r,i,e]);(0,s.useEffect)((()=>()=>{p.current&&clearTimeout(p.current)}),[]),(0,s.useEffect)((()=>{n?p.current&&clearTimeout(p.current):u(n)}),[n]);const f=(0,s.useMemo)((()=>{if(c&&t){if((0,s.isValidElement)(c))return(0,s.cloneElement)(c,{onSuccess:(...e)=>{c.props.onSuccess?.(...e),m()}});if("object"==typeof c)return{...c,onSuccess:(...e)=>{c.onSuccess?.(...e),m()}}}return c}),[t,m,c]);return(0,s.jsx)(a.Drawer,{...l,form:f,onClose:m,isOpen:d})}},2411:(e,n,t)=>{t.r(n),t.d(n,{default:()=>m});var s=t(598),o=t(592),a=t(271),r=t(89),c=t(1021),l=t(1383),i=t(803),d=t.n(i),u=t(270);const p=r.Locale.getTranslate("components.pages.Databases.ConnectionInfo"),m=()=>{const e=(0,o.useParams)(),{data:{database:n}}=(0,s.useQuery)(d(),{variables:{id:btoa(`Database:${e.databaseId}`)}}),t=n.defaultUser??n.users[0];return(0,u.jsxs)(c.default,{title:(0,u.jsx)(p,{content:"title"}),subtitle:(0,u.jsx)(p,{content:"description",params:{database:n.name}}),size:"sm","data-type":"connection-info",children:[(0,u.jsx)(a.Paragraph,{children:(0,u.jsx)(p,{content:"hint"})}),(0,u.jsx)(a.FormField,{label:(0,u.jsx)(p,{content:"host"}),children:(0,u.jsx)(l.default,{data:`${n.server.host}:${n.server.port}`,children:`${n.server.host}:${n.server.port}`})}),(0,u.jsx)(a.FormField,{label:(0,u.jsx)(p,{content:"databaseName"}),children:(0,u.jsx)(l.default,{data:n.name,children:n.name})}),(0,u.jsx)(a.FormField,{label:(0,u.jsx)(p,{content:"user"}),children:t?(0,u.jsx)(l.default,{data:t.login,children:t.login}):(0,u.jsx)(a.Paragraph,{children:(0,u.jsx)(p,{content:"noDefaultUser"})})}),(0,u.jsx)(a.FormField,{label:(0,u.jsx)(p,{content:"password"}),children:t?"********":""})]})}}}]);
//# sourceMappingURL=ConnectionInfo.js.map?90e5ff44d069c463f5e6