"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/smb/database/users-list"],{1e3:(e,a,t)=>{t.r(a),t.d(a,{default:()=>c});var s=t(244),r=t.n(s),d=t(90),o=t(1001);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,Object.keys(i));n.displayName="JswList",n.propTypes=i,n.defaultProps=l;const c=n},1001:(e,a,t)=>{t.r(a),t.d(a,{default:()=>d});var s=t(242),r=t(90);const d=(e,a=[],t={})=>d=>{const o=(0,s.useRef)(),i=(0,s.useRef)(),[l,n]=Object.entries(d).reduce(((e,[t,s])=>(e[a.includes(t)?0:1][t]=s,e)),[{},{}]),c=a.map((e=>{const a=l[e];return t[e]?(i.current?.[t[e]](a),null):a}));return(0,s.useLayoutEffect)((()=>(i.current=new e(l),(0,r.render)(o.current,i.current),()=>{i.current.remove(),i.current=null})),[n.key,...c]),(0,s.jsx)("div",{ref:o,...n})}},1727:(e,a,t)=>{t.r(a),t.d(a,{default:()=>u});var s=t(242),r=t(244),d=t.n(r),o=t(90),i=t(1e3);const l=o.Locale.getSection("smb.controllers.database.users-list"),n=o.Locale.getSection("smb.components.lists.database.users"),c=({data:e,searchFilters:a,domainId:t,allowCreateUser:r})=>{const d=(0,s.useMemo)((()=>[o.list.COLUMN_SELECTION,{header:n.lmsg("login"),sortable:!0,dataIndex:"login",renderer({id:e,login:a,isDefault:t,isUsedByApp:s,status:r}){const d=t?(0,o.createElement)("b",a):a;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:a})=>e?(0,o.createElement)("b",a):a},{header:n.lmsg("server"),sortable:!1,dataIndex:"server",renderer:({serverHost:e,serverPort:a,serverTypeTitle:t})=>`${e}${0<a?`:${a}`:""} (${t})`}]),[]),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/${t}`}: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 a=(0,o.getComponent)("database-users-list"),t=a.getSelectedItems();a.execGroupOperation({url:"/smb/database/delete-users",subtype:o.messageBox.SUBTYPE_DELETE,mouseEvent:e,text:n.formatMessage("confirmOnDelete",{login:`<b>${(0,o.escapeHtml)(t[0]?.login)}</b>`,count:t.length})})}}]),[r,t]),u=(0,s.useCallback)((({isUsedByApp:e,isDefault:a})=>e||a),[]);return(0,s.jsx)(i.default,{id:"database-users-list",data:e,dataUrl:`/smb/database/users-list-data/domainId/${t}`,searchFilters:a,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},1726:(e,a,t)=>{t.r(a),t.d(a,{default:()=>o});var s=t(739),r=t(1727),d=t(242);const o=(0,s.withPageLayout)((e=>(0,d.jsx)(r.default,{...e})))},1725:(e,a,t)=>{t.r(a),t.d(a,{default:()=>s.default});var s=t(1726)}}]);
//# sourceMappingURL=users-list.js.map?7702f972458ba0d2ffb9