"use strict";(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["components/pages/DatabasesPage/ConnectionInfo"],{1430:(e,t,s)=>{s.r(t),s.d(t,{default:()=>c});var o=s(296),n=s(599),a=s(297);const c=({onClose:e,isOpen:t=!0,closeOnFormSuccess:s=!0,closeUrl:c="..",form:r,...l})=>{const i=(0,n.useNavigate)(),[d,u]=(0,o.useState)(t),p=(0,o.useRef)(null),m=(0,o.useCallback)((...t)=>{const s=e??(()=>i(c,{preventScrollReset:!0}));u(!1),p.current=setTimeout(()=>{s(...t),p.current=null},300)},[c,i,e]);(0,o.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]),(0,o.useEffect)(()=>{t?p.current&&clearTimeout(p.current):u(t)},[t]);const h=(0,o.useMemo)(()=>{if(r&&s){if((0,o.isValidElement)(r))return(0,o.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,o.jsx)(a.Drawer,{...l,form:h,onClose:m,isOpen:d})}},1473:(e,t,s)=>{s.r(t),s.d(t,{default:()=>r});var o=s(297),n=s(90),a=s(296);const c=n.Locale.getSection("components.buttons"),r=({id:e,content:t,icon:s="copy",className:n,tooltip:r=c.lmsg("copyToClipboard"),onCopy:l=()=>{},children:i})=>(0,a.jsx)(o.Button,{className:n,ghost:!0,icon:s,tooltip:r,tooltipAsLabel:!0,onClick:()=>{(0,o.copyToClipboard)(t),l()},"data-action":"copy-to-clipboard"+(e?`-${e}`:""),children:i})},1820:(e,t,s)=>{s.r(t),s.d(t,{default:()=>u});var o=s(297),n=s(668),a=s.n(n),c=s(546),r=s(1473),l=s(90),i=s(296);const d=({data:e,children:t,childrenAsButton:s=!1,component:n=o.Paragraph,id:a,...d})=>(0,i.jsxs)(n,{...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},2659:(e,t,s)=>{s.r(t),s.d(t,{default:()=>h});var o=s(620),n=s(599),a=s(297),c=s(90),r=s(1430),l=s(1820),i=s(1187),d=s.n(i),u=s(296);const p=c.Locale.getTranslate("components.pages.Databases.ConnectionInfo"),m=c.Locale.getSection("components.pages.Databases.ConnectionInfo"),h=()=>{const e=(0,n.useParams)(),{data:{database:t}}=(0,o.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?c2e32981ba331efbac24