mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PS-1843] Sort organizations in buildOrganizations (#4015)
* Sort organizations in buildOrganizations * Add sort by name to Organization Switcher
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { Component, Input, OnInit } from "@angular/core";
|
||||
import { Observable } from "rxjs";
|
||||
import { map, Observable } from "rxjs";
|
||||
|
||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import {
|
||||
canAccessAdmin,
|
||||
OrganizationService,
|
||||
} from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
||||
import { Utils } from "@bitwarden/common/misc/utils";
|
||||
import { Organization } from "@bitwarden/common/models/domain/organization";
|
||||
|
||||
@Component({
|
||||
@@ -22,7 +23,8 @@ export class OrganizationSwitcherComponent implements OnInit {
|
||||
|
||||
async ngOnInit() {
|
||||
this.organizations$ = this.organizationService.organizations$.pipe(
|
||||
canAccessAdmin(this.i18nService)
|
||||
canAccessAdmin(this.i18nService),
|
||||
map((orgs) => orgs.sort(Utils.getSortFunction(this.i18nService, "name")))
|
||||
);
|
||||
|
||||
this.loaded = true;
|
||||
|
||||
Reference in New Issue
Block a user