(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/server/tools"],{1688:(e,s,t)=>{"use strict";t.r(s),t.d(s,{PanelAccess:()=>g,default:()=>x});var n=t(285),o=t(591),a=t.n(o),i=t(286),r=t(89),l=t(615),c=t(536);const d="enabled",u="disabled",m="domain",p=r.Locale.getTranslate("components.forms.panel-access"),g=({getAccessUrl:e,setAccessUrl:s,helpUrl:t,httpsPort:o})=>{const[a,g]=(0,l.useModal)("customize-panel-access"),[h,x]=(0,n.useState)(!0),[b,j]=(0,n.useState)(null),[f,y]=(0,n.useState)(null),[v,S]=(0,n.useState)(null),[P,w]=(0,n.useState)(null);(0,n.useEffect)((()=>{a&&(x(!0),r.api.get(e).then((e=>{if(j({proxy:B(e),domainName:e.domainName}),"error"===e.status)throw e})).catch((({message:e})=>{(0,c.addToast)({intent:"danger",message:e}),g(!1)})).finally((()=>x(!1))))}),[a,e,g]);const B=e=>e.proxy?e.domainName?m:d:u;return(0,n.jsxs)(i.Drawer,{title:(0,n.jsx)(p,{content:"title"}),size:"sm",isOpen:a,onClose:()=>g(!1),form:{values:b,vertical:!0,state:v,applyButton:!1,hideRequiredLegend:!0,submitButton:{disabled:h},onSubmit:async({proxy:e,domainName:t})=>{if(y(null),S(null),w(null),e===m&&!t)return void y({domainName:{isEmpty:(0,n.jsx)(p,{content:"domainNameIsRequired"})}});S("submit");const o=await r.api.post(s,{proxy:e!==u,domainName:e===m?t:""});if(S(null),!o||"error"!==o.status)return(0,c.addToast)({intent:"success",message:(0,n.jsx)(p,{content:"successMessage"})}),void g(!1);o.formMessages&&Object.keys(o.formMessages).forEach((e=>y({[e]:o.formMessages[e]}))),o.messages&&w(o.messages)},errors:f},"data-type":"customize-panel-access",children:[(0,n.jsx)(i.Paragraph,{children:(0,n.jsx)(p,{content:"hint",params:{httpsPort:o,link:t?(0,n.jsx)("a",{href:t,target:"_blank",id:"linkOpenHelp",rel:"noopener noreferrer",children:(0,n.jsx)(p,{content:"details"})}):""}})}),h?(0,n.jsx)(i.ContentLoader,{}):(0,n.jsxs)(n.Fragment,{children:[P?P.map((e=>(0,n.jsx)(i.StatusMessage,{intent:"danger",children:e},e))):null,(0,n.jsx)(i.FormFieldRadioButtons,{name:"proxy",options:[{value:d,label:(0,n.jsx)(p,{content:"proxyEnabled"})},{value:m,label:(0,n.jsx)(p,{content:"proxyDomain"}),indentFields:[(0,n.jsx)(i.FormFieldText,{name:"domainName",placeholder:"www.example.com",size:"lg"},"domainName")]},{value:u,label:(0,n.jsx)(p,{content:"proxyDisabled",params:{httpsPort:o}})}]})]})]})};g.propTypes={getAccessUrl:a().string.isRequired,setAccessUrl:a().string.isRequired,helpUrl:a().string.isRequired,httpsPort:a().string.isRequired};const h=e=>{const[s]=(0,l.useModal)("customize-panel-access"),[t,o]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{s&&o(!0)}),[s]),t?(0,n.jsx)(g,{...e}):null};h.propTypes=g.propTypes;const x=h},1687:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>v});var n=t(591),o=t.n(n),a=t(1115),i=t(623),r=t(286),l=t(89),c=t(641),d=t(598),u=t(1688),m=t(1689),p=t.n(m),g=t(285);const h=[{name:"securityButtons",id:"securityPanel",icon:"protect"},{name:"troubleshootingButtons",id:"troubleshootingPanel",icon:"support"},{name:"serviceInstallationsButtons",id:"servicesPanel",icon:"manage"},{name:"toolsAndResourcesButtons",id:"resourcesPanel",icon:"manage"},{name:"generalButtons",id:"generalPanel",icon:"preferences"},{name:"serverManagementButtons",id:"serverManagementPanel",icon:"server"},{name:"statisticsButtons",id:"statisticsPanel",icon:"statistics"},{name:"mailButtons",id:"mailPanel",icon:"mail"},{name:"applicationsAndDatabasesButtons",id:"applicationsAndDatabasesPanel",icon:"applications-and-databases"},{name:"panelButtons",id:"panelPanel",icon:"panel"},{name:"uiButtons",id:"uiPanel",icon:"branding"},{name:"myPleskButtons",id:"myPleskPanel",icon:"external-services"},{name:"customButtons",id:"customButtons",title:"additionalServices",icon:"custom-buttons"}],x=a.gql`
    mutation RebootServer {
        rebootServer
    }
`,b=a.gql`
    mutation ShutdownServer {
        shutdownServer
    }
`,j="admin-server-tools",f=l.Locale.getTranslate("admin.controllers.server.tools"),y=e=>{const{sections:s,panelAccess:t}=e,[n]=(0,i.useMutation)(x,{errorPolicy:"all"}),[o]=(0,i.useMutation)(b,{errorPolicy:"all"}),a={rebootServer(){const e=l.Locale.getSection("admin.controllers.server.tools"),s=l.Locale.getSection("components.buttons");l.messageBox.show({type:l.messageBox.TYPE_YESNO,subtype:"reboot",text:e.lmsg("buttonServerRebootConfirmationTitle"),description:e.lmsg("buttonServerRebootConfirmationDescription"),async onYesClick(){(0,l.clearStatusMessages)();try{const{errors:e}=await n();(e||[]).forEach((({message:e})=>(0,l.addStatusMessage)("warning",e)))}catch{}},buttonTitles:{yes:s.lmsg("yes"),no:s.lmsg("no")}})},shutdownServer(){const e=l.Locale.getSection("admin.controllers.server.tools"),s=l.Locale.getSection("components.buttons");l.messageBox.show({type:l.messageBox.TYPE_YESNO,subtype:"shutdown",text:e.lmsg("buttonShutdownConfirmationTitle"),description:e.lmsg("buttonShutdownConfirmationDescription"),async onYesClick(){(0,l.clearStatusMessages)();try{const{errors:e}=await o();(e||[]).forEach((({message:e})=>(0,l.addStatusMessage)("warning",e)))}catch{}},buttonTitles:{yes:s.lmsg("yes"),no:s.lmsg("no")}})},"AdminPanel.ServerTools.showReporterPopup"({props:{supportUrl:e}}){new l.ReporterPopup({supportUrl:e,cls:"popup-panel",locale:l.Locale.getSection("components.issue-reporter")})}},d=s=>a[s]?t=>{t.preventDefault(),a[s]({props:e})}:null;return(0,g.jsxs)("div",{"data-id":"tools-list",children:[(0,g.jsx)(r.Paragraph,{children:(0,g.jsx)(f,{content:"pageHint"})}),(0,g.jsx)(r.Grid,{minColumnWidth:150,maxColumnsNumber:({width:e})=>e>1800?5:e>1100?4:e>600?3:2,sm:null,className:`${j}__sections`,gap:"md",children:h.filter((({name:e})=>s[e])).map((({name:e,id:t,icon:n,title:o})=>(0,g.jsx)(r.GridCol,{children:(0,g.jsx)(r.Item,{id:t,icon:(0,g.jsx)(r.Icon,{size:"32",children:(0,g.jsx)("svg",{focusable:"false","aria-hidden":"true",children:(0,g.jsx)("use",{href:`${p()}#${n}`})})}),title:(0,g.jsx)("span",{className:`${j}__section-title`,children:(0,g.jsx)(f,{content:o||t})}),children:(0,g.jsx)("ul",{className:`${j}__section-content`,id:`${t}-tools-list`,"data-type":"tools-section-content",children:s[e].map((({id:e,description:s,href:t,target:n,title:o,handler:a,attention:i,isNew:l})=>{const u=(0,g.jsx)(c.default,{to:t,target:n,onClick:d(a),children:i?(0,g.jsx)("span",{className:"hint-attention",children:o}):o});return(0,g.jsx)("li",{id:e,className:`${j}__section-item`,children:s?(0,g.jsx)(r.Tooltip,{title:s,children:(0,g.jsxs)(g.Fragment,{children:[u,l&&(0,g.jsxs)(g.Fragment,{children:[" ",(0,g.jsx)(r.Label,{intent:"success",children:(0,g.jsx)(f,{content:"isNew"})})]})]})}):u},e)}))})})},t)))}),(0,g.jsx)(u.default,{...t})]})};y.propTypes={sections:o().object.isRequired,panelAccess:o().object.isRequired};const v=(0,d.withPageLayout)(y)},1686:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>n.default});var n=t(1687)},1689:e=>{e.exports=Jsw.skinUrl+"/icons/32/colored-icons-sprite.svg?bcd9e4b2c76dfe087e3ee06cd993ac15"}}]);
//# sourceMappingURL=tools.js.map?7f1b64c13e490b452c7c