"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/php-handler/list"],{879:(e,t,a)=>{a.r(t);var s=a(210),n=a.n(s),d=a(88),r=a(880);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},i={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},o=(0,r.default)(d.List,Object.keys(l));o.displayName="JswList",o.propTypes=l,o.defaultProps=i,t.default=o},880:(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)(),[i,o]=Object.entries(d).reduce(((e,[a,s])=>(e[t.includes(a)?0:1][a]=s,e)),[{},{}]),c=t.map((e=>{const t=i[e];return a[e]?(l.current?.[a[e]](t),null):t}));return(0,s.useLayoutEffect)((()=>(l.current=new e(i),(0,n.render)(r.current,l.current),()=>{l.current.remove(),l.current=null})),[o.key,...c]),(0,s.jsx)("div",{ref:r,...o})}},921:(e,t,a)=>{a.r(t);var s=a(92),n=a(88),d=a(209),r=a(208),l=a(210),i=a.n(l);class o 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}),n.api.post((0,n.prepareUrl)(`/php-handler/toggle/id/${this.props.handler.id}`)).then((e=>{const{status:t,statusMessages:a}=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})}}o.propTypes={handler:i().object.isRequired},t.default=o},920:(e,t,a)=>{a.r(t);var s=a(208),n=a(209),d=a(88),r=a(879),l=a(921);const i=[],o=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:o.lmsg("name"),sortable:!0,dataIndex:"name",renderer({id:e,name:t,registered:a,outdated:s,deprecated:n}){let r="";return s?r=n?o.lmsg("handlerOutdatedAndDeprecated"):o.lmsg("handlerOutdated"):n&&(r=o.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:o.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");i.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=o.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)(o.lmsg("closeTitle")),handler:(e,t)=>{t.hide()}}]})}));const t=document.getElementById(`php-handler-status-${e.id}`);i.push(t),(0,s.render)((0,s.jsx)(n.LocaleProvider,{messages:o.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},919:(e,t,a)=>{a.r(t);var s=a(209),n=a(88),d=a(748),r=a(920),l=a(208);const i=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)(i,{content:"hint",params:{link:(0,l.jsx)(s.Link,{href:"/admin/update/add-components",target:"_blank",children:(0,l.jsx)(i,{content:"hintLink"})})}})}),(0,l.jsx)(r.default,{...e})]})))},918:(e,t,a)=>{a.r(t),a.d(t,{default:()=>s.default});var s=a(919)}}]);
//# sourceMappingURL=list.js.map?07cc6578f50f026e065b