mirror of
https://github.com/bitwarden/browser
synced 2026-02-11 22:13:32 +00:00
fix types
This commit is contained in:
@@ -2,7 +2,7 @@ import { Component, DestroyRef, OnDestroy, OnInit, inject } from "@angular/core"
|
||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||
import { FormControl } from "@angular/forms";
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { debounceTime, map, Observable, Subscription } from "rxjs";
|
||||
import { debounceTime, map, Observable, of, Subscription } from "rxjs";
|
||||
|
||||
import {
|
||||
RiskInsightsDataService,
|
||||
@@ -52,14 +52,14 @@ export class AllApplicationsComponent implements OnInit, OnDestroy {
|
||||
protected selectedIds: Set<number> = new Set<number>();
|
||||
protected searchControl = new FormControl("", { nonNullable: true });
|
||||
protected loading = true;
|
||||
protected organization: Organization;
|
||||
protected organization = {} as Organization;
|
||||
noItemsIcon = Icons.Security;
|
||||
protected markingAsCritical = false;
|
||||
protected applicationSummary: ApplicationHealthReportSummary;
|
||||
private subscription: Subscription;
|
||||
protected applicationSummary = {} as ApplicationHealthReportSummary;
|
||||
private subscription = new Subscription();
|
||||
|
||||
destroyRef = inject(DestroyRef);
|
||||
isLoading$: Observable<boolean>;
|
||||
isLoading$: Observable<boolean> = of(false);
|
||||
isCriticalAppsFeatureEnabled = false;
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -110,7 +110,7 @@ export class AllApplicationsComponent implements OnInit, OnDestroy {
|
||||
// TODO: implement
|
||||
this.toastService.showToast({
|
||||
variant: "warning",
|
||||
title: null,
|
||||
title: "",
|
||||
message: "Not yet implemented",
|
||||
});
|
||||
};
|
||||
@@ -123,7 +123,7 @@ export class AllApplicationsComponent implements OnInit, OnDestroy {
|
||||
this.selectedIds.clear();
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
title: "",
|
||||
message: this.i18nService.t("appsMarkedAsCritical"),
|
||||
});
|
||||
resolve(true);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { CommonModule } from "@angular/common";
|
||||
import { Component, DestroyRef, OnInit, inject } from "@angular/core";
|
||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { Observable } from "rxjs";
|
||||
import { Observable, EMPTY } from "rxjs";
|
||||
import { map, switchMap } from "rxjs/operators";
|
||||
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
@@ -47,25 +47,25 @@ export enum RiskInsightsTabType {
|
||||
NotifiedMembersTableComponent,
|
||||
TabsModule,
|
||||
],
|
||||
providers: [RiskInsightsReportService, RiskInsightsDataService, MemberCipherDetailsApiService],
|
||||
providers: [RiskInsightsReportService, MemberCipherDetailsApiService],
|
||||
})
|
||||
export class RiskInsightsComponent implements OnInit {
|
||||
tabIndex: RiskInsightsTabType = RiskInsightsTabType.AllApps;
|
||||
|
||||
dataLastUpdated = new Date();
|
||||
dataLastUpdated: Date = new Date();
|
||||
|
||||
isCriticalAppsFeatureEnabled = false;
|
||||
isCriticalAppsFeatureEnabled: boolean = false;
|
||||
|
||||
appsCount = 0;
|
||||
criticalAppsCount = 0;
|
||||
notifiedMembersCount = 0;
|
||||
appsCount: number = 0;
|
||||
criticalAppsCount: number = 0;
|
||||
notifiedMembersCount: number = 0;
|
||||
|
||||
private organizationId: string;
|
||||
private organizationId: string | null = null;
|
||||
private destroyRef = inject(DestroyRef);
|
||||
isLoading$: Observable<boolean>;
|
||||
isRefreshing$: Observable<boolean>;
|
||||
dataLastUpdated$: Observable<Date>;
|
||||
refetching = false;
|
||||
isLoading$: Observable<boolean> = new Observable<boolean>();
|
||||
isRefreshing$: Observable<boolean> = new Observable<boolean>();
|
||||
dataLastUpdated$: Observable<Date | null> = new Observable<Date | null>();
|
||||
refetching: boolean = false;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
@@ -87,7 +87,7 @@ export class RiskInsightsComponent implements OnInit {
|
||||
.pipe(
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
map((params) => params.get("organizationId")),
|
||||
switchMap((orgId) => {
|
||||
switchMap((orgId: string | null) => {
|
||||
if (orgId) {
|
||||
this.organizationId = orgId;
|
||||
this.dataService.fetchApplicationsReport(orgId);
|
||||
@@ -95,6 +95,8 @@ export class RiskInsightsComponent implements OnInit {
|
||||
this.isRefreshing$ = this.dataService.isRefreshing$;
|
||||
this.dataLastUpdated$ = this.dataService.dataLastUpdated$;
|
||||
return this.dataService.applications$;
|
||||
} else {
|
||||
return EMPTY; // Ensures switchMap always returns an Observable
|
||||
}
|
||||
}),
|
||||
)
|
||||
@@ -102,6 +104,7 @@ export class RiskInsightsComponent implements OnInit {
|
||||
next: (applications: ApplicationHealthReportDetail[] | null) => {
|
||||
if (applications) {
|
||||
this.appsCount = applications.length;
|
||||
// Optionally, you can calculate other counts here or in child components
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user