(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/server/tools"],{880:(e,t,s)=>{"use strict";s.r(t),s.d(t,{PanelAccess:()=>b});var n=s(153),a=s(260),o=s.n(a),r=s(154),l=s(143),i=s(597),c=s(642);const m="enabled",p="disabled",u="domain",d=l.Locale.getTranslate("components.forms.panel-access"),b=({getAccessUrl:e,setAccessUrl:t,helpUrl:s,httpsPort:a})=>{const[o,b]=(0,i.default)("customize-panel-access"),[g,f]=(0,n.useState)(!0),[E,k]=(0,n.useState)(null),[y,h]=(0,n.useState)(null),[w,v]=(0,n.useState)(null),[S,P]=(0,n.useState)(null),{addToast:x}=(0,c.useToaster)();(0,n.useEffect)((()=>{o&&(f(!0),l.api.get(e).then((e=>{k({proxy:B(e),domainName:e.domainName}),f(!1)})))}),[o,e]);const B=e=>e.proxy?e.domainName?u:m:p;return(0,n.createElement)(r.Drawer,{title:(0,n.createElement)(d,{content:"title"}),size:"sm",isOpen:o,onClose:()=>b(!1),form:{values:E,vertical:!0,state:w,applyButton:!1,hideRequiredLegend:!0,submitButton:{disabled:g},onSubmit:async({proxy:e,domainName:s})=>{if(h(null),v(null),P(null),e===u&&!s)return void h({domainName:{isEmpty:(0,n.createElement)(d,{content:"domainNameIsRequired"})}});v("submit");const a=await l.api.post(t,{proxy:e!==p,domainName:e===u?s:""});if(v(null),!a||"error"!==a.status)return x({intent:"success",message:(0,n.createElement)(d,{content:"successMessage"})}),void b(!1);a.formMessages&&Object.keys(a.formMessages).forEach((e=>h({[e]:a.formMessages[e]}))),a.messages&&P(a.messages)},errors:y},"data-type":"customize-panel-access"},(0,n.createElement)(r.Paragraph,null,(0,n.createElement)(d,{content:"hint",params:{httpsPort:a,link:s?(0,n.createElement)("a",{href:s,target:"_blank",id:"linkOpenHelp",rel:"noopener noreferrer"},(0,n.createElement)(d,{content:"details"})):""}})),g?(0,n.createElement)(r.ContentLoader,null):(0,n.createElement)(n.Fragment,null,S?(0,n.createElement)(n.Fragment,null,S.map((e=>(0,n.createElement)(r.StatusMessage,{intent:"danger",key:e},e)))):null,(0,n.createElement)(r.FormFieldRadioButtons,{name:"proxy",options:[{value:m,label:(0,n.createElement)(d,{content:"proxyEnabled"})},{value:u,label:(0,n.createElement)(d,{content:"proxyDomain"}),indentFields:[(0,n.createElement)(r.FormFieldText,{key:"domainName",name:"domainName",placeholder:"www.example.com",size:"lg"})]},{value:p,label:(0,n.createElement)(d,{content:"proxyDisabled",params:{httpsPort:a}})}]})))};b.propTypes={getAccessUrl:o().string.isRequired,setAccessUrl:o().string.isRequired,helpUrl:o().string.isRequired,httpsPort:o().string.isRequired};const g=e=>{const[t]=(0,i.default)("customize-panel-access"),[s,a]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{t&&a(!0)}),[t]),s?(0,n.createElement)(b,e):null};g.propTypes=b.propTypes,t.default=g},879:(e,t,s)=>{"use strict";s.r(t);var n=s(154),a=s(153),o=s(301),r=s(404),l=s(260),i=s.n(l),c=s(143),m=s(446),p=s(582),u=s(608),d=s(880);const b=[{name:"securityButtons",id:"securityPanel",icon:s(881)},{name:"troubleshootingButtons",id:"troubleshootingPanel",icon:s(882)},{name:"serviceInstallationsButtons",id:"servicesPanel",icon:s(883)},{name:"toolsAndResourcesButtons",id:"resourcesPanel",icon:s(883)},{name:"generalButtons",id:"generalPanel",icon:s(884)},{name:"serverManagementButtons",id:"serverManagementPanel",icon:s(885)},{name:"statisticsButtons",id:"statisticsPanel",icon:s(886)},{name:"mailButtons",id:"mailPanel",icon:s(887)},{name:"applicationsAndDatabasesButtons",id:"applicationsAndDatabasesPanel",icon:s(888)},{name:"panelButtons",id:"panelPanel",icon:s(889)},{name:"uiButtons",id:"uiPanel",icon:s(890)},{name:"myPleskButtons",id:"myPleskPanel",icon:s(891)},{name:"customButtons",id:"customButtons",title:"additionalServices",icon:s(769)}],g=o.gql`
    mutation RebootServer {
        rebootServer
    }
`,f=o.gql`
    mutation ShutdownServer {
        shutdownServer
    }
`,E="admin-server-tools",k=c.Locale.getTranslate("admin.controllers.server.tools"),y=e=>{const{sections:t,panelAccess:s}=e,[o]=(0,r.useMutation)(g,{errorPolicy:"all"}),[l]=(0,r.useMutation)(f,{errorPolicy:"all"}),i={rebootServer(){const e=c.Locale.getSection("admin.controllers.server.tools"),t=c.Locale.getSection("components.buttons");c.messageBox.show({type:c.messageBox.TYPE_YESNO,subtype:"reboot",text:e.lmsg("buttonServerRebootConfirmationTitle"),description:e.lmsg("buttonServerRebootConfirmationDescription"),async onYesClick(){(0,c.clearStatusMessages)();try{const{errors:e}=await o();(e||[]).forEach((({message:e})=>(0,c.addStatusMessage)("warning",e)))}catch(e){}},buttonTitles:{yes:t.lmsg("yes"),no:t.lmsg("no")}})},shutdownServer(){const e=c.Locale.getSection("admin.controllers.server.tools"),t=c.Locale.getSection("components.buttons");c.messageBox.show({type:c.messageBox.TYPE_YESNO,subtype:"shutdown",text:e.lmsg("buttonShutdownConfirmationTitle"),description:e.lmsg("buttonShutdownConfirmationDescription"),async onYesClick(){(0,c.clearStatusMessages)();try{const{errors:e}=await l();(e||[]).forEach((({message:e})=>(0,c.addStatusMessage)("warning",e)))}catch(e){}},buttonTitles:{yes:t.lmsg("yes"),no:t.lmsg("no")}})},"AdminPanel.ServerTools.showReporterPopup"({props:{supportUrl:e}}){new c.ReporterPopup({supportUrl:e,cls:"popup-panel",locale:c.Locale.getSection("components.issue-reporter")})}},u=t=>i[t]?s=>{s.preventDefault(),i[t]({props:e})}:null,y="true"===m.default.get("debug-testing-mode");return(0,a.createElement)("div",{"data-id":"tools-list"},(0,a.createElement)(n.Paragraph,null,(0,a.createElement)(k,{content:"pageHint"})),(0,a.createElement)(n.Grid,{minColumnWidth:y?0:150,maxColumnsNumber:({width:e})=>e>1800?5:e>1100?4:e>600?3:2,sm:y?3:null,className:`${E}__sections`,gap:"md"},b.filter((({name:e})=>t[e])).map((({name:e,id:s,icon:o,title:r})=>(0,a.createElement)(n.GridCol,{key:s},(0,a.createElement)(n.Item,{id:s,icon:(0,a.createElement)(n.Icon,{src:o,size:"32"}),title:(0,a.createElement)("span",{className:`${E}__section-title`},(0,a.createElement)(k,{content:r||s}))},(0,a.createElement)("ul",{className:`${E}__section-content`,id:`${s}-tools-list`,"data-type":"tools-section-content"},t[e].map((({id:e,description:t,href:s,target:o,title:r,handler:l,attention:i})=>{const c=(0,a.createElement)(p.default,{to:s,target:o,onClick:u(l)},i?(0,a.createElement)("span",{className:"hint-attention"},r):r);return(0,a.createElement)("li",{key:e,id:e,className:`${E}__section-item`},t?(0,a.createElement)(n.Tooltip,{title:t},c):c)})))))))),(0,a.createElement)(d.default,s))};y.propTypes={sections:i().object.isRequired,panelAccess:i().object.isRequired},t.default=(0,u.withPageLayout)(y)},878:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>n.default});var n=s(879)},888:e=>{e.exports=Jsw.skinUrl+"/icons/32/plesk/applications-and-databases.png?31b2124ea5175fb574f77cc3c43d9216"},890:e=>{e.exports=Jsw.skinUrl+"/icons/32/plesk/branding.png?bb7cecce78a80689f82c7572493996fb"},769:e=>{e.exports=Jsw.skinUrl+"/icons/32/plesk/custom-buttons.png?7cf218aebaf85599ee9d8db8e1a3ee91"},891:e=>{e.exports=Jsw.skinUrl+"/icons/32/plesk/external-services.png?6b1ed2ce8b6bbdd13558424ab047b5af"},887:e=>{e.exports=Jsw.skinUrl+"/icons/32/plesk/mail.png?a8efbdef83b8bf575d0b6b9e48a161dd"},883:e=>{e.exports=Jsw.skinUrl+"/icons/32/plesk/manage.png?9fce3fccefdab269fb4a897f91509b5d"},889:e=>{e.exports=Jsw.skinUrl+"/icons/32/plesk/panel.png?d1ffcf89a8b0751810a10dcbba2f454a"},884:e=>{e.exports=Jsw.skinUrl+"/icons/32/plesk/preferences.png?3e21b876f5b895bcb4c400b77821ca53"},881:e=>{e.exports=Jsw.skinUrl+"/icons/32/plesk/protect.png?f3de9d854c205798732f51dfc82cbdf7"},885:e=>{e.exports=Jsw.skinUrl+"/icons/32/plesk/server.png?972b6d4fd5488c8de0c79459dfbdd65e"},886:e=>{e.exports=Jsw.skinUrl+"/icons/32/plesk/statistics.png?ec7232887a24c97fc209fdb24b00140c"},882:e=>{e.exports=Jsw.skinUrl+"/icons/32/plesk/support.png?9dfb7944b29c37c37efd99bb822079a9"}}]);
//# sourceMappingURL=tools.js.map?f20464d0603313e4ec8e