fix: display preselected drives correctly in individual storage slots
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -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';
|
||||
@@ -5072,9 +5102,18 @@ var wpcf7 = {
|
||||
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user