From 9b0075860a1d66dd1195a893b2287cc2e24222d7 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Fri, 11 Aug 2023 10:16:59 +1000 Subject: [PATCH] [AC-1588] Fix Bitwarden Portal Secrets Manager flag not working (#3178) * Fix SM Configuration not showing properly * Undo unnecessary changes * Undo unnecessary change * Undo unnecessary change (cherry picked from commit 09e396a2d289458ccaedd4ece29f17a6d7d564eb) --- .../Shared/_OrganizationFormScripts.cshtml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Admin/Views/Shared/_OrganizationFormScripts.cshtml b/src/Admin/Views/Shared/_OrganizationFormScripts.cshtml index 8fd7ef10e001..7edeafb7daf1 100644 --- a/src/Admin/Views/Shared/_OrganizationFormScripts.cshtml +++ b/src/Admin/Views/Shared/_OrganizationFormScripts.cshtml @@ -6,7 +6,7 @@ document.getElementById('@(nameof(Model.Plan))').value = selectText; togglePlanSettings(selectEl.options[selectEl.selectedIndex].value); }); - document.getElementById('gateway-customer-link').addEventListener('click', () => { + document.getElementById('gateway-customer-link')?.addEventListener('click', () => { const gateway = document.getElementById('@(nameof(Model.Gateway))'); const customerId = document.getElementById('@(nameof(Model.GatewayCustomerId))'); if (!gateway || gateway.value === '' || !customerId || customerId.value === '') { @@ -19,7 +19,7 @@ + customerId.value, '_blank'); } }); - document.getElementById('gateway-subscription-link').addEventListener('click', () => { + document.getElementById('gateway-subscription-link')?.addEventListener('click', () => { const gateway = document.getElementById('@(nameof(Model.Gateway))'); const subId = document.getElementById('@(nameof(Model.GatewaySubscriptionId))'); if (!gateway || gateway.value === '' || !subId || subId.value === '') { @@ -34,24 +34,24 @@ }); document.getElementById('@(nameof(Model.UseSecretsManager))').addEventListener('change', (event) => { document.getElementById('organization-secrets-configuration').hidden = !event.target.checked; - + if (event.target.checked) { return; } - + document.getElementById('@(nameof(Model.SmSeats))').value = ''; document.getElementById('@(nameof(Model.MaxAutoscaleSmSeats))').value = ''; document.getElementById('@(nameof(Model.SmServiceAccounts))').value = ''; document.getElementById('@(nameof(Model.MaxAutoscaleSmServiceAccounts))').value = ''; }); })(); - + function togglePlanSettings(planType) { document.getElementById('@(nameof(Model.PlanType))').value = planType; switch(planType) { case '@((byte)Bit.Core.Enums.PlanType.TeamsMonthly)': case '@((byte)Bit.Core.Enums.PlanType.TeamsAnnually)': - // Plan + // Plan document.getElementById('@(nameof(Model.Seats))').value = '10'; document.getElementById('@(nameof(Model.MaxCollections))').value = ''; document.getElementById('@(nameof(Model.MaxStorageGb))').value = '1'; @@ -66,7 +66,7 @@ document.getElementById('@(nameof(Model.UseDirectory))').checked = true; document.getElementById('@(nameof(Model.UseEvents))').checked = true; document.getElementById('@(nameof(Model.UsersGetPremium))').checked = true; - document.getElementById('@(nameof(Model.UseCustomPermissions))').checked = false; + document.getElementById('@(nameof(Model.UseCustomPermissions))').checked = false; document.getElementById('@(nameof(Model.UseTotp))').checked = true; document.getElementById('@(nameof(Model.Use2fa))').checked = true; document.getElementById('@(nameof(Model.UseApi))').checked = true; @@ -78,7 +78,7 @@ document.getElementById('@(nameof(Model.ExpirationDate))').value = '@Model.FourteenDayExpirationDate'; document.getElementById('@(nameof(Model.SalesAssistedTrialStarted))').value = true; break; - + case '@((byte)Bit.Core.Enums.PlanType.EnterpriseMonthly)': case '@((byte)Bit.Core.Enums.PlanType.EnterpriseAnnually)': // Plan @@ -109,6 +109,6 @@ document.getElementById('@(nameof(Model.SalesAssistedTrialStarted))').value = true; break; } - + } - \ No newline at end of file +