"use strict";(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["views/admin/app/usage"],{1659(e,t,a){a.r(t),a.d(t,{default:()=>p});var s=a(757),n=a.n(s),r=a(90),i=a(1660);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},d=(0,i.default)(r.List,{propsList:Object.keys(l),defaultProps:o});d.displayName="JswList",d.propTypes=l;const p=d},1663(e,t,a){a.r(t),a.d(t,{default:()=>p});var s=a(757),n=a.n(s),r=a(373),i=a(90),l=a(802),o=a(372);const d=({items:e})=>e&&e.length>1?(0,o.jsx)(r.Tabs,{active:e.findIndex(({containerCls:e})=>"active"===e)+1,children:e.map(({title:e,href:t},a)=>(0,o.jsx)(r.Tab,{title:e,component:l.default,to:(0,i.prepareUrl)(t)},a))}):null;d.propTypes={items:n().arrayOf(n().shape({title:n().string.isRequired,href:n().string.isRequired,containerCls:n().string}))};const p=d},1660(e,t,a){a.r(t),a.d(t,{default:()=>r});var s=a(372),n=a(90);const r=(e,{propsList:t=[],setters:a={},defaultProps:r={}})=>i=>{const l=(0,s.useRef)(),o=(0,s.useRef)(),[d,p]=Object.entries({...r,...i}).reduce((e,[a,s])=>(e[t.includes(a)?0:1][a]=s,e),[{},{}]),c=t.map(e=>{const t=d[e];return a[e]?(o.current?.[a[e]](t),null):t});return(0,s.useLayoutEffect)(()=>(o.current=new e(d),(0,n.render)(l.current,o.current),()=>{o.current.remove(),o.current=null}),[p.key,...c]),(0,s.jsx)("div",{ref:l,...p})}},1662(e,t,a){a.r(t),a.d(t,{default:()=>h});var s=a(372),n=a(757),r=a.n(n),i=a(90),l=a(1659),o=a(1663),d=a(771),p=a(802);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)(),d=(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)(o.default,{items:t}),(0,s.jsx)("p",{children:e?(0,s.jsx)(c,{content:"hint"}):(0,s.jsx)(c,{content:"hintReseller"})}),(0,s.jsx)(l.default,{id:"admin-app-usage-list",data:a,dataUrl:"/admin/app/usage-data",searchFilters:n,operations:d,columns:m})]})};m.propTypes={isAdmin:r().bool.isRequired,tabs:o.default.propTypes.items,data:l.default.propTypes.data.isRequired,searchFilters:l.default.propTypes.searchFilters.isRequired};const h=(0,d.withPageLayout)(m)},1661(e,t,a){a.r(t),a.d(t,{default:()=>s.default});var s=a(1662)}}]);
//# sourceMappingURL=usage.js.map?30ea851a2aad92284eaf