From: Wouter Admiraal Date: Wed, 4 Jan 2023 08:47:43 +0000 (+0100) Subject: SONAR-17835 Fix user/group sorting on permissions list X-Git-Tag: 9.9.0.65466~118 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fcab574cfb05d51c4e1363d91287420811a2e7b3;p=sonarqube.git SONAR-17835 Fix user/group sorting on permissions list --- 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 && ( <>
{this.props.children}{children}