@ -33,6 +33,7 @@ import {
@@ -33,6 +33,7 @@ import {
} from "@bitwarden/components" ;
import { I18nPipe } from "@bitwarden/ui-common" ;
import { CipherIcon } from "../../shared/app-table-row-scrollable.component" ;
import { AccessIntelligenceSecurityTasksService } from "../../shared/security-tasks.service" ;
import { AssignTasksViewComponent } from "./assign-tasks-view.component" ;
@ -99,6 +100,16 @@ export class NewApplicationsDialogComponent {
@@ -99,6 +100,16 @@ export class NewApplicationsDialogComponent {
// Applications selected to save as critical applications
protected readonly selectedApplications = signal < Set < string > > ( new Set ( ) ) ;
protected readonly applicationIcons = signal < Map < string , CipherIcon > > (
new Map < string , CipherIcon > ( ) ,
) ;
protected readonly applicationsWithIcons = computed ( ( ) = > {
return this . dialogParams . newApplications . map ( ( app ) = > {
const iconCipher = this . applicationIcons ( ) . get ( app . applicationName ) ;
return { . . . app , iconCipher } as ApplicationHealthReportDetail & { iconCipher : CipherIcon } ;
} ) ;
} ) ;
// Used to determine if there are unassigned at-risk cipher IDs
private readonly _tasks ! : Signal < SecurityTask [ ] > ;
@ -150,6 +161,7 @@ export class NewApplicationsDialogComponent {
@@ -150,6 +161,7 @@ export class NewApplicationsDialogComponent {
private securityTasksService : AccessIntelligenceSecurityTasksService ,
private toastService : ToastService ,
) {
this . setApplicationIconMap ( this . dialogParams . newApplications ) ;
// Setup the _tasks signal by manually passing in the injector
this . _tasks = toSignal ( this . securityTasksService . tasks $ , {
initialValue : [ ] ,
@ -172,10 +184,6 @@ export class NewApplicationsDialogComponent {
@@ -172,10 +184,6 @@ export class NewApplicationsDialogComponent {
) ;
}
getApplications() {
return this . dialogParams . newApplications ;
}
/ * *
* Returns true if the organization has no existing critical applications .
* Used to conditionally show different titles and descriptions .
@ -184,6 +192,22 @@ export class NewApplicationsDialogComponent {
@@ -184,6 +192,22 @@ export class NewApplicationsDialogComponent {
return ! this . dialogParams . hasExistingCriticalApplications ;
}
/ * *
* Maps applications to a corresponding iconCipher
*
* @param applications
* /
setApplicationIconMap ( applications : ApplicationHealthReportDetail [ ] ) {
// Map the report data to include the iconCipher for each application
const iconCiphers = new Map < string , CipherIcon > ( ) ;
applications . forEach ( ( app ) = > {
const iconCipher =
app . cipherIds . length > 0 ? this . dataService . getCipherIcon ( app . cipherIds [ 0 ] ) : undefined ;
iconCiphers . set ( app . applicationName , iconCipher ) ;
} ) ;
this . applicationIcons . set ( iconCiphers ) ;
}
/ * *
* Toggles the selection state of an application .
* @param applicationName The application to toggle