mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 13:23:00 +00:00
Remove duplicate array-of-objects check
This commit is contained in:
@@ -3049,36 +3049,6 @@ function generateFieldHtml(key, prop, value, prefix = '') {
|
|||||||
`;
|
`;
|
||||||
});
|
});
|
||||||
html += `</div>`;
|
html += `</div>`;
|
||||||
} else if (prop.items && prop.items.type === 'object' && prop.items.properties) {
|
|
||||||
// Array of objects widget (like custom_feeds with name, url, enabled, logo)
|
|
||||||
console.log(`[DEBUG] ✅ Detected array-of-objects widget for ${fullKey}`);
|
|
||||||
const fieldId = fullKey.replace(/\./g, '_');
|
|
||||||
const itemsSchema = prop.items;
|
|
||||||
const itemProperties = itemsSchema.properties || {};
|
|
||||||
const maxItems = prop.maxItems || 50;
|
|
||||||
const currentItems = Array.isArray(value) ? value : [];
|
|
||||||
|
|
||||||
html += `
|
|
||||||
<div class="array-of-objects-container mt-1">
|
|
||||||
<div id="${fieldId}_items" class="space-y-4">
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Render existing items
|
|
||||||
currentItems.forEach((item, index) => {
|
|
||||||
html += renderArrayObjectItem(fieldId, fullKey, itemProperties, item, index, itemsSchema);
|
|
||||||
});
|
|
||||||
|
|
||||||
html += `
|
|
||||||
</div>
|
|
||||||
<button type="button"
|
|
||||||
onclick="addArrayObjectItem('${fieldId}', '${fullKey}', ${maxItems})"
|
|
||||||
class="mt-3 px-4 py-2 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded-md transition-colors"
|
|
||||||
${currentItems.length >= maxItems ? 'disabled style="opacity: 0.5; cursor: not-allowed;"' : ''}>
|
|
||||||
<i class="fas fa-plus mr-1"></i> Add Feed
|
|
||||||
</button>
|
|
||||||
<input type="hidden" id="${fieldId}_data" name="${fullKey}_data" value='${JSON.stringify(currentItems).replace(/'/g, "'")}'>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
} else {
|
} else {
|
||||||
// Regular array input
|
// Regular array input
|
||||||
console.log(`[DEBUG] ❌ NOT a file upload widget for ${fullKey}, using regular array input`);
|
console.log(`[DEBUG] ❌ NOT a file upload widget for ${fullKey}, using regular array input`);
|
||||||
|
|||||||
Reference in New Issue
Block a user