mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-15 14:52:59 +00:00
fix: Make custom feeds table widget-specific instead of generic fallback
Replace generic array-of-objects check with widget-specific check for 'custom-feeds' widget to prevent hardcoded schema from breaking other plugins with different array-of-objects structures. Changes: - Check for x-widget == 'custom-feeds' before rendering custom feeds table - Add schema validation to ensure required fields (name, url) exist - Show warning message if schema doesn't match expected structure - Fall back to generic array input for other array-of-objects schemas - Add comments for future generic array-of-objects support This ensures the hardcoded custom feeds table (name, url, logo, enabled) only renders when explicitly requested via widget type, preventing breakage for other plugins with different array-of-objects schemas.
This commit is contained in:
@@ -177,12 +177,19 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
{# Check if it's an array of objects (like custom_feeds) - use simple table interface #}
|
{# Check for custom-feeds widget first #}
|
||||||
{% set items_schema = prop.get('items') or {} %}
|
{% set items_schema = prop.get('items') or {} %}
|
||||||
{% set is_array_of_objects = items_schema.get('type') == 'object' and items_schema.get('properties') %}
|
{% if x_widget == 'custom-feeds' %}
|
||||||
{% if is_array_of_objects %}
|
{# Custom feeds table interface - widget-specific implementation #}
|
||||||
{# Simple table-based interface for custom feeds #}
|
{# Validate that required fields exist in schema #}
|
||||||
{% set item_properties = items_schema.get('properties', {}) %}
|
{% set item_properties = items_schema.get('properties', {}) %}
|
||||||
|
{% if not (item_properties.get('name') and item_properties.get('url')) %}
|
||||||
|
{# Fallback to generic if schema doesn't match expected structure #}
|
||||||
|
<p class="text-xs text-amber-600 mt-1">
|
||||||
|
<i class="fas fa-exclamation-triangle mr-1"></i>
|
||||||
|
Custom feeds widget requires 'name' and 'url' properties in items schema.
|
||||||
|
</p>
|
||||||
|
{% else %}
|
||||||
{% set max_items = prop.get('maxItems', 50) %}
|
{% set max_items = prop.get('maxItems', 50) %}
|
||||||
{% set array_value = value if value is not none and value is iterable and value is not string else (prop.default if prop.default is defined and prop.default is iterable and prop.default is not string else []) %}
|
{% set array_value = value if value is not none and value is iterable and value is not string else (prop.default if prop.default is defined and prop.default is iterable and prop.default is not string else []) %}
|
||||||
|
|
||||||
@@ -265,7 +272,10 @@
|
|||||||
<i class="fas fa-plus mr-1"></i> Add Feed
|
<i class="fas fa-plus mr-1"></i> Add Feed
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{# Generic array-of-objects would go here if needed in the future #}
|
||||||
|
{# For now, fall back to regular array input (comma-separated) #}
|
||||||
{# Regular array input (comma-separated) #}
|
{# Regular array input (comma-separated) #}
|
||||||
{% set array_value = value if value is not none else (prop.default if prop.default is defined else []) %}
|
{% set array_value = value if value is not none else (prop.default if prop.default is defined else []) %}
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
|||||||
Reference in New Issue
Block a user