"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["components/pages/DatabasesPage/ConnectionInfo"],{1440:(e,t,n)=>{n.r(t),n.d(t,{default:()=>c});var s=n(286),o=n(89),a=n(285);const r=o.Locale.getSection("components.buttons"),c=({id:e,content:t,icon:n="copy",className:o,tooltip:c=r.lmsg("copyToClipboard"),onCopy:l=()=>{},children:i})=>(0,a.jsx)(s.Button,{className:o,ghost:!0,icon:n,tooltip:c,onClick:()=>{(0,s.copyToClipboard)(t),l()},"data-action":"copy-to-clipboard"+(e?`-${e}`:""),children:i})},1769:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var s=n(286),o=n(596),a=n.n(o),r=n(536),c=n(1440),l=n(89),i=n(285);const d=({data:e,children:t,childrenAsButton:n=!1,component:o=s.Paragraph,id:a,...d})=>(0,i.jsxs)(o,{...d,children:[!n&&t," ",(0,i.jsx)(c.default,{id:a,content:e,onCopy:()=>(0,r.addToast)({intent:"success",message:l.Locale.getSection("components.buttons").lmsg("copied")}),children:n&&t})]});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},1406:(e,t,n)=>{n.r(t),n.d(t,{default:()=>r});var s=n(285),o=n(580),a=n(286);const r=({onClose:e,isOpen:t=!0,closeOnFormSuccess:n=!0,closeUrl:r="..",form:c,...l})=>{const i=(0,o.useNavigate)(),[d,u]=(0,s.useState)(t),p=(0,s.useRef)(null),m=(0,s.useCallback)(((...t)=>{const n=e??(()=>i(r,{preventScrollReset:!0}));u(!1),p.current=setTimeout((()=>{n(...t),p.current=null}),300)}),[r,i,e]);(0,s.useEffect)((()=>()=>{p.current&&clearTimeout(p.current)}),[]),(0,s.useEffect)((()=>{t?p.current&&clearTimeout(p.current):u(t)}),[t]);const h=(0,s.useMemo)((()=>{if(c&&n){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}),[n,m,c]);return(0,s.jsx)(a.Drawer,{...l,form:h,onClose:m,isOpen:d})}},2622:(e,t,n)=>{n.r(t),n.d(t,{default:()=>m});var s=n(586),o=n(580),a=n(286),r=n(89),c=n(1406),l=n(1769),i=n(1108),d=n.n(i),u=n(285);const p=r.Locale.getTranslate("components.pages.Databases.ConnectionInfo"),m=()=>{const e=(0,o.useParams)(),{data:{database:t}}=(0,s.useQuery)(d(),{variables:{id:btoa(`Database:${e.databaseId}`)}}),n=t.defaultUser??t.users[0];return(0,u.jsxs)(c.default,{title:(0,u.jsx)(p,{content:"title"}),subtitle:(0,u.jsx)(p,{content:"description",params:{database:t.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:`${t.server.host}:${t.server.port}`,children:`${t.server.host}:${t.server.port}`})}),(0,u.jsx)(a.FormField,{label:(0,u.jsx)(p,{content:"databaseName"}),children:(0,u.jsx)(l.default,{data:t.name,children:t.name})}),(0,u.jsx)(a.FormField,{label:(0,u.jsx)(p,{content:"user"}),children:n?(0,u.jsx)(l.default,{data:n.login,children:n.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:n?"********":""})]})}}}]);
//# sourceMappingURL=ConnectionInfo.js.map?f1f7924b6097694c62ce