From ed0490730076298590421473f95b5391ff51d011 Mon Sep 17 00:00:00 2001 From: Shane Melton Date: Wed, 14 Jun 2023 13:09:56 -0700 Subject: [PATCH] [PM-2049] Update entity events dialog (#5417) * [AC-1145] Update entity-events.component.ts to a CL dialog - Add EntityEventsDialogParams - Add static helper method to open the dialog with the dialog service - Update existing usages of the entity-events.component.ts * [AC-1145] Update entity-events.component.ts to use CL components and form actions - Use bit-table and TableDataSource - Update to reactive form for date filter - Make dialog component standalone - Use bitAction in-place of component promises - Remove redundant try/catch that is now handled by bitAction and bitSubmit - Add new try/catch on first load to catch any errors during initial dialog open * [PM-2049] Make dataSource and filterFormGroup protected * [PM-2049] Remove bit-form-field container Remove the bit-form-field tags that wrapped the date inputs to avoid additional styling that is not applicable to inline form elements. Add back the missing `-` that was removed by mistake. * [PM-2049] Remove entity events dialog component selector --- .../manage/entity-events.component.html | 179 +++++++--------- .../manage/entity-events.component.ts | 191 +++++++++++------- .../members/people.component.html | 1 - .../organizations/members/people.component.ts | 20 +- .../src/app/shared/loose-components.module.ts | 3 - .../app/vault/org-vault/vault.component.html | 1 - .../app/vault/org-vault/vault.component.ts | 18 +- .../providers/manage/people.component.html | 1 - .../providers/manage/people.component.ts | 18 +- 9 files changed, 217 insertions(+), 215 deletions(-) diff --git a/apps/web/src/app/admin-console/organizations/manage/entity-events.component.html b/apps/web/src/app/admin-console/organizations/manage/entity-events.component.html index 85c9d47492..8d8cfad34e 100644 --- a/apps/web/src/app/admin-console/organizations/manage/entity-events.component.html +++ b/apps/web/src/app/admin-console/organizations/manage/entity-events.component.html @@ -1,118 +1,89 @@ - diff --git a/apps/web/src/app/vault/org-vault/vault.component.ts b/apps/web/src/app/vault/org-vault/vault.component.ts index 8048ade1c7..7b6b926e49 100644 --- a/apps/web/src/app/vault/org-vault/vault.component.ts +++ b/apps/web/src/app/vault/org-vault/vault.component.ts @@ -56,7 +56,7 @@ import { CollectionView } from "@bitwarden/common/vault/models/view/collection.v import { Icons } from "@bitwarden/components"; import { GroupService, GroupView } from "../../admin-console/organizations/core"; -import { EntityEventsComponent } from "../../admin-console/organizations/manage/entity-events.component"; +import { openEntityEventsDialog } from "../../admin-console/organizations/manage/entity-events.component"; import { VaultFilterService } from "../../vault/individual-vault/vault-filter/services/abstractions/vault-filter.service"; import { VaultFilter } from "../../vault/individual-vault/vault-filter/shared/models/vault-filter.model"; import { @@ -109,8 +109,6 @@ export class VaultComponent implements OnInit, OnDestroy { cipherAddEditModalRef: ViewContainerRef; @ViewChild("collectionsModal", { read: ViewContainerRef, static: true }) collectionsModalRef: ViewContainerRef; - @ViewChild("eventsTemplate", { read: ViewContainerRef, static: true }) - eventsModalRef: ViewContainerRef; trashCleanupWarning: string = null; activeFilter: VaultFilter = new VaultFilter(); @@ -885,12 +883,14 @@ export class VaultComponent implements OnInit, OnDestroy { } async viewEvents(cipher: CipherView) { - await this.modalService.openViewRef(EntityEventsComponent, this.eventsModalRef, (comp) => { - comp.name = cipher.name; - comp.organizationId = this.organization.id; - comp.entityId = cipher.id; - comp.showUser = true; - comp.entity = "cipher"; + await openEntityEventsDialog(this.dialogService, { + data: { + name: cipher.name, + organizationId: this.organization.id, + entityId: cipher.id, + showUser: true, + entity: "cipher", + }, }); } diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.html b/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.html index 00bf5eda26..152253fe4d 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.html +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.html @@ -209,7 +209,6 @@ - diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.ts b/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.ts index 7c787951d4..304ab346f3 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.ts @@ -21,7 +21,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service" import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; -import { EntityEventsComponent } from "@bitwarden/web-vault/app/admin-console/organizations/manage/entity-events.component"; +import { openEntityEventsDialog } from "@bitwarden/web-vault/app/admin-console/organizations/manage/entity-events.component"; import { BulkStatusComponent } from "@bitwarden/web-vault/app/admin-console/organizations/members/components/bulk/bulk-status.component"; import { BasePeopleComponent } from "@bitwarden/web-vault/app/common/base.people.component"; @@ -41,8 +41,6 @@ export class PeopleComponent @ViewChild("addEdit", { read: ViewContainerRef, static: true }) addEditModalRef: ViewContainerRef; @ViewChild("groupsTemplate", { read: ViewContainerRef, static: true }) groupsModalRef: ViewContainerRef; - @ViewChild("eventsTemplate", { read: ViewContainerRef, static: true }) - eventsModalRef: ViewContainerRef; @ViewChild("bulkStatusTemplate", { read: ViewContainerRef, static: true }) bulkStatusModalRef: ViewContainerRef; @ViewChild("bulkConfirmTemplate", { read: ViewContainerRef, static: true }) @@ -167,12 +165,14 @@ export class PeopleComponent } async events(user: ProviderUserUserDetailsResponse) { - await this.modalService.openViewRef(EntityEventsComponent, this.eventsModalRef, (comp) => { - comp.name = this.userNamePipe.transform(user); - comp.providerId = this.providerId; - comp.entityId = user.id; - comp.showUser = false; - comp.entity = "user"; + await openEntityEventsDialog(this.dialogService, { + data: { + name: this.userNamePipe.transform(user), + providerId: this.providerId, + entityId: user.id, + showUser: false, + entity: "user", + }, }); }