From 70ad44f81b284586e5aab20d9c660b2cfcb4625e Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 6 Dec 2025 01:49:24 +0400 Subject: [PATCH] fix: display preselected drives correctly in individual storage slots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed createOptionGrid to properly handle preselected storage values - Added updateStorageSummary function to aggregate storage selections - Individual slots now show the correct preselected drives - Storage summary displays proper counts (4x Crucial + 2x Kioxia) - Each slot shows as "Configured" instead of "None selected" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../new-baremetal.html | 47 +++++++++++++++++-- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/Documents/Vibe Coding Projects/dedicatednodes-redesign/dedicatednodes-bare-metal/new-baremetal.html b/Documents/Vibe Coding Projects/dedicatednodes-redesign/dedicatednodes-bare-metal/new-baremetal.html index f078ba3..b209838 100644 --- a/Documents/Vibe Coding Projects/dedicatednodes-redesign/dedicatednodes-bare-metal/new-baremetal.html +++ b/Documents/Vibe Coding Projects/dedicatednodes-redesign/dedicatednodes-bare-metal/new-baremetal.html @@ -4671,7 +4671,12 @@ var wpcf7 = { container.appendChild(visualContainer); // Create individual option grid for this slot - container.appendChild(createOptionGrid(opt, true, -1, isInstant, preselected)); + // For instant customization, we need to pass the specific preselected value for this slot + const slotPreselected = {}; + if (isInstant && preselected[opt.id]) { + slotPreselected[opt.id] = preselected[opt.id]; + } + container.appendChild(createOptionGrid(opt, true, -1, isInstant, slotPreselected)); }); } else { // Group storage options by signature for custom servers @@ -5030,6 +5035,31 @@ var wpcf7 = { if(specStorage) specStorage.innerHTML = pillsHtml; }; + // Function to update storage summary + function updateStorageSummary() { + // Collect all selected drives + const storageCount = {}; + let storageSummary = []; + + Object.values(storageSelection).forEach(drive => { + if (drive.name && !drive.name.toLowerCase().includes('none')) { + storageCount[drive.name] = (storageCount[drive.name] || 0) + 1; + } + }); + + // Build summary text with counts + Object.entries(storageCount).forEach(([name, count]) => { + storageSummary.push(`${count}x ${name}`); + }); + + const storageText = storageSummary.length > 0 ? storageSummary.join(' + ') : 'None'; + document.getElementById('summaryStorage').textContent = storageText; + + // Update Tech Specs + const specStorage = document.getElementById('spec-storage-config-hero'); + if (specStorage) specStorage.innerText = storageText; + } + function createOptionGrid(opt, isWide, storageIndex = -1, isInstant = false, preselected = {}) { const grid = document.createElement('div'); grid.className = isWide ? 'config-grid wide' : 'config-grid'; @@ -5069,12 +5099,21 @@ var wpcf7 = { const specNet = document.getElementById('spec-network-speed-hero'); if(specNet) specNet.innerText = val.text; } - + // For storage, we need to aggregate if (opt.type === 'storage') { + const displayName = val.text.replace(/\s?\(.*?\)/, ''); // Clean text + // Store selection for this "bay" (opt.id) - storageSelection[opt.id] = { name: val.text, price: val.price }; - updateDynamicStorageVisual(storageIndex, val.text, isInstant); + storageSelection[opt.id] = { name: displayName, price: val.price }; + + // For instant customization with individual slots, update the slot visual + if (isInstant && storageIndex >= 0) { + updateDynamicStorageVisual(storageIndex, displayName, isInstant); + } + + // Always update the storage summary + updateStorageSummary(); } }