mirror of
https://github.com/ProtonMail/WebClients.git
synced 2026-01-16 23:12:49 +00:00
Merge branch 'VPNBE-1767-sort-gateway-users-popup' into 'main'
[VPNBE-1767] Sort users in gateway popup list See merge request web/clients!21692
This commit is contained in:
commit
7e81d52d0e
1 changed files with 9 additions and 1 deletions
|
|
@ -18,6 +18,14 @@ export const getSuffix = (name: string | undefined) => name?.match(/#\d+$/)?.[0]
|
|||
|
||||
const locations: Record<string, GatewayLocation> = {};
|
||||
|
||||
const sortGatewayUsers = (a: GatewayUser, b: GatewayUser): number => {
|
||||
if (!a.Name || !b.Name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return a.Name.localeCompare(b.Name);
|
||||
};
|
||||
|
||||
const getAverageLoad = (servers: GatewayServer[]) =>
|
||||
servers.reduce((load, server) => load + server.Load, 0) / servers.length;
|
||||
|
||||
|
|
@ -95,7 +103,7 @@ const GroupItem = ({ group, keyPrefix, id }: GroupItemProps) => {
|
|||
</DropdownButton>
|
||||
|
||||
<Dropdown isOpen={isOpen} anchorRef={anchorRef} onClose={close}>
|
||||
{group?.Users.map((user) => (
|
||||
{group?.Users.sort(sortGatewayUsers).map((user) => (
|
||||
<div
|
||||
key={`logical-users-${keyPrefix}-${id}-${(user as any).UserID}`}
|
||||
className="flex items-center gap-1 py-2 px-4"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue