"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/php-handler/list"],{869:(e,t,a)=>{a.r(t);var s=a(210),n=a.n(s),d=a(88),r=a(870);const l={id:n().string,dataUrl:n().string,operations:n().array,itemActions:n().object,columns:n().array,data:n().shape({data:n().array,state:n().object,pager:n().object,locale:n().object,additional:n().object,pathbar:n().any}),searchFilters:n().object,searchOveral:n().string,disabledSelectHint:n().string,isDisabledItem:n().func,onRedraw:n().func,emptyViewMode:n().oneOf(["all","items"]),emptyView:n().any},o={id:void 0,dataUrl:void 0,operations:void 0,itemActions:void 0,columns:void 0,data:void 0,searchFilters:void 0,searchOveral:void 0,disabledSelectHint:void 0,isDisabledItem:void 0,onRedraw:void 0,emptyViewMode:void 0,emptyView:void 0},i=(0,r.default)(d.List,Object.keys(l));i.displayName="JswList",i.propTypes=l,i.defaultProps=o,t.default=i},870:(e,t,a)=>{a.r(t);var s=a(208),n=a(88);t.default=(e,t=[],a={})=>d=>{const r=(0,s.useRef)(),l=(0,s.useRef)(),[o,i]=Object.entries(d).reduce(((e,[a,s])=>(e[t.includes(a)?0:1][a]=s,e)),[{},{}]),c=t.map((e=>{const t=o[e];return a[e]?(l.current?.[a[e]](t),null):t}));return(0,s.useLayoutEffect)((()=>(l.current=new e(o),(0,n.render)(r.current,l.current),()=>{l.current.remove(),l.current=null})),[i.key,...c]),(0,s.jsx)("div",{ref:r,...i})}},911:(e,t,a)=>{a.r(t);var s=a(92),n=a(88),d=a(209),r=a(208),l=a(210),o=a.n(l);class i extends r.Component{constructor(...e){super(...e),(0,s.default)(this,"state",{toggling:!1,enabled:this.props.handler.enabled}),(0,s.default)(this,"handleToggle",(()=>{this.setState({toggling:!0}),new Ajax.Request((0,n.prepareUrl)(`/php-handler/toggle/id/${this.props.handler.id}`),{onSuccess:({responseText:e})=>{const{status:t,statusMessages:a}=JSON.parse(e);(0,n.clearStatusMessages)(),a.forEach((({status:e,content:t})=>{(0,n.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:a,enabled:s}=this.state;let n=null;return e?t||(n=(0,r.jsx)(d.Translate,{content:"statusDisallowedApacheModule"})):n=(0,r.jsx)(d.Translate,{content:"statusBroken"}),(0,r.jsx)(d.Switch,{checked:s&&e&&t,onChange:this.handleToggle,disabled:!e||!t,tooltip:n,loading:a})}}i.propTypes={handler:o().object.isRequired},t.default=i},910:(e,t,a)=>{a.r(t);var s=a(208),n=a(209),d=a(88),r=a(869),l=a(911);const o=[],i=d.Locale.getSection("admin.components.lists.phphandlers"),c=({data:e})=>{const t=(0,s.useMemo)((()=>[{header:"",cls:"icon",renderer:({id:e})=>`<div id="php-handler-status-${e}"></div>`},{header:i.lmsg("name"),sortable:!0,dataIndex:"name",renderer({id:e,name:t,registered:a,outdated:s,deprecated:n}){let r="";return s?r=n?i.lmsg("handlerOutdatedAndDeprecated"):i.lmsg("handlerOutdated"):n&&(r=i.lmsg("handlerDeprecated")),r&&(r=`<span class='state-error'>${r}</span>`),a?`<a href="${(0,d.prepareUrl)(`/php-handler/modules/id/${e}`)}">${(0,d.escapeHtml)(t)}</a> ${r}`:(0,d.escapeHtml)(t)+r}},{header:i.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-${e}">${a.length}</a>`:""}]),[]),a=(0,s.useCallback)((()=>{const e=(0,d.getComponent)("php-handler-list");o.forEach((e=>{(0,s.unmountComponentAtNode)(e)})),e._data&&(e._randomId=e._getRandomNumber(),e._data.forEach((e=>{0!==e.domains.length&&document.getElementById(`php-handler-domains-${e.id}`).addEventListener("click",(t=>{t.preventDefault();let a=i.lmsg("domainsTitle");a=a.replace("%%domains%%",e.domains.length).replace("%%handler%%",e.name);let s=e.domains.map((e=>(0,d.escapeHtml)(e))).join("<br/>");s=`<div class='apps-box clearfix' style='overflow: auto; max-height: 300px;'>${s}</div>`,new d.Popup({closeButtonEnabled:!0,title:(0,d.escapeHtml)(a),content:s,buttons:[{title:(0,d.escapeHtml)(i.lmsg("closeTitle")),handler:(e,t)=>{t.hide()}}]})}));const t=document.getElementById(`php-handler-status-${e.id}`);o.push(t),(0,s.render)((0,s.jsx)(n.LocaleProvider,{messages:i.messages,children:(0,s.jsx)(l.default,{handler:e})}),t)})))}),[]);return(0,s.jsx)(r.default,{id:"php-handler-list",data:e,dataUrl:"/admin/php-handler/list-data",columns:t,onRedraw:a})};c.propTypes={data:r.default.propTypes.data.isRequired},t.default=c},909:(e,t,a)=>{a.r(t);var s=a(209),n=a(88),d=a(697),r=a(910),l=a(208);const o=n.Locale.getTranslate("admin.controllers.php-handler.list");t.default=(0,d.withPageLayout)((e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:(0,l.jsx)(o,{content:"hint",params:{link:(0,l.jsx)(s.Link,{href:"/admin/update/add-components",target:"_blank",children:(0,l.jsx)(o,{content:"hintLink"})})}})}),(0,l.jsx)(r.default,{...e})]})))},908:(e,t,a)=>{a.r(t),a.d(t,{default:()=>s.default});var s=a(909)}}]);
//# sourceMappingURL=list.js.map?c1c6dea8d974a1e93774