1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

PM-15090 - unmark-critical-app (#13015)

This commit is contained in:
Vijay Oommen
2025-01-23 14:19:56 -06:00
committed by GitHub
parent 8a2aa1eac2
commit 9d83484ec4
9 changed files with 203 additions and 24 deletions

View File

@@ -15,12 +15,15 @@ import {
ApplicationHealthReportDetailWithCriticalFlag,
ApplicationHealthReportSummary,
} from "@bitwarden/bit-common/tools/reports/risk-insights/models/password-health";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { OrganizationId } from "@bitwarden/common/types/guid";
import {
DialogService,
Icons,
NoItemsModule,
SearchModule,
TableDataSource,
ToastService,
} from "@bitwarden/components";
import { CardComponent } from "@bitwarden/tools-card";
import { HeaderModule } from "@bitwarden/web-vault/app/layouts/header/header.module";
@@ -37,6 +40,7 @@ import { RiskInsightsTabType } from "./risk-insights.component";
selector: "tools-critical-applications",
templateUrl: "./critical-applications.component.html",
imports: [CardComponent, HeaderModule, SearchModule, NoItemsModule, PipesModule, SharedModule],
providers: [],
})
export class CriticalApplicationsComponent implements OnInit {
protected dataSource = new TableDataSource<ApplicationHealthReportDetailWithCriticalFlag>();
@@ -80,13 +84,38 @@ export class CriticalApplicationsComponent implements OnInit {
});
};
unmarkAsCriticalApp = async (hostname: string) => {
try {
await this.criticalAppsService.dropCriticalApp(
this.organizationId as OrganizationId,
hostname,
);
} catch {
this.toastService.showToast({
message: this.i18nService.t("unexpectedError"),
variant: "error",
title: this.i18nService.t("error"),
});
return;
}
this.toastService.showToast({
message: this.i18nService.t("criticalApplicationSuccessfullyUnmarked"),
variant: "success",
title: this.i18nService.t("success"),
});
this.dataSource.data = this.dataSource.data.filter((app) => app.applicationName !== hostname);
};
constructor(
protected activatedRoute: ActivatedRoute,
protected router: Router,
protected toastService: ToastService,
protected dataService: RiskInsightsDataService,
protected criticalAppsService: CriticalAppsService,
protected reportService: RiskInsightsReportService,
protected dialogService: DialogService,
protected i18nService: I18nService,
) {
this.searchControl.valueChanges
.pipe(debounceTime(200), takeUntilDestroyed())