From 783ae104a3019a3309e0b3496c269bb20157f87f Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Fri, 9 Feb 2024 09:14:33 -0600 Subject: [PATCH] feat: add confirm collection enhancements dialog, refs AC-2113 (#7884) --- .../settings/account.component.html | 7 ++++- .../settings/account.component.ts | 28 +++++++++++++------ apps/web/src/locales/en/messages.json | 6 ++++ 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/apps/web/src/app/admin-console/organizations/settings/account.component.html b/apps/web/src/app/admin-console/organizations/settings/account.component.html index 4e5bbc0349..571071606f 100644 --- a/apps/web/src/app/admin-console/organizations/settings/account.component.html +++ b/apps/web/src/app/admin-console/organizations/settings/account.component.html @@ -67,7 +67,12 @@ {{ "collectionEnhancementsLearnMore" | i18n }}

- diff --git a/apps/web/src/app/admin-console/organizations/settings/account.component.ts b/apps/web/src/app/admin-console/organizations/settings/account.component.ts index 204ac77a62..8527aa1b17 100644 --- a/apps/web/src/app/admin-console/organizations/settings/account.component.ts +++ b/apps/web/src/app/admin-console/organizations/settings/account.component.ts @@ -16,7 +16,7 @@ import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.se import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; -import { DialogService } from "@bitwarden/components"; +import { DialogService, SimpleDialogOptions } from "@bitwarden/components"; import { ApiKeyComponent } from "../../../auth/settings/security/api-key.component"; import { PurgeVaultComponent } from "../../../vault/settings/purge-vault.component"; @@ -183,15 +183,25 @@ export class AccountComponent { this.platformUtilsService.showToast("success", null, this.i18nService.t("organizationUpdated")); }; - enableCollectionEnhancements = async () => { - await this.organizationApiService.enableCollectionEnhancements(this.organizationId); + async showConfirmCollectionEnhancementsDialog() { + const collectionEnhancementsDialogOptions: SimpleDialogOptions = { + title: this.i18nService.t("confirmCollectionEnhancementsDialogTitle"), + content: this.i18nService.t("confirmCollectionEnhancementsDialogContent"), + type: "warning", + acceptButtonText: this.i18nService.t("continue"), + acceptAction: async () => { + await this.organizationApiService.enableCollectionEnhancements(this.organizationId); - this.platformUtilsService.showToast( - "success", - null, - this.i18nService.t("updatedCollectionManagement"), - ); - }; + this.platformUtilsService.showToast( + "success", + null, + this.i18nService.t("updatedCollectionManagement"), + ); + }, + }; + + await this.dialogService.openSimpleDialog(collectionEnhancementsDialogOptions); + } submitCollectionManagement = async () => { // Early exit if self-hosted diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index ce102e967d..45eebe4d63 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -7519,5 +7519,11 @@ }, "smFreeTrialConfirmationEmail": { "message": "We've sent a confirmation email to your email at " + }, + "confirmCollectionEnhancementsDialogTitle": { + "message": "This action is irreversible" + }, + "confirmCollectionEnhancementsDialogContent": { + "message": "Turning on this feature will deprecate the manager role and replace it with a Can manage permission. This will take a few moments. Do not make any organization changes until it is complete. Are you sure you want to proceed?" } }