From 950b0419c110628f31b35e2e0b0b49330bacdae1 Mon Sep 17 00:00:00 2001 From: Jonas Hendrickx Date: Wed, 11 Dec 2024 14:01:56 +0100 Subject: [PATCH 1/2] [PM-15840] When org reaches collection limit, organization upgrade page infinitely loads. --- ...ganization-subscription-cloud.component.ts | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts b/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts index 09a4890549b..43954983a9f 100644 --- a/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts +++ b/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts @@ -42,6 +42,9 @@ import { SecretsManagerSubscriptionOptions } from "./sm-adjust-subscription.comp templateUrl: "organization-subscription-cloud.component.html", }) export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy { + public static readonly QUERY_PARAM_UPGRADE: string = "upgrade"; + public static readonly ROUTE_PARAM_ORGANIZATION_ID: string = "organizationId"; + sub: OrganizationSubscriptionResponse; lineItems: BillingSubscriptionItemResponse[] = []; organizationId: string; @@ -82,7 +85,19 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy ) {} async ngOnInit() { - if (this.route.snapshot.queryParamMap.get("upgrade")) { + this.organizationId = + this.route.snapshot.params[ + OrganizationSubscriptionCloudComponent.ROUTE_PARAM_ORGANIZATION_ID + ]; + await this.load(); + + this.showUpdatedSubscriptionStatusSection$ = this.configService.getFeatureFlag$( + FeatureFlag.AC1795_UpdatedSubscriptionStatusSection, + ); + + if ( + this.route.snapshot.queryParams[OrganizationSubscriptionCloudComponent.QUERY_PARAM_UPGRADE] + ) { await this.changePlan(); const productTierTypeStr = this.route.snapshot.queryParamMap.get("productTierType"); if (productTierTypeStr != null) { @@ -92,20 +107,6 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy } } } - - this.route.params - .pipe( - concatMap(async (params) => { - this.organizationId = params.organizationId; - await this.load(); - }), - takeUntil(this.destroy$), - ) - .subscribe(); - - this.showUpdatedSubscriptionStatusSection$ = this.configService.getFeatureFlag$( - FeatureFlag.AC1795_UpdatedSubscriptionStatusSection, - ); } ngOnDestroy() { From 435eedd50ef2f6e6766b2b6c24dfe635b52db74f Mon Sep 17 00:00:00 2001 From: Jonas Hendrickx Date: Wed, 11 Dec 2024 17:13:02 +0100 Subject: [PATCH 2/2] lint --- .../organization-subscription-cloud.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts b/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts index 43954983a9f..0805e92ee2a 100644 --- a/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts +++ b/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts @@ -2,7 +2,7 @@ // @ts-strict-ignore import { Component, OnDestroy, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; -import { concatMap, firstValueFrom, lastValueFrom, Observable, Subject, takeUntil } from "rxjs"; +import { firstValueFrom, lastValueFrom, Observable, Subject } from "rxjs"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; @@ -42,8 +42,8 @@ import { SecretsManagerSubscriptionOptions } from "./sm-adjust-subscription.comp templateUrl: "organization-subscription-cloud.component.html", }) export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy { - public static readonly QUERY_PARAM_UPGRADE: string = "upgrade"; - public static readonly ROUTE_PARAM_ORGANIZATION_ID: string = "organizationId"; + static readonly QUERY_PARAM_UPGRADE: string = "upgrade"; + static readonly ROUTE_PARAM_ORGANIZATION_ID: string = "organizationId"; sub: OrganizationSubscriptionResponse; lineItems: BillingSubscriptionItemResponse[] = [];