"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/app/usage"],{1e3:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var s=a(244),n=a.n(s),r=a(90),i=a(1001);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},1004:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var s=a(244),n=a.n(s),r=a(243),i=a(90),d=a(775),l=a(242);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},1001:(e,t,a)=>{a.r(t),a.d(t,{default:()=>r});var s=a(242),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})}},1003:(e,t,a)=>{a.r(t),a.d(t,{default:()=>h});var s=a(242),n=a(244),r=a.n(n),i=a(90),d=a(1e3),l=a(1004),o=a(739),p=a(775);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)},1002:(e,t,a)=>{a.r(t),a.d(t,{default:()=>s.default});var s=a(1003)}}]);
//# sourceMappingURL=usage.js.map?9a51ef2255f28253abc5