"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["components/pages/DatabasesPage/ConnectionInfo"],{1420:(e,t,s)=>{s.r(t),s.d(t,{default:()=>c});var n=s(295),o=s(598),a=s(296);const c=({onClose:e,isOpen:t=!0,closeOnFormSuccess:s=!0,closeUrl:c="..",form:r,...l})=>{const i=(0,o.useNavigate)(),[d,u]=(0,n.useState)(t),p=(0,n.useRef)(null),m=(0,n.useCallback)((...t)=>{const s=e??(()=>i(c,{preventScrollReset:!0}));u(!1),p.current=setTimeout(()=>{s(...t),p.current=null},300)},[c,i,e]);(0,n.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]),(0,n.useEffect)(()=>{t?p.current&&clearTimeout(p.current):u(t)},[t]);const f=(0,n.useMemo)(()=>{if(r&&s){if((0,n.isValidElement)(r))return(0,n.cloneElement)(r,{onSuccess:(...e)=>{r.props.onSuccess?.(...e),m()}});if("object"==typeof r)return{...r,onSuccess:(...e)=>{r.onSuccess?.(...e),m()}}}return r},[s,m,r]);return(0,n.jsx)(a.Drawer,{...l,form:f,onClose:m,isOpen:d})}},1458:(e,t,s)=>{s.r(t),s.d(t,{default:()=>r});var n=s(296),o=s(90),a=s(295);const c=o.Locale.getSection("components.buttons"),r=({id:e,content:t,icon:s="copy",className:o,tooltip:r=c.lmsg("copyToClipboard"),onCopy:l=()=>{},children:i})=>(0,a.jsx)(n.Button,{className:o,ghost:!0,icon:s,tooltip:r,tooltipAsLabel:!0,onClick:()=>{(0,n.copyToClipboard)(t),l()},"data-action":"copy-to-clipboard"+(e?`-${e}`:""),children:i})},1804:(e,t,s)=>{s.r(t),s.d(t,{default:()=>u});var n=s(296),o=s(667),a=s.n(o),c=s(545),r=s(1458),l=s(90),i=s(295);const d=({data:e,children:t,childrenAsButton:s=!1,component:o=n.Paragraph,id:a,...d})=>(0,i.jsxs)(o,{...d,children:[!s&&t," ",(0,i.jsx)(r.default,{id:a,content:e,onCopy:()=>(0,c.addToast)({intent:"success",message:l.Locale.getSection("components.buttons").lmsg("copied")}),children:s&&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},2645:(e,t,s)=>{s.r(t),s.d(t,{default:()=>f});var n=s(619),o=s(598),a=s(296),c=s(90),r=s(1420),l=s(1804),i=s(1182),d=s.n(i),u=s(295);const p=c.Locale.getTranslate("components.pages.Databases.ConnectionInfo"),m=c.Locale.getSection("components.pages.Databases.ConnectionInfo"),f=()=>{const e=(0,o.useParams)(),{data:{database:t}}=(0,n.useQuery)(d(),{variables:{id:btoa(`Database:${e.databaseId}`)}}),s=t.defaultUser??t.users[0];return(0,u.jsxs)(r.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,{tooltip:m.lmsg("copyHost"),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,{tooltip:m.lmsg("copyDatabaseName"),data:t.name,children:t.name})}),(0,u.jsx)(a.FormField,{label:(0,u.jsx)(p,{content:"user"}),children:s?(0,u.jsx)(l.default,{tooltip:m.lmsg("copyUser"),data:s.login,children:s.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:s?"********":""})]})}}}]);
//# sourceMappingURL=ConnectionInfo.js.map?ad5b54dca9cde7063ef8