"use strict";(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["components/pages/DatabasesPage/ConnectionInfo"],{1573(e,t,s){s.r(t),s.d(t,{default:()=>r});var o=s(379),n=s(95),a=s(378);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})},1923(e,t,s){s.r(t),s.d(t,{default:()=>u});var o=s(379),n=s(763),a=s.n(n),c=s(640),r=s(1573),l=s(95),i=s(378);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},1530(e,t,s){s.r(t),s.d(t,{default:()=>c});var o=s(378),n=s(694),a=s(379);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})}},2813(e,t,s){s.r(t),s.d(t,{default:()=>h});var o=s(715),n=s(694),a=s(379),c=s(95),r=s(1530),l=s(1923),i=s(1285),d=s.n(i),u=s(378);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?3bdd7bfaa802c0c83654