"use strict";(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["views/smb/smarthost/list"],{1722(e,t,a){a.r(t),a.d(t,{default:()=>c});var s=a(786),r=a.n(s),i=a(397),n=a(95),o=a(831),l=a(396);const d=({items:e})=>e&&e.length>1?(0,l.jsx)(i.Tabs,{active:e.findIndex(({containerCls:e})=>"active"===e)+1,children:e.map(({title:e,href:t},a)=>(0,l.jsx)(i.Tab,{title:e,component:o.default,to:(0,n.prepareUrl)(t)},a))}):null;d.propTypes={items:r().arrayOf(r().shape({title:r().string.isRequired,href:r().string.isRequired,containerCls:r().string}))};const c=d},1899(e,t,a){a.r(t),a.d(t,{default:()=>g});var s=a(396),r=a(786),i=a.n(r),n=a(1255),o=a(805),l=a(95),d=a(397);const c=l.Locale.getSection("smb.components.lists.smarthosts"),m=l.Locale.getSection("smb.components.lists.mailsettings"),u=({data:e,dataUrl:t,isOutgoingSupported:a})=>{const[r,i]=(0,s.useState)(e);(0,s.useEffect)(()=>{i(e)},[e]);const u=async({url:e=t,params:a}={})=>{a&&(e=(0,n.buildUrl)(e,a));const s=await l.api.get((0,l.prepareUrl)(e));if(s?.redirect)return(0,l.redirect)(s.redirect);i(s)},{renderPagination:g,sortParams:p,loading:h,filter:b,handleFilter:f,loadingRows:S}=(0,o.useList)({initialFilter:Object.entries(r.state.searchFilters??{}).reduce((e,[t,{searchText:a}])=>({...e,[t]:a}),{}),pagination:{current:r.pager.current,totalPage:r.pager.pageCount,itemsPerPage:r.pager.itemCountPerPage,async onPageChange(e){await u({params:{page:e}})},async onChangeItemsPerPage(e){await u({params:{"items-per-page":e}})}},sort:{direction:"up"===r.state?.sortDirection?"ASC":"DESC",column:r.state?.sortField,async onChange({sortColumn:e,sortDirection:a}){await u({url:`${t}/sort-field/${e}/sort-dir/${"ASC"===a?"up":"down"}`})}},async onReload(){await u()},async onFilter(e){await u({params:Object.entries(e).reduce((e,[t,a])=>({...e,[`searchFilter[${t}][searchText]`]:a}),{})})}}),v=[{key:"domainName",sortable:!0,title:c.lmsg("domainName"),type:"title",render:e=>null!==e.mailService?(0,s.jsx)(d.Link,{href:`/smb/smarthost/edit/domainId/${e.domainId}`,children:e.domainName}):e.domainName},{key:"mailService",sortable:!0,title:c.lmsg("mailService"),render:e=>0===e.mailService?(0,s.jsx)(d.Status,{intent:"success",children:m.lmsg("statusEnabled")}):null===e.mailService?(0,s.jsx)(d.Status,{intent:"inactive",children:m.lmsg("statusNotConfigured")}):a?(0,s.jsx)(d.Status,{intent:"inactive",children:m.lmsg("statusDisabledIncoming")}):(0,s.jsx)(d.Status,{intent:"inactive",children:m.lmsg("statusDisabled")})},{key:"smarthost",sortable:!0,title:c.lmsg("smarthost"),render:e=>{const t=e.smarthost??c.lmsg("notConfigured"),r="true"===e.smarthostEnabled&&null!==e.mailService&&(0===e.mailService||a);return(0,s.jsx)(d.Status,{intent:r?"success":"inactive",children:t})}}];return(0,s.jsx)(d.List,{columns:v,toolbar:(0,s.jsx)(d.Toolbar,{children:(0,s.jsx)(d.ToolbarGroup,{title:"filter",children:(0,s.jsx)(d.SearchBar,{inputProps:{value:b?.domainName},onSearch:e=>f({domainName:e})})})}),data:r.data,loading:h,loadingRows:S,totalRows:r.pager.totalItemCount,...p,pagination:g(),filtered:Boolean(b.domainName)})};u.propTypes={data:i().shape({state:i().shape({sortDirection:i().oneOf(["up","down"]),sortField:i().string,searchFilters:i().object}),pager:i().shape({current:i().number,pageCount:i().number,itemCountPerPage:i().number}).isRequired,data:i().arrayOf(i().shape({domainId:i().number.isRequired,domainName:i().string.isRequired,mailService:i().number,smarthost:i().string,smarthostEnabled:i().string,smarthostHost:i().string,smarthostPort:i().number}))}).isRequired,dataUrl:i().string.isRequired,isOutgoingSupported:i().bool.isRequired};const g=u},1898(e,t,a){a.r(t),a.d(t,{default:()=>l});var s=a(1722),r=a(800),i=a(1899),n=a(396);const o=({tabs:e=[],...t})=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.default,{items:e}),(0,n.jsx)(i.default,{...t})]});o.propTypes={tabs:s.default.propTypes.items};const l=(0,r.withPageLayout)(o)},1897(e,t,a){a.r(t),a.d(t,{default:()=>s.default});var s=a(1898)}}]);
//# sourceMappingURL=list.js.map?6db236ace7545c54e595