From 960b77ddd772c85423c4c9b510dba1390054bc76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rui=20Tom=C3=A9?= <108268980+r-tome@users.noreply.github.com> Date: Thu, 3 Apr 2025 14:13:47 +0100 Subject: [PATCH] [PM-18524] Make the External ID in the Collection dialog conditional (#14096) * [PM-18524] Make the external ID in the collection dialog conditional * [PM-18524] Update external ID in collection dialog to always be disabled * [PM-18524] Display ExternalID field only in Admin Console - Add isAdminConsoleActive flag to CollectionDialogParams - Update isExternalIdVisible$ observable to respect context - Set flag when dialog is opened from Admin Console routes * [PM-18524] Enable/disable External ID field based on feature flag --- .../collections/vault.component.ts | 2 ++ .../collection-dialog.component.html | 2 +- .../collection-dialog.component.ts | 24 ++++++++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/admin-console/organizations/collections/vault.component.ts b/apps/web/src/app/admin-console/organizations/collections/vault.component.ts index 89dbce1329..97193bf1b1 100644 --- a/apps/web/src/app/admin-console/organizations/collections/vault.component.ts +++ b/apps/web/src/app/admin-console/organizations/collections/vault.component.ts @@ -1226,6 +1226,7 @@ export class VaultComponent implements OnInit, OnDestroy { organizationId: this.organization?.id, parentCollectionId: this.selectedCollection?.node.id, limitNestedCollections: !this.organization.canEditAnyCollection, + isAdminConsoleActive: true, }, }); @@ -1251,6 +1252,7 @@ export class VaultComponent implements OnInit, OnDestroy { readonly: readonly, isAddAccessCollection: c.unmanaged, limitNestedCollections: !this.organization.canEditAnyCollection, + isAdminConsoleActive: true, }, }); diff --git a/apps/web/src/app/admin-console/organizations/shared/components/collection-dialog/collection-dialog.component.html b/apps/web/src/app/admin-console/organizations/shared/components/collection-dialog/collection-dialog.component.html index 9188ba5ab9..984d21bf25 100644 --- a/apps/web/src/app/admin-console/organizations/shared/components/collection-dialog/collection-dialog.component.html +++ b/apps/web/src/app/admin-console/organizations/shared/components/collection-dialog/collection-dialog.component.html @@ -35,7 +35,7 @@ - + {{ "externalId" | i18n }} {{ "externalIdDesc" | i18n }} diff --git a/apps/web/src/app/admin-console/organizations/shared/components/collection-dialog/collection-dialog.component.ts b/apps/web/src/app/admin-console/organizations/shared/components/collection-dialog/collection-dialog.component.ts index 8bde95e1b4..37d0ebbd19 100644 --- a/apps/web/src/app/admin-console/organizations/shared/components/collection-dialog/collection-dialog.component.ts +++ b/apps/web/src/app/admin-console/organizations/shared/components/collection-dialog/collection-dialog.component.ts @@ -95,6 +95,7 @@ export interface CollectionDialogParams { limitNestedCollections?: boolean; readonly?: boolean; isAddAccessCollection?: boolean; + isAdminConsoleActive?: boolean; } export interface CollectionDialogResult { @@ -138,6 +139,16 @@ export class CollectionDialogComponent implements OnInit, OnDestroy { protected showAddAccessWarning = false; protected collections: Collection[]; protected buttonDisplayName: ButtonType = ButtonType.Save; + protected isExternalIdVisible$ = this.configService + .getFeatureFlag$(FeatureFlag.SsoExternalIdVisibility) + .pipe( + map((isEnabled) => { + return ( + !isEnabled || + (!!this.params.isAdminConsoleActive && !!this.formGroup.get("externalId")?.value) + ); + }), + ); private orgExceedingCollectionLimit!: Organization; constructor( @@ -478,7 +489,18 @@ export class CollectionDialogComponent implements OnInit, OnDestroy { this.formGroup.controls.access.disable(); } else { this.formGroup.controls.name.enable(); - this.formGroup.controls.externalId.enable(); + + this.configService + .getFeatureFlag$(FeatureFlag.SsoExternalIdVisibility) + .pipe(takeUntil(this.destroy$)) + .subscribe((isEnabled) => { + if (isEnabled) { + this.formGroup.controls.externalId.disable(); + } else { + this.formGroup.controls.externalId.enable(); + } + }); + this.formGroup.controls.parent.enable(); this.formGroup.controls.access.enable(); }