Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-14861]Vault items fail to load #11974

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions apps/web/src/app/vault/individual-vault/vault.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from,
lastValueFrom,
Observable,
of,
Subject,
} from "rxjs";
import {
Expand Down Expand Up @@ -184,12 +185,17 @@
private refresh$ = new BehaviorSubject<void>(null);
private destroy$ = new Subject<void>();
private extensionRefreshEnabled: boolean;
private hasSubscription$ = new BehaviorSubject<boolean>(false);

Check warning on line 188 in apps/web/src/app/vault/individual-vault/vault.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/individual-vault/vault.component.ts#L188

Added line #L188 was not covered by tests

private vaultItemDialogRef?: DialogRef<VaultItemDialogResult> | undefined;
private readonly unpaidSubscriptionDialog$ = this.organizationService.organizations$.pipe(
filter((organizations) => organizations.length === 1),
switchMap(([organization]) =>
map(([organization]) => organization),

Check warning on line 193 in apps/web/src/app/vault/individual-vault/vault.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/individual-vault/vault.component.ts#L193

Added line #L193 was not covered by tests
switchMap((organization) =>
from(this.billingApiService.getOrganizationBillingMetadata(organization.id)).pipe(
tap((organizationMetaData) => {
this.hasSubscription$.next(organizationMetaData.hasSubscription);

Check warning on line 197 in apps/web/src/app/vault/individual-vault/vault.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/individual-vault/vault.component.ts#L197

Added line #L197 was not covered by tests
}),
switchMap((organizationMetaData) =>
from(
this.trialFlowService.handleUnpaidSubscriptionDialog(
Expand Down Expand Up @@ -417,11 +423,17 @@

this.unpaidSubscriptionDialog$.pipe(takeUntil(this.destroy$)).subscribe();

const organizationsPaymentStatus$ = this.organizationService.organizations$.pipe(
switchMap((allOrganizations) => {
const organizationsPaymentStatus$ = combineLatest([

Check warning on line 426 in apps/web/src/app/vault/individual-vault/vault.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/individual-vault/vault.component.ts#L426

Added line #L426 was not covered by tests
this.organizationService.organizations$,
this.hasSubscription$,
]).pipe(
switchMap(([allOrganizations, hasSubscription]) => {
if (!allOrganizations || allOrganizations.length === 0 || !hasSubscription) {
return of([]);

Check warning on line 432 in apps/web/src/app/vault/individual-vault/vault.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/individual-vault/vault.component.ts#L432

Added line #L432 was not covered by tests
}
return combineLatest(
allOrganizations
.filter((org) => org.isOwner)
.filter((org) => org.isOwner && hasSubscription)
.map((org) =>
combineLatest([
this.organizationApiService.getSubscription(org.id),
Expand Down
17 changes: 13 additions & 4 deletions apps/web/src/app/vault/org-vault/vault.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
protected selectedCollection: TreeNode<CollectionAdminView> | undefined;
protected isEmpty: boolean;
protected showCollectionAccessRestricted: boolean;
private hasSubscription$ = new BehaviorSubject<boolean>(false);

Check warning on line 181 in apps/web/src/app/vault/org-vault/vault.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/org-vault/vault.component.ts#L181

Added line #L181 was not covered by tests
protected currentSearchText$: Observable<string>;
protected freeTrial$: Observable<FreeTrial>;
/**
Expand All @@ -197,10 +198,15 @@
protected addAccessStatus$ = new BehaviorSubject<AddAccessStatusType>(0);
private extensionRefreshEnabled: boolean;
private vaultItemDialogRef?: DialogRef<VaultItemDialogResult> | undefined;

private readonly unpaidSubscriptionDialog$ = this.organizationService.organizations$.pipe(
filter((organizations) => organizations.length === 1),
switchMap(([organization]) =>
map(([organization]) => organization),

Check warning on line 204 in apps/web/src/app/vault/org-vault/vault.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/org-vault/vault.component.ts#L204

Added line #L204 was not covered by tests
switchMap((organization) =>
from(this.billingApiService.getOrganizationBillingMetadata(organization.id)).pipe(
tap((organizationMetaData) => {
this.hasSubscription$.next(organizationMetaData.hasSubscription);

Check warning on line 208 in apps/web/src/app/vault/org-vault/vault.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/org-vault/vault.component.ts#L208

Added line #L208 was not covered by tests
}),
switchMap((organizationMetaData) =>
from(
this.trialFlowService.handleUnpaidSubscriptionDialog(
Expand Down Expand Up @@ -580,9 +586,12 @@

this.unpaidSubscriptionDialog$.pipe(takeUntil(this.destroy$)).subscribe();

this.freeTrial$ = organization$.pipe(
filter((org) => org.isOwner),
switchMap((org) =>
this.freeTrial$ = combineLatest([

Check warning on line 589 in apps/web/src/app/vault/org-vault/vault.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/org-vault/vault.component.ts#L589

Added line #L589 was not covered by tests
organization$,
this.hasSubscription$.pipe(filter((hasSubscription) => hasSubscription !== null)),

Check warning on line 591 in apps/web/src/app/vault/org-vault/vault.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/org-vault/vault.component.ts#L591

Added line #L591 was not covered by tests
]).pipe(
filter(([org, hasSubscription]) => org.isOwner && hasSubscription),
switchMap(([org]) =>
combineLatest([
of(org),
this.organizationApiService.getSubscription(org.id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
isManaged: boolean;
isOnSecretsManagerStandalone: boolean;
isSubscriptionUnpaid: boolean;
hasSubscription: boolean;

constructor(response: any) {
super(response);
this.isEligibleForSelfHost = this.getResponseProperty("IsEligibleForSelfHost");
this.isManaged = this.getResponseProperty("IsManaged");
this.isOnSecretsManagerStandalone = this.getResponseProperty("IsOnSecretsManagerStandalone");
this.isSubscriptionUnpaid = this.getResponseProperty("IsSubscriptionUnpaid");
this.hasSubscription = this.getResponseProperty("HasSubscription");

Check warning on line 16 in libs/common/src/billing/models/response/organization-billing-metadata.response.ts

View check run for this annotation

Codecov / codecov/patch

libs/common/src/billing/models/response/organization-billing-metadata.response.ts#L16

Added line #L16 was not covered by tests
}
}
Loading