(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/php-handler/list"],{1141:(e,t,s)=>{"use strict";s.r(t);var a=s(148),n=s.n(a),d=s(144),l=s(155),r=s(154),i=s(261),o=s.n(i);const h=[];class p extends r.Component{constructor(...e){super(...e),n()(this,"state",{toggling:!1,enabled:this.props.handler.enabled}),n()(this,"handleToggle",(()=>{this.setState({toggling:!0}),new Ajax.Request((0,d.prepareUrl)(`/php-handler/toggle/id/${this.props.handler.id}`),{onSuccess:({responseText:e})=>{const{status:t,statusMessages:s}=JSON.parse(e);(0,d.clearStatusMessages)(),s.forEach((({status:e,content:t})=>{(0,d.addStatusMessage)(e,t)})),this.setState({toggling:!1,enabled:"success"===t?!this.state.enabled:this.state.enabled})}})}))}render(){const{registered:e,allowed:t}=this.props.handler,{toggling:s,enabled:a}=this.state;let n=null;return e?t||(n=(0,r.createElement)(l.Translate,{content:"statusDisallowedApacheModule"})):n=(0,r.createElement)(l.Translate,{content:"statusBroken"}),(0,r.createElement)(l.Switch,{checked:a&&e&&t,onChange:this.handleToggle,disabled:!e||!t,tooltip:n,loading:s})}}p.propTypes={handler:o().object.isRequired},t.default=({hint:e,phpHandlerList:t})=>{const s=d.Locale.getSection("admin.components.lists.phphandlers");(0,d.render)(document.getElementById("main"),[new d.Hint({hint:e}),new d.Panel({cls:"list-box",items:[new d.List({...t,columns:[{header:"",cls:"icon",renderer:({id:e})=>`<div id="php-handler-status-${e}"></div>`},{header:s.lmsg("name"),sortable:!0,dataIndex:"name",renderer({id:e,name:t,registered:a,outdated:n,deprecated:l,syncTaskId:r,syncMessage:i}){let o="";return n?o=l?s.lmsg("handlerOutdatedAndDeprecated"):s.lmsg("handlerOutdated"):l&&(o=s.lmsg("handlerDeprecated")),o&&(o=`<span class='state-error'>${o}</span>`),r?`<span>${(0,d.escapeHtml)(t)}</span> ${o}\n                                            <div id='php-handler-sync-status-${e}' class='hint-sub hint-wait'>${i}</div>`:a?`<a href="${(0,d.prepareUrl)(`/php-handler/modules/id/${e}`)}">${(0,d.escapeHtml)(t)}</a> ${o}`:(0,d.escapeHtml)(t)+o}},{header:s.lmsg("domains"),sortable:!1,cls:"number t-r",renderer:({id:e,enabled:t,domains:s})=>t||0!==s.length?0===s.length?"0":`<a href="#" id="php-handler-domains-${e}">${s.length}</a>`:""}],onRedraw(){if(h.forEach((e=>{(0,r.unmountComponentAtNode)(e)})),!this._data)return;const e=this._getRandomNumber();this._randomId=e,this._data.forEach((t=>{0!==t.domains.length&&document.getElementById(`php-handler-domains-${t.id}`).addEventListener("click",(e=>{e.preventDefault();let a=s.lmsg("domainsTitle");a=a.replace("%%domains%%",t.domains.length).replace("%%handler%%",t.name);let n=t.domains.map((e=>(0,d.escapeHtml)(e))).join("<br/>");n=`<div class='apps-box clearfix' style='overflow: auto; max-height: 300px;'>${n}</div>`,new d.Popup({closeButtonEnabled:!0,title:(0,d.escapeHtml)(a),content:n,buttons:[{title:(0,d.escapeHtml)(s.lmsg("closeTitle")),handler:(e,t)=>{t.hide()}}]})}));const a=document.getElementById(`php-handler-status-${t.id}`);h.push(a),(0,r.render)((0,r.createElement)(l.LocaleProvider,{messages:s.messages},(0,r.createElement)(p,{handler:t})),a),t.syncTaskId&&this.checkSyncStatus(`php-handler-sync-status-${t.id}`,(0,d.prepareUrl)(`/php-handler/sync-status/id/${t.syncTaskId}`),((e,s)=>{e.update(s.message),e.classList.remove("hint-wait"),"done"===s.status?e.classList.add("hint-ok"):e.classList.add("hint-warning"),e.parentNode.querySelector("span").innerHTML=`<a href='${(0,d.prepareUrl)(`/php-handler/modules/id/${t.id}`)}'>${(0,d.escapeHtml)(t.name)}</a>`}),e)}))}})]})])}}}]);
//# sourceMappingURL=list.js.map?dd9397b0d4d762a7757f