(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["views/admin/server/tools"],{1809(e,s,t){"use strict";t.r(s),t.d(s,{PanelAccess:()=>g,default:()=>x});var n=t(396),o=t(787),a=t.n(o),i=t(397),r=t(95),l=t(806),c=t(663);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),[y,f]=(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(f(null),S(null),w(null),e===m&&!t)return void f({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=>f({[e]:o.formMessages[e]})),o.messages&&w(o.messages)},errors:y},"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},1808(e,s,t){"use strict";t.r(s),t.d(s,{default:()=>v});var n=t(787),o=t.n(n),a=t(810),i=t(700),r=t(397),l=t(95),c=t(832),d=t(801),u=t(1809),m=t(1810),p=t.n(m),g=t(396);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=i.gql`
    mutation RebootServer {
        rebootServer
    }
`,b=i.gql`
    mutation ShutdownServer {
        shutdownServer
    }
`,j="admin-server-tools",y=l.Locale.getTranslate("admin.controllers.server.tools"),f=e=>{const{sections:s,panelAccess:t}=e,[n]=(0,a.useMutation)(x,{errorPolicy:"all"}),[o]=(0,a.useMutation)(b,{errorPolicy:"all"}),i={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=>i[s]?t=>{t.preventDefault(),i[s]({props:e})}:null;return(0,g.jsxs)("div",{"data-id":"tools-list",children:[(0,g.jsx)(r.Paragraph,{children:(0,g.jsx)(y,{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)(y,{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)(y,{content:"isNew"})})]})]})}):u},e)})})})},t))}),(0,g.jsx)(u.default,{...t})]})};f.propTypes={sections:o().object.isRequired,panelAccess:o().object.isRequired};const v=(0,d.withPageLayout)(f)},1807(e,s,t){"use strict";t.r(s),t.d(s,{default:()=>n.default});var n=t(1808)},1810(e){e.exports=Jsw.skinUrl+"/icons/32/colored-icons-sprite.svg?bcd9e4b2c76dfe087e3ee06cd993ac15"}}]);
//# sourceMappingURL=tools.js.map?26fe10672e2ac4eec286