From 89f07b8b790efc790561dfcc333356b944aadbfa Mon Sep 17 00:00:00 2001 From: Chuck Date: Thu, 8 Jan 2026 12:43:04 -0500 Subject: [PATCH] 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. --- .../templates/v3/partials/plugin_config.html | 178 +++++++++--------- 1 file changed, 94 insertions(+), 84 deletions(-) diff --git a/web_interface/templates/v3/partials/plugin_config.html b/web_interface/templates/v3/partials/plugin_config.html index 937d1fd7..ed59da87 100644 --- a/web_interface/templates/v3/partials/plugin_config.html +++ b/web_interface/templates/v3/partials/plugin_config.html @@ -177,95 +177,105 @@ {% endfor %} {% 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 is_array_of_objects = items_schema.get('type') == 'object' and items_schema.get('properties') %} - {% if is_array_of_objects %} - {# Simple table-based interface for custom feeds #} + {% if x_widget == 'custom-feeds' %} + {# Custom feeds table interface - widget-specific implementation #} + {# Validate that required fields exist in schema #} {% set item_properties = items_schema.get('properties', {}) %} - {% 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 []) %} - -
- - - - - - - - - - - - {% for item in array_value %} - {% set item_index = loop.index0 %} - - - - + + {% endfor %} + +
NameURLLogoEnabledActions
- - - - - {% set logo_value = item.get('logo') or {} %} - {% set logo_path = logo_value.get('path', '') %} -
- + {% if not (item_properties.get('name') and item_properties.get('url')) %} + {# Fallback to generic if schema doesn't match expected structure #} +

+ + Custom feeds widget requires 'name' and 'url' properties in items schema. +

+ {% else %} + {% 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 []) %} + +
+ + + + + + + + + + + + {% for item in array_value %} + {% set item_index = loop.index0 %} + + + + + + - - - - {% endfor %} - -
NameURLLogoEnabledActions
+ + + + + {% set logo_value = item.get('logo') or {} %} + {% set logo_path = logo_value.get('path', '') %} +
+ + + {% if logo_path %} + Logo + + + {% else %} + No logo + {% endif %} +
+
+ + - {% if logo_path %} - Logo - - - {% else %} - No logo - {% endif %} - - - - - -
- -
+
+ +
+ {% endif %} {% 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) #} {% set array_value = value if value is not none else (prop.default if prop.default is defined else []) %}