1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 22:03:36 +00:00

[PM-27688] fix events page not loading (#17166)

* remove unneeded rxjs filter

* add check for canManage

* add null check

* fix provider ID, clean up
This commit is contained in:
Brandon Treston
2025-10-31 16:35:59 -04:00
committed by GitHub
parent 98622a3f73
commit 2da0b48c3d

View File

@@ -2,7 +2,7 @@
// @ts-strict-ignore // @ts-strict-ignore
import { Component, OnDestroy, OnInit } from "@angular/core"; import { Component, OnDestroy, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { concatMap, firstValueFrom, lastValueFrom, map, switchMap, takeUntil } from "rxjs"; import { concatMap, firstValueFrom, lastValueFrom, map, of, switchMap, takeUntil, tap } from "rxjs";
import { OrganizationUserApiService } from "@bitwarden/admin-console/common"; import { OrganizationUserApiService } from "@bitwarden/admin-console/common";
import { UserNamePipe } from "@bitwarden/angular/pipes/user-name.pipe"; import { UserNamePipe } from "@bitwarden/angular/pipes/user-name.pipe";
@@ -143,17 +143,24 @@ export class EventsComponent extends BaseEventsComponent implements OnInit, OnDe
getUserId, getUserId,
switchMap((userId) => this.providerService.get$(this.organization.providerId, userId)), switchMap((userId) => this.providerService.get$(this.organization.providerId, userId)),
map((provider) => provider != null && provider.canManageUsers), map((provider) => provider != null && provider.canManageUsers),
switchMap(() => this.apiService.getProviderUsers(this.organization.id)), switchMap((canManage) => {
map((providerUsersResponse) => if (canManage) {
return this.apiService.getProviderUsers(this.organization.providerId);
}
return of(null);
}),
tap((providerUsersResponse) => {
if (providerUsersResponse) {
providerUsersResponse.data.forEach((u) => { providerUsersResponse.data.forEach((u) => {
const name = this.userNamePipe.transform(u); const name = this.userNamePipe.transform(u);
this.orgUsersUserIdMap.set(u.userId, { this.orgUsersUserIdMap.set(u.userId, {
name: `${name} (${this.organization.providerName})`, name: `${name} (${this.organization.providerName})`,
email: u.email, email: u.email,
}); });
});
}
}), }),
), ),
),
); );
} catch (e) { } catch (e) {
this.logService.warning(e); this.logService.warning(e);