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