1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 02:03:39 +00:00

[AC-2444] Add deep links to unassigned items banner (#8720)

* Add link to Admin Console
* update date on self-hosted banner
This commit is contained in:
Thomas Rittson
2024-04-18 03:00:00 +10:00
committed by GitHub
parent c045558312
commit e448168002
6 changed files with 90 additions and 16 deletions

View File

@@ -1,6 +1,10 @@
import { Injectable } from "@angular/core";
import { concatMap, map } from "rxjs";
import { combineLatest, concatMap, map, startWith } from "rxjs";
import {
OrganizationService,
canAccessOrgAdmin,
} from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import {
EnvironmentService,
Region,
@@ -40,18 +44,41 @@ export class UnassignedItemsBannerService {
}),
);
private adminConsoleOrg$ = this.organizationService.organizations$.pipe(
map((orgs) => orgs.find((o) => canAccessOrgAdmin(o))),
);
adminConsoleUrl$ = combineLatest([
this.adminConsoleOrg$,
this.environmentService.environment$,
]).pipe(
map(([org, environment]) => {
if (org == null || environment == null) {
return "#";
}
return environment.getWebVaultUrl() + "/#/organizations/" + org.id;
}),
);
bannerText$ = this.environmentService.environment$.pipe(
map((e) =>
e?.getRegion() == Region.SelfHosted
? "unassignedItemsBannerSelfHost"
: "unassignedItemsBanner",
? "unassignedItemsBannerSelfHostNotice"
: "unassignedItemsBannerNotice",
),
);
loading$ = combineLatest([this.adminConsoleUrl$, this.bannerText$]).pipe(
startWith(true),
map(() => false),
);
constructor(
private stateProvider: StateProvider,
private apiService: UnassignedItemsBannerApiService,
private environmentService: EnvironmentService,
private organizationService: OrganizationService,
) {}
async hideBanner() {