"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/app/usage"],{950:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var s=a(243),n=a.n(s),r=a(90),i=a(951);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,Object.keys(d));o.displayName="JswList",o.propTypes=d,o.defaultProps=l;const p=o},954:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var s=a(243),n=a.n(s),r=a(242),i=a(90),d=a(761),l=a(241);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}))},o.defaultProps={items:void 0};const p=o},951:(e,t,a)=>{a.r(t),a.d(t,{default:()=>r});var s=a(241),n=a(90);const r=(e,t=[],a={})=>r=>{const i=(0,s.useRef)(),d=(0,s.useRef)(),[l,o]=Object.entries(r).reduce(((e,[a,s])=>(e[t.includes(a)?0:1][a]=s,e)),[{},{}]),p=t.map((e=>{const t=l[e];return a[e]?(d.current?.[a[e]](t),null):t}));return(0,s.useLayoutEffect)((()=>(d.current=new e(l),(0,n.render)(i.current,d.current),()=>{d.current.remove(),d.current=null})),[o.key,...p]),(0,s.jsx)("div",{ref:i,...o})}},953:(e,t,a)=>{a.r(t),a.d(t,{default:()=>h});var s=a(241),n=a(243),r=a.n(n),i=a(90),d=a(950),l=a(954),o=a(731),p=a(761);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},m.defaultProps={tabs:[]};const h=(0,o.withPageLayout)(m)},952:(e,t,a)=>{a.r(t),a.d(t,{default:()=>s.default});var s=a(953)}}]);
//# sourceMappingURL=usage.js.map?41fb30877a7621ae1c36