Sort access policy rows (#5802)

This commit is contained in:
Thomas Avery 2023-07-14 11:56:14 -05:00 committed by GitHub
parent d26dc9c8ac
commit bfae0eb41e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -57,7 +57,16 @@ export class AccessSelectorComponent implements OnInit {
protected rows$ = new Subject<AccessSelectorRowView[]>();
@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;