(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/server/tools"],{1212:(e,s,t)=>{"use strict";t.r(s),t.d(s,{PanelAccess:()=>g,default:()=>x});var n=t(270),o=t(272),a=t.n(o),i=t(271),r=t(89),l=t(614),c=t(531);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=>{j({proxy:B(e),domainName:e.domainName})})).catch((({message:e})=>(0,c.addToast)({intent:"danger",message:e}))).finally((()=>x(!1))))}),[a,e]);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},1211:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>S});var n=t(272),o=t.n(n),a=t(496),i=t(620),r=t(271),l=t(89),c=t(358),d=t(634),u=t(597),m=t(1212),p=t(1213),g=t.n(p),h=t(270);const x=[{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"}],b=a.gql`
    mutation RebootServer {
        rebootServer
    }
`,j=a.gql`
    mutation ShutdownServer {
        shutdownServer
    }
`,f="admin-server-tools",y=l.Locale.getTranslate("admin.controllers.server.tools"),v=e=>{const{sections:s,panelAccess:t}=e,[n]=(0,i.useMutation)(b,{errorPolicy:"all"}),[o]=(0,i.useMutation)(j,{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")})}},u=s=>a[s]?t=>{t.preventDefault(),a[s]({props:e})}:null,p="true"===c.default.get("debug-testing-mode");return(0,h.jsxs)("div",{"data-id":"tools-list",children:[(0,h.jsx)(r.Paragraph,{children:(0,h.jsx)(y,{content:"pageHint"})}),(0,h.jsx)(r.Grid,{minColumnWidth:p?0:150,maxColumnsNumber:({width:e})=>e>1800?5:e>1100?4:e>600?3:2,sm:p?3:null,className:`${f}__sections`,gap:"md",children:x.filter((({name:e})=>s[e])).map((({name:e,id:t,icon:n,title:o})=>(0,h.jsx)(r.GridCol,{children:(0,h.jsx)(r.Item,{id:t,icon:(0,h.jsx)(r.Icon,{size:"32",children:(0,h.jsx)("svg",{focusable:"false","aria-hidden":"true",children:(0,h.jsx)("use",{href:`${g()}#${n}`})})}),title:(0,h.jsx)("span",{className:`${f}__section-title`,children:(0,h.jsx)(y,{content:o||t})}),children:(0,h.jsx)("ul",{className:`${f}__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 c=(0,h.jsx)(d.default,{to:t,target:n,onClick:u(a),children:i?(0,h.jsx)("span",{className:"hint-attention",children:o}):o});return(0,h.jsx)("li",{id:e,className:`${f}__section-item`,children:s?(0,h.jsx)(r.Tooltip,{title:s,children:(0,h.jsxs)(h.Fragment,{children:[c,l&&(0,h.jsxs)(h.Fragment,{children:[" ",(0,h.jsx)(r.Label,{intent:"success",children:(0,h.jsx)(y,{content:"isNew"})})]})]})}):c},e)}))})})},t)))}),(0,h.jsx)(m.default,{...t})]})};v.propTypes={sections:o().object.isRequired,panelAccess:o().object.isRequired};const S=(0,u.withPageLayout)(v)},1210:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>n.default});var n=t(1211)},1213:e=>{e.exports=Jsw.skinUrl+"/icons/32/colored-icons-sprite.svg?bcd9e4b2c76dfe087e3ee06cd993ac15"}}]);
//# sourceMappingURL=tools.js.map?4e74de35757be0d99d60