fix: improve storage pre-filling with better debugging
- Clear storageSelection before pre-filling - Add detailed logging for slot filling process - Store filled drives in storageSelection for summary display - Improve error handling and debugging output 🤖 Generated with [Claude Code](https://claude.com/claude.com) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -4840,6 +4840,11 @@ var wpcf7 = {
|
|||||||
|
|
||||||
// Fill slots based on storage requirements
|
// Fill slots based on storage requirements
|
||||||
if (storageRequirements && storageRequirements.length > 0) {
|
if (storageRequirements && storageRequirements.length > 0) {
|
||||||
|
console.log("Pre-filling storage with requirements:", storageRequirements);
|
||||||
|
|
||||||
|
// Clear storageSelection to start fresh
|
||||||
|
storageSelection = {};
|
||||||
|
|
||||||
storageRequirements.forEach(req => {
|
storageRequirements.forEach(req => {
|
||||||
for (let i = 0; i < req.qty; i++) {
|
for (let i = 0; i < req.qty; i++) {
|
||||||
// Find an empty slot
|
// Find an empty slot
|
||||||
@@ -4849,6 +4854,8 @@ var wpcf7 = {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (emptySlot) {
|
if (emptySlot) {
|
||||||
|
console.log(`Filling slot ${emptySlot.id} with ${req.spec}`);
|
||||||
|
|
||||||
// Find matching drive type
|
// Find matching drive type
|
||||||
const match = emptySlot.values.find(v => {
|
const match = emptySlot.values.find(v => {
|
||||||
const vText = v.text.toLowerCase();
|
const vText = v.text.toLowerCase();
|
||||||
@@ -4874,6 +4881,13 @@ var wpcf7 = {
|
|||||||
configState[emptySlot.label] = 0; // Included in base price
|
configState[emptySlot.label] = 0; // Included in base price
|
||||||
configIds[emptySlot.id] = match.id;
|
configIds[emptySlot.id] = match.id;
|
||||||
|
|
||||||
|
// Store in storageSelection for summary
|
||||||
|
const displayName = match.text.replace(/\s?\(.*?\)/, '');
|
||||||
|
storageSelection[emptySlot.id] = {
|
||||||
|
name: displayName,
|
||||||
|
price: 0 // Free for included drives
|
||||||
|
};
|
||||||
|
|
||||||
// Track as original drive
|
// Track as original drive
|
||||||
window.originalDrives.push({
|
window.originalDrives.push({
|
||||||
slotId: emptySlot.id,
|
slotId: emptySlot.id,
|
||||||
@@ -4881,10 +4895,18 @@ var wpcf7 = {
|
|||||||
text: match.text,
|
text: match.text,
|
||||||
price: match.price
|
price: match.price
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(`✓ Filled with: ${match.text}`);
|
||||||
|
} else {
|
||||||
|
console.error(`✗ Could not find matching drive for: ${req.spec}`);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.error(`✗ No empty slots available for: ${req.spec}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("Final storageSelection:", storageSelection);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Pre-set configState for custom servers
|
// Pre-set configState for custom servers
|
||||||
|
|||||||
Reference in New Issue
Block a user