diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/clients/clients.component.html b/bitwarden_license/bit-web/src/app/admin-console/providers/clients/clients.component.html index de1db6f0c7a..684b259f632 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/clients/clients.component.html +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/clients/clients.component.html @@ -4,13 +4,32 @@ [formControl]="searchControl" [placeholder]="'search' | i18n" > - + {{ "newClient" | i18n }} + + {{ "newClient" | i18n }} + + diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/clients/clients.component.ts b/bitwarden_license/bit-web/src/app/admin-console/providers/clients/clients.component.ts index 130f1f2c482..b6b681003a4 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/clients/clients.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/clients/clients.component.ts @@ -13,6 +13,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { ProviderService } from "@bitwarden/common/admin-console/abstractions/provider.service"; import { ProviderStatusType, ProviderUserType } from "@bitwarden/common/admin-console/enums"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; +import { Provider } from "@bitwarden/common/admin-console/models/domain/provider"; import { ProviderOrganizationOrganizationDetailsResponse } from "@bitwarden/common/admin-console/models/response/provider/provider-organization.response"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { getUserId } from "@bitwarden/common/auth/services/account.service"; @@ -55,6 +56,7 @@ const DisallowedPlanTypes = [ }) export class ClientsComponent { providerId: string = ""; + provider: Provider | undefined; addableOrganizations: Organization[] = []; loading = true; manageOrganizations = false; @@ -63,6 +65,22 @@ export class ClientsComponent { new TableDataSource(); protected searchControl = new FormControl("", { nonNullable: true }); + // Computed properties for provider suspension state + get isProviderDisabled(): boolean { + return !this.provider?.enabled; + } + + get canAddClients(): boolean { + return this.manageOrganizations && !this.isProviderDisabled; + } + + get addClientTooltip(): string { + if (this.isProviderDisabled) { + return this.i18nService.t("providerIsDisabled"); + } + return ""; + } + constructor( private router: Router, private providerService: ProviderService, @@ -141,8 +159,11 @@ export class ClientsComponent { const userId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId)); const clients = response.data != null && response.data.length > 0 ? response.data : []; this.dataSource.data = clients; - this.manageOrganizations = - (await this.providerService.get(this.providerId)).type === ProviderUserType.ProviderAdmin; + + // Store the provider for disabled state checks + this.provider = await this.providerService.get(this.providerId); + this.manageOrganizations = this.provider.type === ProviderUserType.ProviderAdmin; + const candidateOrgs = ( await firstValueFrom(this.organizationService.organizations$(userId)) ).filter((o) => o.isOwner && o.providerId == null); diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.html b/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.html index 0a084848dbe..fd49227e28d 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.html +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.html @@ -6,6 +6,16 @@ [label]="'providerPortal' | i18n" > + + + + {{ "providerIsDisabled" | i18n }} + + {{ "add" | i18n }} - + {{ newClientButtonLabel }} - + {{ "existingOrganization" | i18n }} @@ -73,14 +87,27 @@ appA11yTitle="{{ 'options' | i18n }}" > - + {{ "updateName" | i18n }} - + {{ "manageSubscription" | i18n }} + {{ "unlinkOrganization" | i18n }} @@ -92,7 +119,7 @@ diff --git a/bitwarden_license/bit-web/src/app/billing/providers/clients/manage-clients.component.ts b/bitwarden_license/bit-web/src/app/billing/providers/clients/manage-clients.component.ts index de9e63cd509..2924c155987 100644 --- a/bitwarden_license/bit-web/src/app/billing/providers/clients/manage-clients.component.ts +++ b/bitwarden_license/bit-web/src/app/billing/providers/clients/manage-clients.component.ts @@ -75,6 +75,44 @@ export class ManageClientsComponent { clientColumnHeader = this.i18nService.t("client"); newClientButtonLabel = this.i18nService.t("newClient"); + // Computed properties for provider suspension state + get isProviderDisabled(): boolean { + return !this.provider?.enabled; + } + + get canAddClients(): boolean { + return this.isProviderAdmin && !this.isProviderDisabled; + } + + get canManageClientNames(): boolean { + return this.isProviderAdmin && !this.isProviderDisabled; + } + + get canManageClientSubscriptions(): boolean { + return this.isProviderAdmin && !this.isProviderDisabled; + } + + get addClientTooltip(): string { + if (this.isProviderDisabled) { + return this.i18nService.t("providerIsDisabled"); + } + return ""; + } + + get manageClientNameTooltip(): string { + if (this.isProviderDisabled) { + return this.i18nService.t("providerIsDisabled"); + } + return ""; + } + + get manageSubscriptionTooltip(): string { + if (this.isProviderDisabled) { + return this.i18nService.t("providerIsDisabled"); + } + return ""; + } + constructor( private billingApiService: BillingApiServiceAbstraction, private providerService: ProviderService,