From bcb232cc80113926b6c42456f78c245d78051fb0 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Thu, 25 Jan 2024 16:56:31 +1000 Subject: [PATCH] [AC-2026] Add flexible collections opt-in UI (#7443) --- .../settings/account.component.html | 19 +++++++++++++++++++ .../settings/account.component.ts | 18 +++++++++++++++++- apps/web/src/locales/en/messages.json | 11 +++++++++-- .../organization-api.service.abstraction.ts | 1 + .../organization/organization-api.service.ts | 11 +++++++++++ 5 files changed, 57 insertions(+), 3 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 35e9e56410..4e5bbc0349 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 @@ -52,6 +52,25 @@ {{ "rotateApiKey" | i18n }} +
+

+ {{ "collectionManagement" | i18n }} + {{ "beta" | i18n }} +

+

+ {{ "collectionEnhancementsDesc" | i18n }} + + {{ "collectionEnhancementsLearnMore" | i18n }} + +

+ +
; + + protected flexibleCollectionsMigrationEnabled$ = this.configService.getFeatureFlag$( + FeatureFlag.FlexibleCollectionsMigration, + false, + ); + flexibleCollectionsV1Enabled$ = this.configService.getFeatureFlag$( FeatureFlag.FlexibleCollectionsV1, false, @@ -177,6 +183,16 @@ export class AccountComponent { this.platformUtilsService.showToast("success", null, this.i18nService.t("organizationUpdated")); }; + enableCollectionEnhancements = async () => { + await this.organizationApiService.enableCollectionEnhancements(this.organizationId); + + this.platformUtilsService.showToast( + "success", + null, + this.i18nService.t("updatedCollectionManagement"), + ); + }; + submitCollectionManagement = async () => { // Early exit if self-hosted if (this.selfHosted) { @@ -194,7 +210,7 @@ export class AccountComponent { this.platformUtilsService.showToast( "success", null, - this.i18nService.t("collectionManagementUpdated"), + this.i18nService.t("updatedCollectionManagement"), ); }; diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index d11b8482b9..46e340c1f1 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -7325,8 +7325,8 @@ "allowAdminAccessToAllCollectionItemsDesc": { "message": "Owners and admins can manage all collections and items" }, - "collectionManagementUpdated": { - "message": "Collection management behavior saved" + "updatedCollectionManagement": { + "message": "Updated collection management setting" }, "passwordManagerPlanPrice": { "message": "Password Manager plan price" @@ -7461,5 +7461,12 @@ "addAPaymentMethod": { "message": "add a payment method", "description": "This will be used as part of a larger sentence, broken up to include links. The full sentence will read 'To maintain your subscription for $ORG$, add a payment method.'" + }, + "collectionEnhancementsDesc": { + "message": "Add new settings and permissions for additional flexibility. Replace the Manager role with the \"can manage\" permission, and introduce options to allow users to create collections as well as restrict administrative access to collections.", + "description": "This describes new features and improvements for user roles and collections" + }, + "collectionEnhancementsLearnMore": { + "message": "Learn more about collection management" } } diff --git a/libs/common/src/admin-console/abstractions/organization/organization-api.service.abstraction.ts b/libs/common/src/admin-console/abstractions/organization/organization-api.service.abstraction.ts index 56c9124200..dd1e0c1e91 100644 --- a/libs/common/src/admin-console/abstractions/organization/organization-api.service.abstraction.ts +++ b/libs/common/src/admin-console/abstractions/organization/organization-api.service.abstraction.ts @@ -80,4 +80,5 @@ export class OrganizationApiServiceAbstraction { request: OrganizationCollectionManagementUpdateRequest, ) => Promise; risksSubscriptionFailure: (id: string) => Promise; + enableCollectionEnhancements: (id: string) => Promise; } diff --git a/libs/common/src/admin-console/services/organization/organization-api.service.ts b/libs/common/src/admin-console/services/organization/organization-api.service.ts index d0307f788f..edb8dbc83b 100644 --- a/libs/common/src/admin-console/services/organization/organization-api.service.ts +++ b/libs/common/src/admin-console/services/organization/organization-api.service.ts @@ -357,4 +357,15 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction return new OrganizationRisksSubscriptionFailureResponse(r); } + + async enableCollectionEnhancements(id: string): Promise { + await this.apiService.send( + "POST", + "/organizations/" + id + "/enable-collection-enhancements", + null, + true, + false, + ); + await this.syncService.fullSync(true); + } }