From c05a2a0d078f6267169d109d4a1009f8ba05fc02 Mon Sep 17 00:00:00 2001 From: KiruthigaManivannan <162679756+KiruthigaManivannan@users.noreply.github.com> Date: Tue, 21 May 2024 18:39:58 +0530 Subject: [PATCH] PM -2050 Update Bulk Confirm Dialog (#8723) * PM-2050 Update Bulk Confirm Dialog * PM-2050 Added css classes * PM-2050 Addressed comments --- .../bulk/bulk-confirm.component.html | 210 ++++++++---------- .../components/bulk/bulk-confirm.component.ts | 23 +- .../organizations/members/people.component.ts | 14 +- 3 files changed, 122 insertions(+), 125 deletions(-) diff --git a/apps/web/src/app/admin-console/organizations/members/components/bulk/bulk-confirm.component.html b/apps/web/src/app/admin-console/organizations/members/components/bulk/bulk-confirm.component.html index 7f539f098b..0f420c6903 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/bulk/bulk-confirm.component.html +++ b/apps/web/src/app/admin-console/organizations/members/components/bulk/bulk-confirm.component.html @@ -1,115 +1,99 @@ - +

+ + + + {{ "user" | i18n }} + {{ "fingerprint" | i18n }} + + + + + + + + + {{ user.email }} +

{{ user.name }}

+ + + {{ fingerprints.get(user.id) }} + + + + + + + + {{ user.email }} +

{{ user.name }}

+ + + {{ "bulkFilteredMessage" | i18n }} + + +
+
+ + + + + + {{ "user" | i18n }} + {{ "status" | i18n }} + + + + + + + + + {{ user.email }} +

{{ user.name }}

+ + + {{ statuses.get(user.id) }} + + + {{ "bulkFilteredMessage" | i18n }} + + +
+
+
+ + + + + + diff --git a/apps/web/src/app/admin-console/organizations/members/components/bulk/bulk-confirm.component.ts b/apps/web/src/app/admin-console/organizations/members/components/bulk/bulk-confirm.component.ts index 1d26899017..d94edd55f8 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/bulk/bulk-confirm.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/components/bulk/bulk-confirm.component.ts @@ -1,4 +1,5 @@ -import { Component, Input, OnInit } from "@angular/core"; +import { DIALOG_DATA, DialogConfig } from "@angular/cdk/dialog"; +import { Component, Inject, OnInit } from "@angular/core"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationUserService } from "@bitwarden/common/admin-console/abstractions/organization-user/organization-user.service"; @@ -8,16 +9,22 @@ import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.se import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; +import { DialogService } from "@bitwarden/components"; import { BulkUserDetails } from "./bulk-status.component"; +type BulkConfirmDialogData = { + organizationId: string; + users: BulkUserDetails[]; +}; + @Component({ selector: "app-bulk-confirm", templateUrl: "bulk-confirm.component.html", }) export class BulkConfirmComponent implements OnInit { - @Input() organizationId: string; - @Input() users: BulkUserDetails[]; + organizationId: string; + users: BulkUserDetails[]; excludedUsers: BulkUserDetails[]; filteredUsers: BulkUserDetails[]; @@ -30,11 +37,15 @@ export class BulkConfirmComponent implements OnInit { error: string; constructor( + @Inject(DIALOG_DATA) protected data: BulkConfirmDialogData, protected cryptoService: CryptoService, protected apiService: ApiService, private organizationUserService: OrganizationUserService, private i18nService: I18nService, - ) {} + ) { + this.organizationId = data.organizationId; + this.users = data.users; + } async ngOnInit() { this.excludedUsers = this.users.filter((u) => !this.isAccepted(u)); @@ -110,4 +121,8 @@ export class BulkConfirmComponent implements OnInit { request, ); } + + static open(dialogService: DialogService, config: DialogConfig) { + return dialogService.open(BulkConfirmComponent, config); + } } diff --git a/apps/web/src/app/admin-console/organizations/members/people.component.ts b/apps/web/src/app/admin-console/organizations/members/people.component.ts index af04d83c34..ffdd8554b3 100644 --- a/apps/web/src/app/admin-console/organizations/members/people.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/people.component.ts @@ -558,16 +558,14 @@ export class PeopleComponent extends BasePeopleComponent { return; } - const [modal] = await this.modalService.openViewRef( - BulkConfirmComponent, - this.bulkConfirmModalRef, - (comp) => { - comp.organizationId = this.organization.id; - comp.users = this.getCheckedUsers(); + const dialogRef = BulkConfirmComponent.open(this.dialogService, { + data: { + organizationId: this.organization.id, + users: this.getCheckedUsers(), }, - ); + }); - await modal.onClosedPromise(); + await lastValueFrom(dialogRef.closed); await this.load(); }