Skip to content

Commit

Permalink
PM-15070 use SkipWhile
Browse files Browse the repository at this point in the history
  • Loading branch information
voommen-livefront committed Jan 15, 2025
1 parent cbcb44d commit 6ffe26a
Showing 1 changed file with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Component, DestroyRef, inject, OnInit } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { FormControl } from "@angular/forms";
import { ActivatedRoute } from "@angular/router";
import { combineLatest, debounceTime, map, Observable, of, Subscription } from "rxjs";
import { combineLatest, debounceTime, map, Observable, of, skipWhile, Subscription } from "rxjs";

Check warning on line 7 in bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts#L7

Added line #L7 was not covered by tests

import {
CriticalAppsService,
Expand Down Expand Up @@ -74,32 +74,28 @@ export class AllApplicationsComponent implements OnInit {
FeatureFlag.CriticalApps,
);

const organizationId =
(this.activatedRoute.snapshot.paramMap.get("organizationId") as string) ?? "";

const organizationId = this.activatedRoute.snapshot.paramMap.get("organizationId") ?? "";
combineLatest([

Check warning on line 78 in bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts#L78

Added line #L78 was not covered by tests
this.dataService.applications$,
this.criticalAppsService.getAppsListForOrg(organizationId),
this.organizationService.get$(organizationId),
])
.pipe(
takeUntilDestroyed(this.destroyRef),
skipWhile(([_, __, organization]) => !organization),

Check warning on line 85 in bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts#L85

Added line #L85 was not covered by tests
map(([applications, criticalApps, organization]) => {
const criticalUrls = criticalApps.map((ca) => ca.uri);

Check warning on line 87 in bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts#L87

Added line #L87 was not covered by tests
const data = applications?.map((app) => ({
...app,
isMarkedAsCritical: criticalUrls.includes(app.applicationName),
})) as ApplicationHealthReportDetailWithCriticalFlag[];
const org = (organization ?? {}) as Organization;
return { data, org };
return { data, organization };

Check warning on line 92 in bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts#L92

Added line #L92 was not covered by tests
}),
)
.subscribe(({ data, org }) => {
if (data) {
this.dataSource.data = data ?? [];
this.applicationSummary = this.reportService.generateApplicationsSummary(data ?? []);
this.organization = org;
}
.subscribe(({ data, organization }) => {
this.dataSource.data = data ?? [];
this.applicationSummary = this.reportService.generateApplicationsSummary(data ?? []);
this.organization = organization;

Check warning on line 98 in bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts#L98

Added line #L98 was not covered by tests
});

this.isLoading$ = this.dataService.isLoading$;

Check warning on line 101 in bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.ts#L101

Added line #L101 was not covered by tests
Expand Down

0 comments on commit 6ffe26a

Please sign in to comment.