(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/php-handler/list"],{1118:(e,t,a)=>{"use strict";a.r(t);var n=a(148),s=a.n(n),d=a(144),l=a(155),c=a(154),r=a(261),o=a.n(r);const i=[];class h extends c.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((0,d.prepareUrl)("/php-handler/toggle/id/".concat(this.props.handler.id)),{onSuccess:({responseText:e})=>{const{status:t,statusMessages:a}=JSON.parse(e);(0,d.clearStatusMessages)(),a.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{id:e,registered:t,allowed:a}=this.props.handler,{toggling:n,enabled:s}=this.state;let d=null;return t?a||(d=(0,c.createElement)(l.Translate,{content:"module"===e?"statusDisallowedApacheModule":"statusDisallowed"})):d=(0,c.createElement)(l.Translate,{content:"statusBroken"}),(0,c.createElement)(l.Switch,{checked:s&&t&&a,onChange:this.handleToggle,disabled:!t||!a,tooltip:d,loading:n})}}h.propTypes={handler:o().object.isRequired},t.default=({hint:e,listLocaleData:t,phpHandlerList:a})=>{const n=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({...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:l,syncTaskId:c,syncMessage:r}){let o="";return s?o=l?n.lmsg("handlerOutdatedAndDeprecated"):n.lmsg("handlerOutdated"):l&&(o=n.lmsg("handlerDeprecated")),o&&(o="<span class='state-error'>".concat(o,"</span>")),c?"<span>".concat((0,d.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((0,d.prepareUrl)("/php-handler/modules/id/".concat(e)),'">').concat((0,d.escapeHtml)(t),"</a> ").concat(o):(0,d.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=>{(0,c.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=>(0,d.escapeHtml)(e))).join("<br/>");s="<div class='apps-box clearfix' style='overflow: auto; max-height: 300px;'>".concat(s,"</div>"),new d.Popup({closeButtonEnabled:!0,title:(0,d.escapeHtml)(t),content:s,buttons:[{title:(0,d.escapeHtml)(n.lmsg("closeTitle")),handler:(e,t)=>{t.hide()}}]})}));const s=document.getElementById("php-handler-status-".concat(a.id));i.push(s),(0,c.render)((0,c.createElement)(l.LocaleProvider,{messages:t},(0,c.createElement)(h,{handler:a})),s),a.syncTaskId&&this.checkSyncStatus("php-handler-sync-status-".concat(a.id),(0,d.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((0,d.prepareUrl)("/php-handler/modules/id/".concat(a.id)),"'>").concat((0,d.escapeHtml)(a.name),"</a>")}),e)}))}})]})])}}}]);
//# sourceMappingURL=list.js.map?903fdb0afb4dc34d27f9