"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/smb/database/users-list"],{1106:(e,t,a)=>{a.r(t),a.d(t,{default:()=>c});var s=a(272),r=a.n(s),d=a(89),o=a(1107);const i={id:r().string,dataUrl:r().string,operations:r().array,itemActions:r().object,columns:r().array,data:r().shape({data:r().array,state:r().object,pager:r().object,locale:r().object,additional:r().object,pathbar:r().any}),searchFilters:r().object,searchOveral:r().string,disabledSelectHint:r().string,isDisabledItem:r().func,onRedraw:r().func,emptyViewMode:r().oneOf(["all","items"]),emptyView:r().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},n=(0,o.default)(d.List,{propsList:Object.keys(i),defaultProps:l});n.displayName="JswList",n.propTypes=i;const c=n},1107:(e,t,a)=>{a.r(t),a.d(t,{default:()=>d});var s=a(270),r=a(89);const d=(e,{propsList:t=[],setters:a={},defaultProps:d={}})=>o=>{const i=(0,s.useRef)(),l=(0,s.useRef)(),[n,c]=Object.entries({...d,...o}).reduce(((e,[a,s])=>(e[t.includes(a)?0:1][a]=s,e)),[{},{}]),u=t.map((e=>{const t=n[e];return a[e]?(l.current?.[a[e]](t),null):t}));return(0,s.useLayoutEffect)((()=>(l.current=new e(n),(0,r.render)(i.current,l.current),()=>{l.current.remove(),l.current=null})),[c.key,...u]),(0,s.jsx)("div",{ref:i,...c})}},1858:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u});var s=a(270),r=a(272),d=a.n(r),o=a(89),i=a(1106);const l=o.Locale.getSection("smb.controllers.database.users-list"),n=o.Locale.getSection("smb.components.lists.database.users"),c=({data:e,searchFilters:t,domainId:a,allowCreateUser:r})=>{const d=(0,s.useMemo)((()=>[o.list.COLUMN_SELECTION,{header:n.lmsg("login"),sortable:!0,dataIndex:"login",renderer({id:e,login:t,isDefault:a,isUsedByApp:s,status:r}){const d=a?(0,o.createElement)("b",t):t;return["orphaned"===r?d:(0,o.createElement)("a",{href:`/smb/database/edit-user/id/${e}`},d),s?` (${n.lmsg("disabledSelectHint")})`:"","orphaned"===r?` (${n.lmsg("orphanedHint",{orphanedRepairLink:`<a href="/smb/database/repair-orphaned/id/${e}">${n.lmsg("orphanedRepairLink")}</a>`})})`:""]}},{header:n.lmsg("database"),sortable:!1,dataIndex:"databaseName",renderer:({globalUser:e,databaseName:t})=>e?(0,o.createElement)("b",t):t},{header:n.lmsg("server"),sortable:!1,dataIndex:"server",renderer:({serverHost:e,serverPort:t,serverTypeTitle:a})=>`${e}${0<t?`:${t}`:""} (${a})`}]),[]),c=(0,s.useMemo)((()=>[r?{componentType:o.SmallButton,title:l.lmsg("buttonAddUser"),description:l.lmsg("buttonAddUserHint"),addCls:"sb-add-user btn-primary",href:`/smb/database/create-user/domainId/${a}`}:null,r?{componentType:o.bar.Separator}:null,{componentType:o.SmallButton,id:"buttonRemoveUser",title:n.lmsg("remove"),description:n.lmsg("hintRemove"),addCls:"sb-remove-selected",handler(e){const t=(0,o.getComponent)("database-users-list"),a=t.getSelectedItems();t.execGroupOperation({url:"/smb/database/delete-users",subtype:o.messageBox.SUBTYPE_DELETE,mouseEvent:e,text:n.formatMessage("confirmOnDelete",{login:`<b>${(0,o.escapeHtml)(a[0]?.login)}</b>`,count:a.length})})}}]),[r,a]),u=(0,s.useCallback)((({isUsedByApp:e,isDefault:t})=>e||t),[]);return(0,s.jsx)(i.default,{id:"database-users-list",data:e,dataUrl:`/smb/database/users-list-data/domainId/${a}`,searchFilters:t,searchOveral:"name",columns:d,operations:c,isDisabledItem:u})};c.propTypes={data:i.default.propTypes.data.isRequired,searchFilters:i.default.propTypes.searchFilters.isRequired,domainId:d().string.isRequired,allowCreateUser:d().bool.isRequired};const u=c},1857:(e,t,a)=>{a.r(t),a.d(t,{default:()=>o});var s=a(591),r=a(1858),d=a(270);const o=(0,s.withPageLayout)((e=>(0,d.jsx)(r.default,{...e})))},1856:(e,t,a)=>{a.r(t),a.d(t,{default:()=>s.default});var s=a(1857)}}]);
//# sourceMappingURL=users-list.js.map?90aca66ce490bf74dc42