(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/server/db"],{1701:(e,t,s)=>{"use strict";s.r(t),s.d(t,{SORT_ASC:()=>c,SORT_DESC:()=>p,default:()=>x});var a=s(239),r=s(241),n=s.n(r),o=s(240),i=s(90);const l=i.Locale.getTranslate("components.list"),d=i.Locale.getSection("components.list"),c="ASC",p="DESC",m="all",u={set(e,t){localStorage.setItem(e,JSON.stringify(t))},get(e){const t=localStorage.getItem(e);return JSON.parse(t)}},b=e=>`list-sort_${e}`,g=e=>`list-page_${e}`,h=({id:e,data:t,columns:s,itemsPerPage:r,itemsPerPageOptions:n,sortColumn:i,sortDirection:p,searchField:h,locale:x,emptyView:v,emptyFilteredView:j,toolbar:S,selection:y,onSelectionChange:w,searchBarInputProps:f,rowKey:P,...T})=>{const{sortColumn:D,sortDirection:C,setSortState:k}=((e,{sortColumn:t,sortDirection:s})=>{const[{sortColumn:r,sortDirection:n},o]=(0,a.useState)({sortColumn:u.get(b(e))?.sortColumn??t,sortDirection:u.get(b(e))?.sortDirection??s});return{sortColumn:r,sortDirection:n,setSortState:t=>{o((e=>({...e,...t}))),u.set(b(e),{...u.get(b(e)),...t})}}})(e,{sortColumn:i??s.find((({sortable:e})=>e))?.key,sortDirection:p}),{page:L,itemsPerPage:R,searchPattern:F,setPageState:I}=((e,{itemsPerPage:t})=>{const[{page:s,itemsPerPage:r,searchPattern:n},o]=(0,a.useState)({page:u.get(g(e))?.page??1,itemsPerPage:u.get(g(e))?.itemsPerPage??t,searchPattern:u.get(g(e))?.searchPattern??""});return{page:s,itemsPerPage:r,searchPattern:n,setPageState:t=>{o((e=>({...e,...t}))),u.set(g(e),{...u.get(g(e)),...t})}}})(e,{itemsPerPage:n.includes(r)?r:n[0]}),q=(0,a.useMemo)((()=>F?j??(0,a.jsx)(o.ListEmptyView,{reason:"filtered",title:(0,a.jsx)(l,{content:"emptyViewFilteredTitle"}),description:(0,a.jsx)(l,{content:"emptyViewFilteredDescription"})}):v??(0,a.jsx)(o.ListEmptyView,{title:(0,a.jsx)(l,{content:"emptyViewTitle"})})),[F,v,j]),M=(0,a.useMemo)((()=>h?t.filter((e=>(Array.isArray(h)?h:[h]).some((t=>e[t]&&String(e[t]).toLowerCase().includes(F.toLowerCase()))))):t),[t,F,h]),U=(0,a.useMemo)((()=>{if(!D)return M;const e=s.find((({key:e})=>e===D))?.sortDataField??D,t=s.find((({key:e})=>e===D))?.sort??((t,s)=>t[e]<s[e]?-1:t[e]>s[e]?1:0);return[...M].sort(((e,s)=>c===C?t(e,s):t(s,e)))}),[M,D,C,s]),$=(0,a.useMemo)((()=>{if(R===m)return U;const e=R*(L-1),t=e+R;return U.slice(e,t)}),[L,U,R]),B=(0,a.useCallback)((e=>{I({searchPattern:e}),e!==F&&I({page:1})}),[F]),E=(0,a.useCallback)((e=>{I({itemsPerPage:e});(e===m?1:Math.ceil(M.length/e))<L&&I({page:1})}),[M.length,L]);return(0,a.useEffect)((()=>{if("function"==typeof w&&y.length){const e=M.map((e=>{return t=e,"function"==typeof(s=P)?s(t):t[s];var t,s})).filter((e=>y.includes(e)));w(e)}}),[M]),(0,a.jsx)(o.List,{pagination:(0,a.jsx)(o.Pagination,{current:L,total:R===m?1:Math.ceil(M.length/R),onSelect:e=>I({page:e}),itemsPerPage:R,itemsPerPageOptions:n,onItemsPerPageChange:E}),toolbar:(S||h)&&(0,a.jsxs)(o.Toolbar,{children:[S,h&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.ToolbarExpander,{}),(0,a.jsx)(o.ToolbarGroup,{title:"",children:(0,a.jsx)(o.SearchBar,{inputProps:{placeholder:d.lmsg("searchPlaceholder"),"data-testid":"list-searchbar",value:F,...f??{}},onTyping:B})})]})]}),totalRows:M.length,sortColumn:D,sortDirection:C,onSortChange:k,columns:s,data:$,filtered:!!F,locale:{totalRows:({totalRows:e})=>d.formatMessage("recordsTotal",{total:e}),...x},emptyView:q,onSelectionChange:w,selection:y,rowKey:P,...T})};h.propTypes={id:n().string.isRequired,data:n().array.isRequired,columns:n().array.isRequired,itemsPerPage:n().number,itemsPerPageOptions:n().array,sortColumn:n().string,sortDirection:n().string,searchField:n().oneOfType([n().string,n().arrayOf(n().string.isRequired)]),locale:n().object,emptyView:n().node,emptyFilteredView:n().node,toolbar:n().node,onSelectionChange:n().func,selection:n().array,rowKey:n().oneOfType([n().string,n().func]),searchBarInputProps:n().object},h.defaultProps={itemsPerPage:25,itemsPerPageOptions:[10,25,100,m],sortColumn:void 0,sortDirection:c,searchField:void 0,locale:{},emptyView:void 0,emptyFilteredView:void 0,toolbar:void 0,onSelectionChange:void 0,selection:[],searchBarInputProps:void 0,rowKey:"key"};const x=h},1793:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>y});var a=s(239),r=s(241),n=s.n(r),o=s(732),i=s(444),l=s(762),d=s(240),c=s(90),p=s(737),m=s(873),u=s(775);const b=c.Locale.getTranslate("components.forms.database-server-create"),g=c.Locale.getSection("components.lists.databaseservers"),h=c.Locale.getTranslate("components.buttons"),x="MSSQL",v=i.gql`
    mutation UpdateDatabaseServer($input: UpdateDatabaseServerInput!) {
        updateDatabaseServer(input: $input) {
            error
            databaseServer {
                id
            }
        }
    }
`,j=e=>"MYSQL"===e?["mysql","mariadb","percona"].map((e=>g.lmsg(e.toLowerCase()))).join(" / "):g.lmsg(e.toLowerCase()),S=({databaseServer:e,allowedTypes:t,isWindows:r})=>{const n=(0,o.useNavigate)(),[i,c]=(0,a.useState)(e?{id:e.id,type:e.type,host:e.host,port:String(e.port),default:e.isDefaultServer,adminLogin:e.adminLogin,adminPassword:"",externalConnections:e.externalConnections,backupTempDir:e.backupSettings?.tempDir,backupNetworkTempDir:e.backupSettings?.networkTempDir,backupNetworkUser:e.backupSettings?.networkUser,backupNetworkPassword:e.backupSettings?.networkPassword}:{id:null,type:t[0],host:"",port:"",default:!1,adminLogin:"",adminPassword:""}),S=(0,a.useCallback)((({updateDatabaseServer:{error:t}})=>{(0,p.addToast)({intent:t?"warning":"success",message:e?t?(0,a.jsx)(b,{content:"updateError",params:{error:t}}):(0,a.jsx)(b,{content:"updateSuccess"}):t?(0,a.jsx)(b,{content:"createError",params:{error:t}}):(0,a.jsx)(b,{content:"createSuccess"})}),n("/cp/server/db/")}),[e,n]),[y]=(0,l.useMutation)(v,{refetchQueries:[{query:s(841)},e?{query:s(843),variables:{id:e.id}}:null].filter(Boolean),awaitRefetchQueries:!0});return(0,a.jsxs)(m.default,{values:i,mutation:y,onSuccess:S,onFieldChange:(e,t)=>{c((s=>s=(0,d.setIn)(s,e,t)))},submitButton:{id:"btn-send",children:(0,a.jsx)(h,{content:"ok"})},applyButton:!1,cancelButton:{id:"btn-cancel",children:(0,a.jsx)(h,{content:"cancel"}),component:u.default,to:"/cp/server/db/"},children:[(0,a.jsxs)(d.Section,{title:(0,a.jsx)(b,{content:"general"}),children:[e?(0,a.jsx)(d.SectionItem,{title:(0,a.jsx)(b,{content:"type"}),children:j(e.type)}):(0,a.jsx)(d.FormFieldSelect,{name:"type",label:(0,a.jsx)(b,{content:"type"}),children:t.map((e=>(0,a.jsx)(d.SelectOption,{value:e,children:j(e)},e)))}),e&&"localhost"===e.host&&!r?(0,a.jsx)(d.SectionItem,{title:(0,a.jsx)(b,{content:"host"}),children:e.host}):(0,a.jsx)(d.FormFieldText,{name:"host",label:(0,a.jsx)(b,{content:"host"}),required:!0}),e&&"localhost"===e.host&&!r?(0,a.jsx)(d.SectionItem,{title:(0,a.jsx)(b,{content:"port"}),children:(0,a.jsx)(b,{content:"unixSocket"})}):i.type===x?null:(0,a.jsx)(d.FormFieldText,{name:"port",label:(0,a.jsx)(b,{content:"port"}),description:(0,a.jsx)(b,{content:"portDescription"}),size:"sm"}),e?(0,a.jsx)(d.SectionItem,{title:(0,a.jsx)(b,{content:"version"}),children:e.serverVersion}):null,(0,a.jsx)(d.FormFieldCheckbox,{name:"default",label:(0,a.jsx)(b,{content:"default",params:{type:g.lmsg(i.type.toLowerCase())}}),disabled:e&&e.isDefaultServer}),e&&null!==e.externalConnections?(0,a.jsx)(d.FormFieldCheckbox,{name:"externalConnections",label:(0,a.jsx)(b,{content:"externalConnections"}),description:(0,a.jsx)(b,{content:"externalConnectionsDescription"})}):null]}),(0,a.jsxs)(d.Section,{title:(0,a.jsx)(b,{content:"authentication"}),children:[e?e.isUsedForPsaDb?null:e.isAdminCredentialsChangeable?(0,a.jsx)(d.Paragraph,{children:(0,a.jsx)(b,{content:"authenticationChangeDescription"})}):(0,a.jsx)(d.Paragraph,{children:(0,a.jsx)(b,{content:"authenticationEditDescription"})}):(0,a.jsx)(d.Paragraph,{children:(0,a.jsx)(b,{content:"authenticationAddDescription"})}),e&&e.isUsedForPsaDb?(0,a.jsx)(d.SectionItem,{title:(0,a.jsx)(b,{content:"adminLogin"}),children:e.adminLogin}):(0,a.jsx)(d.FormFieldText,{name:"adminLogin",label:(0,a.jsx)(b,{content:"adminLogin"}),required:!0}),e&&e.isUsedForPsaDb?null:(0,a.jsx)(d.FormFieldPassword,{name:"adminPassword",label:(0,a.jsx)(b,{content:"adminPassword"}),required:!0,hideGenerateButton:!0,hidePasswordMeter:!0})]}),e&&null!==e.backupSettings?(0,a.jsxs)(d.Section,{title:(0,a.jsx)(b,{content:"backupSettings"}),children:[(0,a.jsx)(d.FormFieldText,{name:"backupTempDir",label:(0,a.jsx)(b,{content:"backupTempDir"}),description:(0,a.jsx)(b,{content:"backupTempDirDescription"})}),(0,a.jsx)(d.FormFieldText,{name:"backupNetworkTempDir",label:(0,a.jsx)(b,{content:"backupNetworkTempDir"}),description:(0,a.jsx)(b,{content:"backupNetworkTempDirDescription"})}),(0,a.jsx)(d.FormFieldText,{name:"backupNetworkUser",label:(0,a.jsx)(b,{content:"backupNetworkUser"}),description:(0,a.jsx)(b,{content:"backupNetworkUserDescription"})}),(0,a.jsx)(d.FormFieldPassword,{name:"backupNetworkPassword",label:(0,a.jsx)(b,{content:"backupNetworkPassword"}),hideGenerateButton:!0,hidePasswordMeter:!0})]}):null]})};S.propTypes={databaseServer:n().object,allowedTypes:n().array,isWindows:n().bool},S.defaultProps={databaseServer:void 0,allowedTypes:["MYSQL","POSTGRESQL",x],isWindows:!1};const y=S},1797:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>v});var a=s(239),r=s(241),n=s(444),o=s(762),i=s(240),l=s(90),d=s(1764),c=s(737),p=s(775),m=s(1701);const u=l.Locale.getTranslate("components.lists.databaseserverdatabases"),b=l.Locale.getSection("components.lists.databaseserverdatabases"),g=l.Locale.getTranslate("components.buttons"),h=n.gql`
    mutation DeleteDatabase($ids: [ID!]!) {
        deleteDatabase(input: { ids: $ids }) {
            ids
        }
    }
`,x=({isClassicPanel:e,serverId:t,data:r})=>{const[n]=(0,o.useMutation)(h),[l,x]=(0,a.useState)(r),[v,j]=(0,a.useState)([]),[S,y]=(0,a.useState)([]),w=(0,a.useMemo)((()=>l.filter((({id:e})=>v.includes(e)))),[l,v]);return(0,a.jsx)(m.default,{id:"database-server-databases-list",toolbar:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.ToolbarGroup,{title:b.lmsg("actionsGroup"),children:(0,a.jsx)(i.ListOperation,{noSelectionText:(0,a.jsx)(u,{content:"emptySelection"}),children:(0,a.jsx)(i.Button,{"data-id":"assignToSubscription",onClick:async()=>{new(await Plesk.require("app/database/assign-to-subscription"))({ids:v.map(d.getId)})},tooltip:(0,a.jsx)(u,{content:"assignToSubscriptionDescription"}),children:(0,a.jsx)(u,{content:"assignToSubscription"})})})}),(0,a.jsx)(i.ToolbarGroup,{title:b.lmsg("removeGroup"),children:(0,a.jsx)(i.ListOperation,{critical:!0,noSelectionText:(0,a.jsx)(u,{content:"emptySelection"}),confirmationText:b.formatMessage("removeConfirmation",{name:(0,a.jsx)("b",{children:w[0]?.name}),count:w.length}),actionButtonText:(0,a.jsx)(g,{content:"yesRemove"}),cancelButtonText:(0,a.jsx)(g,{content:"cancel"}),children:(0,a.jsx)(i.Button,{"data-id":"remove",onClick:async()=>{y(v);try{const{data:{deleteDatabase:{ids:e}}}=await n({variables:{ids:v},refetchQueries:[{query:s(844),variables:{id:t}}],awaitRefetchQueries:!0});e.length>0&&((0,c.addToast)({intent:"success",message:(0,a.jsx)(u,{content:"removeSuccess"})}),x(l.filter((({id:t})=>!e.includes(t)))))}catch({graphQLErrors:e}){e.forEach((({message:e,debugMessage:t})=>{(0,c.addToast)({intent:"danger",message:t||e})}))}finally{j([]),y([])}},tooltip:(0,a.jsx)(u,{content:"removeDescription"}),children:(0,a.jsx)(u,{content:"remove"})})})})]}),columns:[{key:"name",title:(0,a.jsx)(u,{content:"name"}),sortable:!0,type:"title",width:"40%"},{key:"domain",title:(0,a.jsx)(u,{content:"subscription"}),sortable:!0,width:"20%"},{key:"client",title:(0,a.jsx)(u,{content:"client"}),sortable:!0,width:"20%"},{key:"controlPanel",width:"20%",render:({domainId:t,clientId:r,clientType:n})=>{let o=`/smb/database/list/domainId/${encodeURIComponent((0,d.getId)(t))}`,l=(0,a.jsx)(u,{content:"manageDatabase"}),c=(0,a.jsx)(u,{content:"manageDatabaseDescription"});return e||"ADMIN"===n?o=`/admin/subscription/login/id/${encodeURIComponent((0,d.getId)(t))}?pageUrl=${encodeURIComponent(o)}`:"RESELLER"===n?(o=`/admin/reseller/login/id/${encodeURIComponent((0,d.getId)(r))}?pageUrl=${encodeURIComponent(o)}`,l=(0,a.jsx)(u,{content:"manageDatabaseInResellerPanel"}),c=(0,a.jsx)(u,{content:"manageDatabaseInResellerPanelDescription"})):"CLIENT"===n&&(o=`/admin/customer/login/id/${encodeURIComponent((0,d.getId)(r))}?pageUrl=${encodeURIComponent(o)}`,l=(0,a.jsx)(u,{content:"manageDatabaseInCustomerPanel"}),c=(0,a.jsx)(u,{content:"manageDatabaseInCustomerPanelDescription"})),(0,a.jsx)(i.Tooltip,{title:c,children:(0,a.jsx)(i.Action,{component:p.default,to:o,icon:{src:s(1072)},children:l})})}}],rowKey:"id",data:l,searchField:"name",sortColumn:"name",selection:v,onSelectionChange:e=>j(e),loadingRows:S})};x.propTypes={isClassicPanel:r.PropTypes.bool.isRequired,serverId:r.PropTypes.string.isRequired,data:r.PropTypes.array.isRequired};const v=x},1790:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>j});var a=s(239),r=s(241),n=s(444),o=s(762),i=s(240),l=s(90),d=s(737),c=s(1764),p=s(775),m=s(1701);const u=l.Locale.getTranslate("components.lists.databaseservers"),b=l.Locale.getSection("components.lists.databaseservers"),g=l.Locale.getTranslate("components.status"),h=l.Locale.getTranslate("components.buttons"),x=n.gql`
    mutation DeleteDatabaseServer($ids: [ID!]!) {
        deleteDatabaseServer(input: { ids: $ids }) {
            ids
        }
    }
`,v=({data:e,isDemo:t,createDatabaseServerAllowed:r})=>{const[n]=(0,o.useMutation)(x),[l,v]=(0,a.useState)(e),[j,S]=(0,a.useState)([]),[y,w]=(0,a.useState)([]),f=(0,a.useMemo)((()=>l.filter((({id:e})=>j.includes(e)))),[l,j]),P=(0,a.useMemo)((()=>l.filter((({isLocal:e,isDynamicPort:t})=>e&&t)).map((({host:e})=>(0,a.jsxs)(i.StatusMessage,{intent:"warning",children:[(0,a.jsxs)("b",{children:[(0,a.jsx)(g,{content:"warning"}),": "]}),(0,a.jsx)(u,{content:"mssqlServerPortUndefined",params:{host:e}}),(0,a.jsx)("br",{}),(0,a.jsx)(u,{content:"mssqlServerPortUndefinedHint"})]},e)))),[l]);return(0,a.jsxs)(a.Fragment,{children:[P,(0,a.jsx)(m.default,{id:"database-servers-list",toolbar:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.ToolbarGroup,{title:b.lmsg("addGroup"),children:(0,a.jsx)(i.Button,{"data-id":"addDatabaseServer",intent:"primary",icon:"plus",component:p.default,to:"/cp/server/db/create",disabled:!r,tooltip:r?(0,a.jsx)(u,{content:"addDatabaseServerDescription"}):(0,a.jsx)(u,{content:"addDatabaseServerDescriptionDisabledByKey"}),children:(0,a.jsx)(u,{content:"addDatabaseServer"})})}),(0,a.jsxs)(i.ToolbarGroup,{title:b.lmsg("actionsGroup"),children:[(0,a.jsx)(i.Button,{"data-id":"hostingSettings",component:p.default,to:"/admin/database/settings",tooltip:(0,a.jsx)(u,{content:"hostingSettingsDescription"}),children:(0,a.jsx)(u,{content:"hostingSettings"})}),(0,a.jsx)(i.Button,{"data-id":"refresh",component:"a",href:"/admin/database/refresh",tooltip:(0,a.jsx)(u,{content:"refreshDescription"}),children:(0,a.jsx)(u,{content:"refresh"})})]}),(0,a.jsx)(i.ToolbarGroup,{title:b.lmsg("removeGroup"),children:(0,a.jsx)(i.ListOperation,{critical:!0,noSelectionText:(0,a.jsx)(u,{content:"removeEmptySelection"}),confirmationText:b.formatMessage("removeConfirmation",{name:(0,a.jsx)("b",{children:f[0]?.name}),count:f.length}),actionButtonText:(0,a.jsx)(h,{content:"yesRemove"}),cancelButtonText:(0,a.jsx)(h,{content:"cancel"}),children:(0,a.jsx)(i.Button,{"data-id":"remove",onClick:async()=>{w(j);try{const{data:{deleteDatabaseServer:{ids:e}}}=await n({variables:{ids:j},refetchQueries:[{query:s(841)}],awaitRefetchQueries:!0});e.length>0&&((0,d.addToast)({intent:"success",message:(0,a.jsx)(u,{content:"removeSuccess"})}),v(l.filter((({id:t})=>!e.includes(t)))))}catch({graphQLErrors:e}){e.forEach((({message:e,debugMessage:t})=>{(0,d.addToast)({intent:"danger",message:t||e})}))}finally{S([]),w([])}},tooltip:(0,a.jsx)(u,{content:"removeDescription"}),children:(0,a.jsx)(u,{content:"remove"})})})})]}),columns:[{key:"lastError",title:(0,a.jsx)(u,{content:"lastError"}),sortable:!0,render:({id:e,lastError:t})=>(0,a.jsx)(i.Tooltip,{title:(0,a.jsx)(u,{content:`status_${t.toLowerCase()}`}),children:(0,a.jsx)(p.default,{to:`/cp/server/db/${encodeURIComponent((0,c.getId)(e))}/properties`,children:(0,a.jsx)(i.Icon,{src:s("NO_ERROR"===t?1791:1019)})})})},{key:"type",title:(0,a.jsx)(u,{content:"type"}),width:"20%",sortable:!0,render:({type:e,fork:t})=>{const r=(t||e).toLowerCase(),n={mysql:s(1678),mssql:s(1681),postgresql:s(1682),mariadb:s(1679),percona:s(1680)}[r];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Icon,{src:n})," ",(0,a.jsx)(u,{content:r})]})}},{key:"host",title:(0,a.jsx)(u,{content:"host"}),type:"title",width:"50%",sortable:!0,render:({id:e,type:t,fork:s,host:r,isDefaultServer:n})=>{const o=(s||t).toLowerCase();return(0,a.jsxs)(i.Text,{bold:n,children:[(0,a.jsx)(i.Tooltip,{title:(0,a.jsx)(u,{content:"hostLink"}),children:(0,a.jsx)(p.default,{to:`/cp/server/db/${encodeURIComponent((0,c.getId)(e))}/properties`,children:r})}),n?(0,a.jsxs)(a.Fragment,{children:[" ","(",(0,a.jsx)(u,{content:`default_for_${o}`}),")"]}):null]})}},{key:"port",title:(0,a.jsx)(u,{content:"port"}),width:"10%",align:"right",sortable:!0},{key:"serverVersion",title:(0,a.jsx)(u,{content:"version"}),width:"10%",align:"right",sortable:!0},{key:"databasesCount",title:(0,a.jsx)(u,{content:"databasesCount"}),width:"10%",align:"right",sortable:!0,render:({id:e,databasesCount:t})=>(0,a.jsx)(i.Tooltip,{title:(0,a.jsx)(u,{content:"databasesCountLink"}),children:(0,a.jsx)(p.default,{to:`/cp/server/db/${encodeURIComponent((0,c.getId)(e))}/databases`,children:t})})},{key:"webadmin",type:"actions",render:({id:e,isWebadminInstalled:s,type:r,lastError:n})=>(0,a.jsx)(i.ListActions,{children:(0,a.jsx)(i.ListAction,{primary:!0,icon:{MYSQL:"phpmyadmin",MSSQL:"my-little-admin"}[r],hidden:!s,component:"a",href:`/cp/server/db/${encodeURIComponent((0,c.getId)(e))}/webadmin`,target:"_blank",disabled:t||"NO_ERROR"!==n,tooltip:(0,a.jsx)(u,{content:"webadminHint"}),children:(0,a.jsx)(u,{content:"webadmin"})})})}],rowKey:"id",data:l,searchField:"host",sortColumn:"host",selection:j,onSelectionChange:e=>S(e),loadingRows:y})]})};v.propTypes={data:r.PropTypes.array.isRequired,isDemo:r.PropTypes.bool,createDatabaseServerAllowed:r.PropTypes.bool},v.defaultProps={isDemo:!1,createDatabaseServerAllowed:!0};const j=v},1798:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>S});var a=s(239),r=s(241),n=s(732),o=s(444),i=s(762),l=s(240),d=s(90),c=s(285),p=s(737),m=s(873),u=s(775),b=s(745),g=s(1795);const h=d.Locale.getTranslate("components.forms.database-server-change-password"),x=d.Locale.getTranslate("components.buttons"),v=o.gql`
    mutation ChangeDatabaseServerPassword($input: ChangeDatabaseServerPasswordInput!) {
        changeDatabaseServerPassword(input: $input) {
            databaseServer {
                id
                lastError
            }
        }
    }
`,j=({databaseServer:e})=>{const t=(0,n.useNavigate)(),[s]=(0,i.useMutation)(v),[r]=(0,a.useState)({id:e.id,password:""});return(0,a.jsx)(m.default,{values:r,mutation:s,onSuccess:()=>{(0,p.addToast)({intent:"success",message:(0,a.jsx)(h,{content:"success"})}),t("/cp/server/db/")},submitButton:{id:"btn-send",children:(0,a.jsx)(x,{content:"save"})},applyButton:!1,cancelButton:{id:"btn-cancel",children:(0,a.jsx)(x,{content:"cancel"}),component:u.default,to:"/cp/server/db/"},children:(0,a.jsx)(l.FormFieldPassword,{name:"password",label:(0,a.jsx)(h,{content:"adminPassword"}),required:!0})})};j.propTypes={databaseServer:r.PropTypes.shape({id:r.PropTypes.string.isRequired,name:r.PropTypes.string.isRequired}).isRequired};const S=(0,b.withPageLayout)((0,g.withDatabaseServerOverviewTabs)(j),(e=>{const{showFrames:t,pageHeader:s,pageSidebar:a}=(0,c.default)();return{...e,showFrames:t,pageHeader:{...s,helpMenu:{...s.helpMenu,helpContext:"db_server_change_password"}},pageSidebar:a,pageContentHeader:{breadcrumbs:[a.isPowerUserPanel?null:{title:d.Locale.getSection("components.pages.home").lmsg("title"),href:"/admin/home/"},{title:d.Locale.getSection("admin.controllers.server.tools").lmsg("title"),href:"/admin/server/tools/"},{title:d.Locale.getSection("components.pages.database-servers").lmsg("title"),href:"/cp/server/db/"},{title:`<b>${e.databaseServer.name}</b>`,href:`/cp/server/db/${e.databaseServer.id}/`},{title:d.Locale.getSection("components.pages.database-server-change-password").lmsg("title"),href:`/cp/server/db/${e.databaseServer.id}/change-password/`}].filter(Boolean),tabs:[],tabsHasRootPage:!0}}}))},1792:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>p});var a=s(241),r=s.n(a),n=s(90),o=s(285),i=s(745),l=s(1793),d=s(239);const c=({server:{allowedByKeyDatabaseServerTypes:e}})=>(0,d.jsx)(l.default,{allowedTypes:e});c.propTypes={server:r().shape({allowedByKeyDatabaseServerTypes:r().array.isRequired}).isRequired};const p=(0,i.withPageLayout)(c,(e=>{const{showFrames:t,pageHeader:s,pageSidebar:a}=(0,o.default)(),r=n.Locale.getSection("components.pages.database-server-create").lmsg("title");return{...e,showFrames:t,pageHeader:{...s,helpMenu:{...s.helpMenu,helpContext:"db_server_edit"}},pageSidebar:a,pageContentHeader:{pageTitle:r,breadcrumbs:[a.isPowerUserPanel?null:{title:n.Locale.getSection("components.pages.home").lmsg("title"),href:"/admin/home/"},{title:n.Locale.getSection("admin.controllers.server.tools").lmsg("title"),href:"/admin/server/tools/"},{title:n.Locale.getSection("components.pages.database-servers").lmsg("title"),href:"/cp/server/db/"},{title:r,href:"/cp/server/db/create/"}].filter(Boolean)}}}))},1796:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>p});var a=s(239),r=s(241),n=s(90),o=s(285),i=s(745),l=s(1797),d=s(1795);const c=({databaseServer:{id:e,databases:t},mode:{isClassicPanel:s}})=>{const r=(0,a.useMemo)((()=>t.map((e=>({id:e.id,name:e.name,domain:e.domain.name,domainId:e.domain.id,client:e.domain.owner.name,clientId:e.domain.owner.id,clientType:e.domain.owner.type})))),[t]);return(0,a.jsx)(l.default,{isClassicPanel:s,serverId:e,data:r})};c.propTypes={mode:r.PropTypes.shape({isClassicPanel:r.PropTypes.bool.isRequired}).isRequired,databaseServer:r.PropTypes.shape({id:r.PropTypes.string.isRequired,name:r.PropTypes.string.isRequired,databases:r.PropTypes.array.isRequired}).isRequired};const p=(0,i.withPageLayout)((0,d.withDatabaseServerOverviewTabs)(c),(e=>{const{showFrames:t,pageHeader:s,pageSidebar:a}=(0,o.default)();return{...e,showFrames:t,pageHeader:{...s,helpMenu:{...s.helpMenu,helpContext:"db_server_databases"}},pageSidebar:a,pageContentHeader:{breadcrumbs:[a.isPowerUserPanel?null:{title:n.Locale.getSection("components.pages.home").lmsg("title"),href:"/admin/home/"},{title:n.Locale.getSection("admin.controllers.server.tools").lmsg("title"),href:"/admin/server/tools/"},{title:n.Locale.getSection("components.pages.database-servers").lmsg("title"),href:"/cp/server/db/"},{title:`<b>${e.databaseServer.name}</b>`,href:`/cp/server/db/${e.databaseServer.id}/`},{title:n.Locale.getSection("components.pages.database-server-databases").lmsg("title"),href:`/cp/server/db/${e.databaseServer.id}/databases/`}].filter(Boolean),tabs:[],tabsHasRootPage:!0}}}))},1794:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>m});var a=s(241),r=s.n(a),n=s(90),o=s(285),i=s(745),l=s(1793),d=s(1795),c=s(239);const p=({databaseServer:e,os:{isWindows:t}})=>(0,c.jsx)(l.default,{databaseServer:e,isWindows:t});p.propTypes={databaseServer:r().object.isRequired,os:r().shape({isWindows:r().bool.isRequired}).isRequired};const m=(0,i.withPageLayout)((0,d.withDatabaseServerOverviewTabs)(p),(e=>{const{showFrames:t,pageHeader:s,pageSidebar:a}=(0,o.default)();return{...e,showFrames:t,pageHeader:{...s,helpMenu:{...s.helpMenu,helpContext:"db_server_edit"}},pageSidebar:a,pageContentHeader:{breadcrumbs:[a.isPowerUserPanel?null:{title:n.Locale.getSection("components.pages.home").lmsg("title"),href:"/admin/home/"},{title:n.Locale.getSection("admin.controllers.server.tools").lmsg("title"),href:"/admin/server/tools/"},{title:n.Locale.getSection("components.pages.database-servers").lmsg("title"),href:"/cp/server/db/"},{title:`<b>${e.databaseServer.name}</b>`,href:`/cp/server/db/${e.databaseServer.id}/`},{title:n.Locale.getSection("components.pages.database-server-properties").lmsg("title"),href:`/cp/server/db/${e.databaseServer.id}/properties/`}].filter(Boolean),tabs:[],tabsHasRootPage:!0}}}))},1789:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>c});var a=s(239),r=s(241),n=s(90),o=s(285),i=s(745),l=s(1790);const d=({databaseServers:e,os:{isWindows:t},mode:{isDemo:s},primaryKey:{keyRemoteDb:r}})=>{const n=(0,a.useMemo)((()=>{const t=e.reduce(((e,t)=>({...e,[t.type]:(e[t.type]||0)+1})),{});return e.map((({isUsedForPsaDb:e,...s})=>({...s,disabled:e||s.isDefaultServer&&t[s.type]>1})))}),[e]);return(0,a.jsx)(l.default,{data:n,isDemo:s,isWindows:t,createDatabaseServerAllowed:t||r})};d.propTypes={databaseServers:r.PropTypes.array.isRequired,os:r.PropTypes.object.isRequired,mode:r.PropTypes.object.isRequired,primaryKey:r.PropTypes.object.isRequired};const c=(0,i.withPageLayout)(d,(e=>{const{showFrames:t,pageHeader:s,pageSidebar:a}=(0,o.default)(),r=n.Locale.getSection("components.pages.database-servers").lmsg("title");return{...e,showFrames:t,pageHeader:{...s,helpMenu:{...s.helpMenu,helpContext:"db_servers"}},pageSidebar:a,pageContentHeader:{pageTitle:r,breadcrumbs:[a.isPowerUserPanel?null:{title:n.Locale.getSection("components.pages.home").lmsg("title"),href:"/admin/home/"},{title:n.Locale.getSection("admin.controllers.server.tools").lmsg("title"),href:"/admin/server/tools/"},{title:r,href:"/cp/server/db/"}].filter(Boolean)}}}))},1795:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>u,withDatabaseServerOverviewTabs:()=>m});var a=s(239),r=s(241),n=s(732),o=s(733),i=s(739),l=s(444),d=s(240),c=s(90);const p=({params:e,os:t})=>{const{pathname:s}=(0,n.useLocation)(),r=(0,n.useNavigate)(),{data:{databaseServer:p}={}}=(0,i.useQuery)(l.gql`
        query DatabaseServerOverviewTabs($id: ID!) {
            databaseServer: node(id: $id) {
                id
                ... on DatabaseServer {
                    databasesCount
                }
            }
        }
    `,{variables:{id:btoa(`DatabaseServer:${e.id}`)}}),m=(0,a.useMemo)((()=>[{title:c.Locale.getSection("components.pages.database-server-properties").lmsg("title"),url:`/cp/server/db/${e.id}/properties`},t.isWindows?{title:c.Locale.getSection("components.pages.database-server-change-password").lmsg("title"),url:`/cp/server/db/${e.id}/change-password`}:null,{title:c.Locale.getSection("components.pages.database-server-databases").lmsg("title"),url:`/cp/server/db/${e.id}/databases`,label:(0,a.jsx)(d.Label,{intent:"info",children:p.databasesCount})}].filter(Boolean)),[e,t,p]),u=(0,a.useMemo)((()=>m.findIndex((({url:e})=>(0,o.matchPath)(e,s)))+1),[m,s]);return(0,a.jsx)(d.Tabs,{active:u,children:m.map((({url:e,...t})=>(0,a.jsx)(d.Tab,{onActivate:()=>r(e),...t},e)))})};p.propTypes={params:r.PropTypes.shape({id:r.PropTypes.string.isRequired}).isRequired,os:r.PropTypes.shape({isWindows:r.PropTypes.bool.isRequired}).isRequired};const m=e=>{const t=t=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{...t}),(0,a.jsx)(e,{...t})]});return t.displayName=`withDatabaseServerOverviewTabs(${e.displayName||e.name||"Component"})`,t.WrappedComponent=e,t},u=p},1764:(e,t,s)=>{"use strict";s.r(t),s.d(t,{getId:()=>a});const a=e=>e?Number(atob(e).split(":")[1]):null},1072:e=>{e.exports=Jsw.skinUrl+"/icons/16/plesk/login.png?b68531bba0e522a3a35a90de80b8892a"},1679:e=>{e.exports=Jsw.skinUrl+"/icons/16/plesk/mariadb.png?7bb08a94b753b7fa7d53e994238873ab"},1681:e=>{e.exports=Jsw.skinUrl+"/icons/16/plesk/mssql.png?cef152af421a073477c90aa8001bef49"},1678:e=>{e.exports=Jsw.skinUrl+"/icons/16/plesk/mysql.png?c5c7e38a14aa2ec76ec4656a58b6dcc7"},1019:e=>{e.exports=Jsw.skinUrl+"/icons/16/plesk/off.png?84d64d1bd3267c21795505b7daa43800"},1791:e=>{e.exports=Jsw.skinUrl+"/icons/16/plesk/ok.png?402e5b49692b25d9d02326339ede77fa"},1680:e=>{e.exports=Jsw.skinUrl+"/icons/16/plesk/percona.png?c9390f7e0aaad1e448de90386ec84dd6"},1682:e=>{e.exports=Jsw.skinUrl+"/icons/16/plesk/postgresql.png?ed7a3e52b63253fa542b90e5981bdcaa"}}]);
//# sourceMappingURL=db.js.map?da0ea9627bc9b88d1686