From fcab574cfb05d51c4e1363d91287420811a2e7b3 Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Wed, 4 Jan 2023 09:47:43 +0100 Subject: [PATCH] SONAR-17835 Fix user/group sorting on permissions list --- .../shared/components/HoldersList.tsx | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx index 7b0adb40800..19991ed9e25 100644 --- a/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx +++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { partition, sortBy } from 'lodash'; +import { partition } from 'lodash'; import * as React from 'react'; import { translate } from '../../../../helpers/l10n'; import { @@ -124,23 +124,26 @@ export default class HoldersList extends React.PureComponent { } render() { - const { permissions } = this.props; - const items = sortBy([...this.props.users, ...this.props.groups], (item) => { - if (this.isPermissionUser(item) && item.login === '') { - return 0; - } - return item.name; - }); - + const { + permissions, + users, + groups, + loading, + children, + selectedPermission, + showPublicProjectsWarning, + } = this.props; + const items = [...groups, ...users]; const [itemWithPermissions, itemWithoutPermissions] = partition(items, (item) => this.getItemInitialPermissionsCount(item) ); + return (
- + {permissions.map((permission) => ( { } onSelectPermission={this.props.onSelectPermission} permission={permission} - selectedPermission={this.props.selectedPermission} - showPublicProjectsWarning={this.props.showPublicProjectsWarning} + selectedPermission={selectedPermission} + showPublicProjectsWarning={showPublicProjectsWarning} /> ))} - {items.length === 0 && !this.props.loading && this.renderEmpty()} + {items.length === 0 && !loading && this.renderEmpty()} {itemWithPermissions.map((item) => this.renderItem(item, permissions))} {itemWithPermissions.length > 0 && itemWithoutPermissions.length > 0 && ( <> -- 2.39.5
{this.props.children}{children}