From 92af0a9627e8e6182e3657a1fa6b14bdd75d207d Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 16 Jul 2025 11:00:35 +0200 Subject: [PATCH 01/58] don't show included in when no mandatory addon --- .../static/js/price-calculator/dom-manager.js | 2 ++ .../static/js/price-calculator/ui-manager.js | 18 ++++++++++++++++-- .../templates/services/offering_detail.html | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/hub/services/static/js/price-calculator/dom-manager.js b/hub/services/static/js/price-calculator/dom-manager.js index 42c4626..2e3b9e8 100644 --- a/hub/services/static/js/price-calculator/dom-manager.js +++ b/hub/services/static/js/price-calculator/dom-manager.js @@ -25,6 +25,8 @@ class DOMManager { this.elements.addonsContainer = document.getElementById('addonsContainer'); this.elements.addonPricingContainer = document.getElementById('addonPricingContainer'); this.elements.managedServiceIncludesContainer = document.getElementById('managedServiceIncludesContainer'); + this.elements.managedServiceIncludes = document.getElementById('managedServiceIncludes'); + this.elements.managedServiceToggleButton = document.querySelector('button[data-bs-target="#managedServiceIncludes"]'); // Result display elements this.elements.planMatchStatus = document.getElementById('planMatchStatus'); diff --git a/hub/services/static/js/price-calculator/ui-manager.js b/hub/services/static/js/price-calculator/ui-manager.js index e1a099a..2bbde8c 100644 --- a/hub/services/static/js/price-calculator/ui-manager.js +++ b/hub/services/static/js/price-calculator/ui-manager.js @@ -85,14 +85,28 @@ class UIManager { // Update addon pricing display in the results panel updateAddonPricingDisplay(domManager, mandatoryAddons, selectedOptionalAddons) { - // Update mandatory addons in the managed service includes container + // Get references to the managed service includes elements const managedServiceIncludesContainer = domManager.get('managedServiceIncludesContainer'); + const managedServiceIncludes = domManager.get('managedServiceIncludes'); + const managedServiceToggleButton = domManager.get('managedServiceToggleButton'); + if (managedServiceIncludesContainer) { // Clear existing content managedServiceIncludesContainer.innerHTML = ''; + // Show/hide the entire managed service includes section based on mandatory addons + const hasMandatoryAddons = mandatoryAddons && mandatoryAddons.length > 0; + + if (managedServiceIncludes) { + managedServiceIncludes.style.display = hasMandatoryAddons ? 'block' : 'none'; + } + + if (managedServiceToggleButton) { + managedServiceToggleButton.style.display = hasMandatoryAddons ? 'inline-block' : 'none'; + } + // Add mandatory addons to the managed service includes section - if (mandatoryAddons && mandatoryAddons.length > 0) { + if (hasMandatoryAddons) { mandatoryAddons.forEach(addon => { const addonRow = document.createElement('div'); addonRow.className = 'd-flex justify-content-between small text-muted mb-1'; diff --git a/hub/services/templates/services/offering_detail.html b/hub/services/templates/services/offering_detail.html index 9db60d7..04d1e3e 100644 --- a/hub/services/templates/services/offering_detail.html +++ b/hub/services/templates/services/offering_detail.html @@ -377,7 +377,7 @@ document.addEventListener('DOMContentLoaded', () => {
Managed Service (incl. Compute) -
@@ -385,7 +385,7 @@ document.addEventListener('DOMContentLoaded', () => {
-
+ @@ -759,8 +811,8 @@ {% endblock %} {% block extra_js %} - - + + {% endif %} - + {% block extra_js %}{% endblock %} @@ -40,9 +40,8 @@
-