"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["components/pages/DatabasesPage/ConnectionInfo"],{1436:(e,t,s)=>{s.r(t),s.d(t,{default:()=>r});var n=s(286),o=s(89),a=s(285);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})},1772:(e,t,s)=>{s.r(t),s.d(t,{default:()=>u});var n=s(286),o=s(591),a=s.n(o),c=s(536),r=s(1436),l=s(89),i=s(285);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},1402:(e,t,s)=>{s.r(t),s.d(t,{default:()=>c});var n=s(285),o=s(575),a=s(286);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})}},2617:(e,t,s)=>{s.r(t),s.d(t,{default:()=>f});var n=s(581),o=s(575),a=s(286),c=s(89),r=s(1402),l=s(1772),i=s(1103),d=s.n(i),u=s(285);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?af9272826da1020bd832