mirror of
https://github.com/bitwarden/browser
synced 2026-01-30 16:23:53 +00:00
Adds a function to organization.ts to get the icon string. Updates how the icon string is retrieved.
This commit is contained in:
@@ -121,7 +121,7 @@
|
||||
}}"
|
||||
[attr.aria-pressed]="activeFilter.selectedOrganizationId === organization.id"
|
||||
>
|
||||
<i class="bwi bwi-fw {{ getIconString(organization) }}" aria-hidden="true"></i>
|
||||
<i class="bwi bwi-fw {{ organization.getIconString() }}" aria-hidden="true"></i>
|
||||
{{ organization.name }}
|
||||
</button>
|
||||
<span *ngIf="!organization.enabled" class="tw-ml-auto">
|
||||
|
||||
@@ -24,7 +24,6 @@ import { PolicyType } from "@bitwarden/common/admin-console/enums";
|
||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||
import { ProductTierType } from "@bitwarden/common/billing/enums";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { SingleUserState, StateProvider } from "@bitwarden/common/platform/state";
|
||||
import { OrganizationId, UserId } from "@bitwarden/common/types/guid";
|
||||
@@ -186,14 +185,7 @@ export class VaultFilterService implements VaultFilterServiceAbstraction {
|
||||
const orgNodes: TreeNode<OrganizationFilter>[] = [];
|
||||
orgs.forEach((org) => {
|
||||
const orgCopy = org as OrganizationFilter;
|
||||
if (
|
||||
org?.productTierType === ProductTierType.Free ||
|
||||
org?.productTierType === ProductTierType.Families
|
||||
) {
|
||||
orgCopy.icon = "bwi-family";
|
||||
} else {
|
||||
orgCopy.icon = "bwi-business";
|
||||
}
|
||||
orgCopy.icon = org.getIconString();
|
||||
const node = new TreeNode<OrganizationFilter>(orgCopy, headNode, orgCopy.name);
|
||||
orgNodes.push(node);
|
||||
});
|
||||
|
||||
@@ -294,4 +294,54 @@ describe("Organization", () => {
|
||||
expect(organization.canEnableAutoConfirmPolicy).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getIconString", () => {
|
||||
it("should return bwi-family when productTierType is free", () => {
|
||||
data.productTierType = ProductTierType.Free;
|
||||
|
||||
const organization = new Organization(data);
|
||||
|
||||
expect(organization.getIconString()).toBe("bwi-family");
|
||||
});
|
||||
|
||||
it("should return bwi-family when productTierType is families", () => {
|
||||
data.productTierType = ProductTierType.Families;
|
||||
|
||||
const organization = new Organization(data);
|
||||
|
||||
expect(organization.getIconString()).toBe("bwi-family");
|
||||
});
|
||||
|
||||
it("should return bwi-business when productTierType is teams", () => {
|
||||
data.productTierType = ProductTierType.Teams;
|
||||
|
||||
const organization = new Organization(data);
|
||||
|
||||
expect(organization.getIconString()).toBe("bwi-business");
|
||||
});
|
||||
|
||||
it("should return bwi-business when productTierType is enterprise", () => {
|
||||
data.productTierType = ProductTierType.Enterprise;
|
||||
|
||||
const organization = new Organization(data);
|
||||
|
||||
expect(organization.getIconString()).toBe("bwi-business");
|
||||
});
|
||||
|
||||
it("should return bwi-business when productTierType is teamsStarter", () => {
|
||||
data.productTierType = ProductTierType.TeamsStarter;
|
||||
|
||||
const organization = new Organization(data);
|
||||
|
||||
expect(organization.getIconString()).toBe("bwi-business");
|
||||
});
|
||||
|
||||
it("should return bwi-business when productTierType is null", () => {
|
||||
data.productTierType = null;
|
||||
|
||||
const organization = new Organization(data);
|
||||
|
||||
expect(organization.getIconString()).toBe("bwi-business");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -415,4 +415,15 @@ export class Organization {
|
||||
get canUseAccessIntelligence() {
|
||||
return this.productTierType === ProductTierType.Enterprise;
|
||||
}
|
||||
|
||||
getIconString(): string {
|
||||
if (
|
||||
this?.productTierType === ProductTierType.Free ||
|
||||
this?.productTierType === ProductTierType.Families
|
||||
) {
|
||||
return "bwi-family";
|
||||
} else {
|
||||
return "bwi-business";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user