"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/app/usage"],{1126:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var s=a(272),n=a.n(s),r=a(89),i=a(1127);const d={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},l={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,i.default)(r.List,{propsList:Object.keys(d),defaultProps:l});o.displayName="JswList",o.propTypes=d;const p=o},1130:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var s=a(272),n=a.n(s),r=a(271),i=a(89),d=a(636),l=a(270);const o=({items:e})=>e&&e.length>1?(0,l.jsx)(r.Tabs,{active:e.findIndex((({containerCls:e})=>"active"===e))+1,children:e.map((({title:e,href:t},a)=>(0,l.jsx)(r.Tab,{title:e,component:d.default,to:(0,i.prepareUrl)(t)},a)))}):null;o.propTypes={items:n().arrayOf(n().shape({title:n().string.isRequired,href:n().string.isRequired,containerCls:n().string}))};const p=o},1127:(e,t,a)=>{a.r(t),a.d(t,{default:()=>r});var s=a(270),n=a(89);const r=(e,{propsList:t=[],setters:a={},defaultProps:r={}})=>i=>{const d=(0,s.useRef)(),l=(0,s.useRef)(),[o,p]=Object.entries({...r,...i}).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)(d.current,l.current),()=>{l.current.remove(),l.current=null})),[p.key,...c]),(0,s.jsx)("div",{ref:d,...p})}},1129:(e,t,a)=>{a.r(t),a.d(t,{default:()=>h});var s=a(270),n=a(272),r=a.n(n),i=a(89),d=a(1126),l=a(1130),o=a(592),p=a(636);const c=i.Locale.getTranslate("admin.controllers.app.usage"),u=i.Locale.getSection("admin.components.lists.appusage"),m=({isAdmin:e,tabs:t=[],data:a,searchFilters:n})=>{const r=(0,p.useNavigateCallback)(),o=(0,s.useMemo)((()=>e?[{componentType:i.SmallButton,id:"buttonCleanApplicationCache",attrs:{"data-method":"post"},title:u.lmsg("buttonCleanApplicationCache"),description:u.lmsg("buttonCleanApplicationCacheDescription"),addCls:"sb-clean-app-cache",href:"/app/clear-cache"},a.data.length?{componentType:i.SmallButton,id:"buttonCheckForUpdates",title:u.lmsg("buttonCheckForUpdates"),description:u.lmsg("buttonCheckForUpdatesDescription"),addCls:"sb-upload-new-app",handler(){i.api.post((0,i.prepareUrl)("/app/get-updates-data/")).then((e=>{(0,i.clearStatusMessages)();let t=u.lmsg(e.length?"foundUpdates":"noUpdates");e.forEach((({name:e,version:a})=>{t+=`<br>${e} ${a}`})),(0,i.addStatusMessage)("info",t)})).catch((()=>(0,i.addStatusMessage)("error",u.lmsg("updateFailed"))))}}:null,{componentType:i.bar.Separator},{componentType:i.SmallButton,id:"buttonUpdateSettings",title:u.lmsg("buttonUpdateSettings"),description:u.lmsg("buttonUpdateSettingsDescription"),addCls:"sb-app-configure",href:"/app/update-settings"}]:null),[a.data.length,e]),m=(0,s.useMemo)((()=>[{header:u.lmsg("name"),sortable:!0,dataIndex:"name",renderer:({id:e,name:t,version:a,release:s})=>(0,i.createElement)("a",{href:(0,i.prepareUrl)(`/app/info/id/${e}`),onclick:r},`${(0,i.escapeHtml)(t)} (${(0,i.escapeHtml)(a)}-${(0,i.escapeHtml)(s)})`)},{header:u.lmsg("numberOfInstances"),sortable:!0,dataIndex:"numberOfInstances",renderer:({numberOfInstances:e})=>(0,i.escapeHtml)(e)}]),[r]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.default,{items:t}),(0,s.jsx)("p",{children:e?(0,s.jsx)(c,{content:"hint"}):(0,s.jsx)(c,{content:"hintReseller"})}),(0,s.jsx)(d.default,{id:"admin-app-usage-list",data:a,dataUrl:"/admin/app/usage-data",searchFilters:n,operations:o,columns:m})]})};m.propTypes={isAdmin:r().bool.isRequired,tabs:l.default.propTypes.items,data:d.default.propTypes.data.isRequired,searchFilters:d.default.propTypes.searchFilters.isRequired};const h=(0,o.withPageLayout)(m)},1128:(e,t,a)=>{a.r(t),a.d(t,{default:()=>s.default});var s=a(1129)}}]);
//# sourceMappingURL=usage.js.map?5f5816e43cbc62756b3e