From cefe17bd5f1134d8d328ebf6f3477feae33bd9e5 Mon Sep 17 00:00:00 2001 From: Chuck Date: Mon, 5 Jan 2026 14:51:50 -0500 Subject: [PATCH] Add simple table interface for custom feeds - Replace complex array-of-objects widget with clean table - Table columns: Name, URL, Logo (upload), Enabled checkbox, Delete - Use dot notation for form field names (feeds.custom_feeds.0.name) - Add JavaScript functions for add/remove rows and logo upload - Fix file-upload detection order to prevent breaking static-image plugin --- web_interface/templates/v3/base.html | 34 ++++-- .../templates/v3/partials/plugin_config.html | 108 ++++++++++++++++-- 2 files changed, 122 insertions(+), 20 deletions(-) diff --git a/web_interface/templates/v3/base.html b/web_interface/templates/v3/base.html index 07520b1e..e6a42387 100644 --- a/web_interface/templates/v3/base.html +++ b/web_interface/templates/v3/base.html @@ -4839,7 +4839,7 @@ newRow.innerHTML = ` + onchange="handleCustomFeedLogoUpload(event, '${fieldId}', ${newIndex}, 'ledmatrix-news', '${fullKey}')"> Logo - - + + `; } diff --git a/web_interface/templates/v3/partials/plugin_config.html b/web_interface/templates/v3/partials/plugin_config.html index 5a8bd851..d5033a86 100644 --- a/web_interface/templates/v3/partials/plugin_config.html +++ b/web_interface/templates/v3/partials/plugin_config.html @@ -153,15 +153,105 @@ {% else %} - {# Regular array input (comma-separated) #} - {% set array_value = value if value is not none else (prop.default if prop.default is defined else []) %} - -

Separate multiple values with commas

+ {# Check if it's an array of objects (like custom_feeds) - use simple table interface #} + {% 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 #} + {% 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 logo_path %} + Logo + + + {% else %} + No logo + {% endif %} +
+
+ + + +
+ +
+ {% else %} + {# Regular array input (comma-separated) #} + {% set array_value = value if value is not none else (prop.default if prop.default is defined else []) %} + +

Separate multiple values with commas

+ {% endif %} {% endif %} {# Text input (default) #}