From bfae0eb41e3bb7055bf64fc250cca14f5284526a Mon Sep 17 00:00:00 2001 From: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com> Date: Fri, 14 Jul 2023 11:56:14 -0500 Subject: [PATCH] Sort access policy rows (#5802) --- .../access-policies/access-selector.component.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/shared/access-policies/access-selector.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/shared/access-policies/access-selector.component.ts index 942d14df48..a5b4f4b05d 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/shared/access-policies/access-selector.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/shared/access-policies/access-selector.component.ts @@ -57,7 +57,16 @@ export class AccessSelectorComponent implements OnInit { protected rows$ = new Subject(); @Input() private set rows(value: AccessSelectorRowView[]) { - this.rows$.next(value); + const sorted = value.sort((a, b) => { + if (a.icon == b.icon) { + return a.name.localeCompare(b.name); + } + if (a.icon == AccessSelectorComponent.userIcon) { + return -1; + } + return 1; + }); + this.rows$.next(sorted); } private maxLength = 15;