mirror of
https://github.com/bitwarden/browser
synced 2026-02-02 09:43:29 +00:00
Removed obsolete code
This commit is contained in:
@@ -376,18 +376,9 @@
|
||||
"selectCriticalApplicationsDescription": {
|
||||
"message": "Select which applications are most critical to your organization, then assign security tasks to members to resolve risks."
|
||||
},
|
||||
"atRiskItems": {
|
||||
"message": "At-risk items"
|
||||
},
|
||||
"clickIconToMarkAppAsCritical": {
|
||||
"message": "Click the star icon to mark an app as critical"
|
||||
},
|
||||
"totalItems": {
|
||||
"message": "Total items"
|
||||
},
|
||||
"membersAffected": {
|
||||
"message": "Members affected"
|
||||
},
|
||||
"markAsCriticalPlaceholder": {
|
||||
"message": "Mark as critical functionality will be implemented in a future update"
|
||||
},
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
<div class="tw-flex tw-flex-col tw-gap-6">
|
||||
<!-- Two-column layout: Left panel (stats) and Right panel (browser extension mockup) -->
|
||||
<div class="tw-flex tw-flex-col md:tw-flex-row tw-gap-6">
|
||||
<!-- Left Panel -->
|
||||
<div class="tw-flex tw-flex-col tw-gap-4 tw-flex-1">
|
||||
<!-- Task Summary Info Card -->
|
||||
<div
|
||||
class="tw-flex tw-flex-col tw-p-6 tw-box-border tw-bg-secondary-100 tw-text-main tw-border-solid tw-border tw-border-secondary-300 tw-rounded-lg"
|
||||
>
|
||||
<div class="tw-flex tw-items-center tw-mb-3">
|
||||
<i class="bwi bwi-info-circle tw-text-primary-600 tw-mr-2" aria-hidden="true"></i>
|
||||
<span bitTypography="h6" class="tw-font-semibold">{{ "taskSummary" | i18n }}</span>
|
||||
</div>
|
||||
|
||||
<div bitTypography="body1" class="tw-text-main">
|
||||
<strong>{{ criticalAppsAtRiskMemberCount }}</strong>
|
||||
{{ "membersWithAtRiskPasswords" | i18n }}
|
||||
for
|
||||
<strong>{{ selectedApplicationsCount() }}</strong>
|
||||
{{ "criticalApplications" | i18n }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stat Box: Members with At-Risk Passwords -->
|
||||
<div class="tw-flex tw-items-start tw-gap-3">
|
||||
<bit-icon-tile
|
||||
icon="bwi-users"
|
||||
variant="primary"
|
||||
size="large"
|
||||
aria-label=""
|
||||
></bit-icon-tile>
|
||||
<div class="tw-flex tw-flex-col">
|
||||
<span bitTypography="h2" class="tw-font-bold tw-mb-1">
|
||||
{{ criticalAppsAtRiskMemberCount }}
|
||||
</span>
|
||||
<span bitTypography="body2" class="tw-text-muted">
|
||||
{{ "membersWithAtRiskPasswords" | i18n }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stat Box: Critical Applications At-Risk -->
|
||||
<div class="tw-flex tw-items-start tw-gap-3">
|
||||
<bit-icon-tile
|
||||
icon="bwi-desktop"
|
||||
variant="warning"
|
||||
size="large"
|
||||
aria-label=""
|
||||
></bit-icon-tile>
|
||||
<div class="tw-flex tw-flex-col">
|
||||
<div class="tw-flex tw-items-baseline tw-gap-2 tw-mb-1">
|
||||
<span bitTypography="h2" class="tw-font-bold tw-text-main">
|
||||
{{ selectedApplicationsCount() }}
|
||||
</span>
|
||||
<span bitTypography="body1" class="tw-text-muted">
|
||||
of {{ totalApplicationsCount }} total
|
||||
</span>
|
||||
</div>
|
||||
<span bitTypography="body2" class="tw-text-muted">
|
||||
{{ "criticalApplications" | i18n }} at-risk
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right Panel: Browser Extension Mockup -->
|
||||
<div class="tw-flex tw-flex-col tw-gap-4 tw-flex-1">
|
||||
<!-- Browser Extension Mockup -->
|
||||
<div
|
||||
class="tw-relative tw-bg-secondary-100 tw-rounded-lg tw-p-4 tw-border tw-border-secondary-300"
|
||||
>
|
||||
<!-- Browser Window Mockup -->
|
||||
<div class="tw-bg-background tw-rounded tw-shadow-md tw-overflow-hidden">
|
||||
<!-- Browser Top Bar -->
|
||||
<div
|
||||
class="tw-flex tw-items-center tw-gap-2 tw-bg-secondary-100 tw-px-3 tw-py-2 tw-border-b tw-border-secondary-300"
|
||||
>
|
||||
<div class="tw-flex tw-gap-1">
|
||||
<div class="tw-size-3 tw-rounded-full tw-bg-secondary-300"></div>
|
||||
<div class="tw-size-3 tw-rounded-full tw-bg-secondary-300"></div>
|
||||
<div class="tw-size-3 tw-rounded-full tw-bg-secondary-300"></div>
|
||||
</div>
|
||||
<div
|
||||
class="tw-flex-1 tw-bg-background tw-rounded tw-px-2 tw-py-1 tw-text-xs tw-text-muted tw-border tw-border-secondary-300"
|
||||
>
|
||||
example.com
|
||||
</div>
|
||||
<div class="tw-size-4 tw-bg-secondary-300 tw-rounded"></div>
|
||||
</div>
|
||||
|
||||
<!-- Browser Content Area -->
|
||||
<div class="tw-p-4 tw-bg-primary-100 tw-min-h-[200px] tw-relative">
|
||||
<!-- Extension Popup Mockup -->
|
||||
<div
|
||||
class="tw-absolute tw-top-4 tw-right-4 tw-w-64 tw-bg-background tw-rounded-lg tw-shadow-lg tw-border tw-border-secondary-300 tw-p-4"
|
||||
>
|
||||
<!-- Extension Items -->
|
||||
<div class="tw-space-y-3 tw-mb-4">
|
||||
<div class="tw-flex tw-items-center tw-gap-2">
|
||||
<div class="tw-size-6 tw-bg-secondary-300 tw-rounded"></div>
|
||||
<div class="tw-flex-1 tw-h-2 tw-bg-secondary-300 tw-rounded"></div>
|
||||
<button
|
||||
type="button"
|
||||
class="tw-text-xs tw-px-2 tw-py-1 tw-bg-secondary-100 tw-rounded tw-text-main"
|
||||
>
|
||||
{{ "change" | i18n }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="tw-flex tw-items-center tw-gap-2">
|
||||
<div class="tw-size-6 tw-bg-secondary-300 tw-rounded"></div>
|
||||
<div class="tw-flex-1 tw-h-2 tw-bg-secondary-300 tw-rounded"></div>
|
||||
<button
|
||||
type="button"
|
||||
class="tw-text-xs tw-px-2 tw-py-1 tw-bg-secondary-100 tw-rounded tw-text-main"
|
||||
>
|
||||
{{ "change" | i18n }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="tw-flex tw-items-center tw-gap-2">
|
||||
<div class="tw-size-6 tw-bg-secondary-300 tw-rounded"></div>
|
||||
<div class="tw-flex-1 tw-h-2 tw-bg-secondary-300 tw-rounded"></div>
|
||||
<button
|
||||
type="button"
|
||||
class="tw-text-xs tw-px-2 tw-py-1 tw-bg-secondary-100 tw-rounded tw-text-main"
|
||||
>
|
||||
{{ "change" | i18n }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Review Section -->
|
||||
<div class="tw-mb-4">
|
||||
<div class="tw-h-3 tw-bg-secondary-300 tw-rounded tw-mb-2 tw-w-3/4"></div>
|
||||
<div class="tw-h-2 tw-bg-secondary-300 tw-rounded tw-w-full tw-mb-1"></div>
|
||||
<div class="tw-h-2 tw-bg-secondary-300 tw-rounded tw-w-5/6"></div>
|
||||
</div>
|
||||
|
||||
<!-- Pagination Dots -->
|
||||
<div class="tw-flex tw-justify-center tw-gap-1 tw-mb-3">
|
||||
<div class="tw-size-1.5 tw-rounded-full tw-bg-primary-600"></div>
|
||||
<div class="tw-size-1.5 tw-rounded-full tw-bg-secondary-300"></div>
|
||||
<div class="tw-size-1.5 tw-rounded-full tw-bg-secondary-300"></div>
|
||||
</div>
|
||||
|
||||
<!-- Review Button -->
|
||||
<button
|
||||
type="button"
|
||||
class="tw-w-full tw-py-2 tw-bg-primary-600 tw-text-contrast tw-rounded tw-text-sm tw-font-semibold"
|
||||
>
|
||||
{{ "reviewAtRiskPasswords" | i18n }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Mouse Cursor Mockup -->
|
||||
<div
|
||||
class="tw-absolute tw-top-8 tw-right-16 tw-size-4 tw-border-2 tw-border-text-main tw-bg-background"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Description Text -->
|
||||
<div bitTypography="body2" class="tw-text-muted">
|
||||
{{ "membersWillReceiveNotification" | i18n }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer: Action Buttons -->
|
||||
<div class="tw-flex tw-gap-2 tw-pt-4 tw-pb-2">
|
||||
<button
|
||||
type="button"
|
||||
bitButton
|
||||
size="small"
|
||||
buttonType="primary"
|
||||
(click)="onAssignTasks()"
|
||||
[disabled]="isAssigning"
|
||||
[loading]="isAssigning"
|
||||
[attr.aria-label]="'assignTasks' | i18n"
|
||||
>
|
||||
{{ "assignTasks" | i18n }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
bitButton
|
||||
size="small"
|
||||
buttonType="secondary"
|
||||
(click)="onBack()"
|
||||
[disabled]="isAssigning"
|
||||
[attr.aria-label]="'back' | i18n"
|
||||
>
|
||||
{{ "back" | i18n }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,134 +0,0 @@
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, OnInit, inject, input, output } from "@angular/core";
|
||||
import { firstValueFrom } from "rxjs";
|
||||
|
||||
import { AllActivitiesService } from "@bitwarden/bit-common/dirt/reports/risk-insights";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { OrganizationId } from "@bitwarden/common/types/guid";
|
||||
import {
|
||||
ButtonModule,
|
||||
IconTileComponent,
|
||||
ToastService,
|
||||
TypographyModule,
|
||||
} from "@bitwarden/components";
|
||||
import { I18nPipe } from "@bitwarden/ui-common";
|
||||
|
||||
import { DefaultAdminTaskService } from "../../../vault/services/default-admin-task.service";
|
||||
import { AccessIntelligenceSecurityTasksService } from "../shared/security-tasks.service";
|
||||
|
||||
/**
|
||||
* Embedded component for displaying task assignment UI.
|
||||
* Not a dialog - intended to be embedded within a parent dialog.
|
||||
*
|
||||
* Important: This component provides its own instances of AccessIntelligenceSecurityTasksService
|
||||
* and DefaultAdminTaskService. These services are scoped to this component to ensure proper
|
||||
* dependency injection when the component is dynamically rendered within the structure.
|
||||
* Without these providers, Angular would throw NullInjectorError when trying to inject
|
||||
* DefaultAdminTaskService, which is required by AccessIntelligenceSecurityTasksService.
|
||||
*/
|
||||
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
|
||||
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
|
||||
@Component({
|
||||
selector: "dirt-assign-tasks-view",
|
||||
templateUrl: "./assign-tasks-view.component.html",
|
||||
imports: [CommonModule, ButtonModule, TypographyModule, I18nPipe, IconTileComponent],
|
||||
providers: [AccessIntelligenceSecurityTasksService, DefaultAdminTaskService],
|
||||
})
|
||||
export class AssignTasksViewComponent implements OnInit {
|
||||
/**
|
||||
* Number of applications selected as critical
|
||||
*/
|
||||
readonly selectedApplicationsCount = input.required<number>();
|
||||
|
||||
/**
|
||||
* Organization ID - passed from parent instead of reading from route
|
||||
* because this component is embedded in a dialog and doesn't have direct route access
|
||||
*/
|
||||
readonly organizationId = input.required<OrganizationId>();
|
||||
|
||||
/**
|
||||
* Emitted when tasks have been successfully assigned
|
||||
*/
|
||||
readonly tasksAssigned = output<void>();
|
||||
|
||||
/**
|
||||
* Emitted when user clicks Back button
|
||||
*/
|
||||
readonly back = output<void>();
|
||||
|
||||
protected criticalAppsAtRiskMemberCount = 0;
|
||||
protected totalApplicationsCount = 0;
|
||||
protected isAssigning = false;
|
||||
|
||||
private allActivitiesService = inject(AllActivitiesService);
|
||||
private accessIntelligenceSecurityTasksService = inject(AccessIntelligenceSecurityTasksService);
|
||||
private toastService = inject(ToastService);
|
||||
private i18nService = inject(I18nService);
|
||||
private logService = inject(LogService);
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
// Get unique members with at-risk passwords and total applications from report summary
|
||||
// Uses the same pattern as all-activity.component.ts
|
||||
await this.loadReportSummary();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the count of unique members with at-risk passwords and total applications.
|
||||
* Uses the same pattern as all-activity.component.ts
|
||||
*/
|
||||
private async loadReportSummary(): Promise<void> {
|
||||
try {
|
||||
const summary = await firstValueFrom(this.allActivitiesService.reportSummary$);
|
||||
this.criticalAppsAtRiskMemberCount = summary.totalCriticalAtRiskMemberCount;
|
||||
this.totalApplicationsCount = summary.totalApplicationCount;
|
||||
} catch (error) {
|
||||
this.logService.error("[AssignTasksView] Failed to load report summary", error);
|
||||
this.criticalAppsAtRiskMemberCount = 0;
|
||||
this.totalApplicationsCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the assign tasks button click
|
||||
*/
|
||||
protected onAssignTasks = async () => {
|
||||
if (this.isAssigning) {
|
||||
return; // Prevent double-click
|
||||
}
|
||||
|
||||
this.isAssigning = true;
|
||||
|
||||
try {
|
||||
// Get critical applications details
|
||||
const allApplicationsDetails = await firstValueFrom(
|
||||
this.allActivitiesService.allApplicationsDetails$,
|
||||
);
|
||||
|
||||
// Filter to only critical apps
|
||||
const criticalApps = allApplicationsDetails.filter((app) => app.isMarkedAsCritical);
|
||||
|
||||
// Assign tasks using the security tasks service
|
||||
// Uses the same logic as password-change-metric.component.ts
|
||||
await this.accessIntelligenceSecurityTasksService.assignTasks(
|
||||
this.organizationId(),
|
||||
criticalApps,
|
||||
);
|
||||
|
||||
// Success toast is shown by the service
|
||||
// Emit success event to parent
|
||||
this.tasksAssigned.emit();
|
||||
} catch (error) {
|
||||
this.logService.error("[AssignTasksView] Failed to assign tasks", error);
|
||||
// Error toast is shown by the service
|
||||
this.isAssigning = false; // Re-enable button on error
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles the back button click
|
||||
*/
|
||||
protected onBack = () => {
|
||||
this.back.emit();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user