"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/php-handler/list"],{897:(e,t,a)=>{a.r(t),a.d(t,{default:()=>c});var s=a(218),n=a.n(s),d=a(96),r=a(898);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;const c=i},898:(e,t,a)=>{a.r(t),a.d(t,{default:()=>d});var s=a(216),n=a(96);const d=(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})}},939:(e,t,a)=>{a.r(t),a.d(t,{default:()=>c});var s=a(100),n=a(96),d=a(217),r=a(216),l=a(218),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}),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})}}i.propTypes={handler:o().object.isRequired};const c=i},938:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var s=a(216),n=a(217),d=a(96),r=a(897),l=a(939);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};const p=c},937:(e,t,a)=>{a.r(t),a.d(t,{default:()=>i});var s=a(217),n=a(96),d=a(765),r=a(938),l=a(216);const o=n.Locale.getTranslate("admin.controllers.php-handler.list"),i=(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})]})))},936:(e,t,a)=>{a.r(t),a.d(t,{default:()=>s.default});var s=a(937)}}]);
//# sourceMappingURL=list.js.map?43a0127bdc496abc7acb