diff options
author | Wouter Admiraal <wouter.admiraal@sonarsource.com> | 2023-01-04 09:47:43 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-01-04 20:02:52 +0000 |
commit | fcab574cfb05d51c4e1363d91287420811a2e7b3 (patch) | |
tree | 7fcb45d04c532a6cf56ac587902b0ac65651011c /server/sonar-web/src/main/js/apps | |
parent | e1510859ff015971925a6942cdecc2f128e29403 (diff) | |
download | sonarqube-fcab574cfb05d51c4e1363d91287420811a2e7b3.tar.gz sonarqube-fcab574cfb05d51c4e1363d91287420811a2e7b3.zip |
SONAR-17835 Fix user/group sorting on permissions list
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
-rw-r--r-- | server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx | 29 |
1 files 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<Props, State> { } render() { - const { permissions } = this.props; - const items = sortBy([...this.props.users, ...this.props.groups], (item) => { - if (this.isPermissionUser(item) && item.login === '<creator>') { - 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 ( <div className="boxed-group boxed-group-inner"> <table className="data zebra permissions-table"> <thead> <tr> - <td className="nowrap bordered-bottom">{this.props.children}</td> + <td className="nowrap bordered-bottom">{children}</td> {permissions.map((permission) => ( <PermissionHeader key={ @@ -148,14 +151,14 @@ export default class HoldersList extends React.PureComponent<Props, State> { } onSelectPermission={this.props.onSelectPermission} permission={permission} - selectedPermission={this.props.selectedPermission} - showPublicProjectsWarning={this.props.showPublicProjectsWarning} + selectedPermission={selectedPermission} + showPublicProjectsWarning={showPublicProjectsWarning} /> ))} </tr> </thead> <tbody> - {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 && ( <> |