mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
* docs: rename FONT_MANAGER_USAGE.md to FONT_MANAGER.md Renamed for clearer naming convention. Part of documentation consolidation effort. * docs: consolidate Plugin Store guides (2→1) Merged: - PLUGIN_STORE_USER_GUIDE.md - PLUGIN_STORE_QUICK_REFERENCE.md Into: PLUGIN_STORE_GUIDE.md - Unified writing style to professional technical - Added Quick Reference section at top for easy access - Removed duplicate content - Added cross-references to related documentation - Updated formatting to match style guidelines * docs: create user-focused Web Interface Guide Created WEB_INTERFACE_GUIDE.md consolidating: - V3_INTERFACE_README.md (technical details) - User-facing interface documentation - Focused on end-user tasks and navigation - Removed technical implementation details - Added common tasks section - Included troubleshooting - Professional technical writing style * docs: consolidate WiFi setup guides (4→1) Merged: - WIFI_SETUP.md - OPTIMAL_WIFI_AP_FAILOVER_SETUP.md - AP_MODE_MANUAL_ENABLE.md - WIFI_ETHERNET_AP_MODE_FIX.md (behavior documentation) Into: WIFI_NETWORK_SETUP.md - Comprehensive coverage of WiFi setup and configuration - Clear explanation of AP mode failover and grace period - Configuration scenarios and best practices - Troubleshooting section combining all sources - Professional technical writing style - Added quick reference table for behavior * docs: consolidate troubleshooting guides (4→1) Merged: - TROUBLESHOOTING_QUICK_START.md - WEB_INTERFACE_TROUBLESHOOTING.md - CAPTIVE_PORTAL_TROUBLESHOOTING.md - WEATHER_TROUBLESHOOTING.md Into: TROUBLESHOOTING.md - Organized by issue category (web, WiFi, plugins) - Comprehensive diagnostic commands reference - Quick diagnosis steps at the top - Service file template preserved - Complete diagnostic script included - Professional technical writing style * docs: create consolidated Advanced Features guide Merged: - VEGAS_SCROLL_MODE.md - ON_DEMAND_DISPLAY_QUICK_START.md - ON_DEMAND_DISPLAY_API.md - ON_DEMAND_CACHE_MANAGEMENT.md - BACKGROUND_SERVICE_README.md - PERMISSION_MANAGEMENT_GUIDE.md Into: ADVANCED_FEATURES.md - Comprehensive guide covering all advanced features - Vegas scroll mode with integration examples - On-demand display with API reference - Cache management troubleshooting - Background service documentation - Permission management patterns - Professional technical writing style * docs: create Getting Started guide for first-time users Created GETTING_STARTED.md: - Quick start guide (5 minutes) - Initial configuration walkthrough - Common first-time issues and solutions - Next steps and quick reference - User-friendly tone for beginners - Links to detailed documentation * docs: archive consolidated source files and ephemeral docs Archived files that have been consolidated: - Plugin Store guides (2 files → PLUGIN_STORE_GUIDE.md) - Web Interface guide (V3_INTERFACE_README.md → WEB_INTERFACE_GUIDE.md) - WiFi Setup guides (4 files → WIFI_NETWORK_SETUP.md) - Troubleshooting guides (4 files → TROUBLESHOOTING.md) - Advanced Features (6 files → ADVANCED_FEATURES.md) Archived ephemeral/debug documentation: - DEBUG_WEB_ISSUE.md - BROWSER_ERRORS_EXPLANATION.md - FORM_VALIDATION_FIXES.md - WEB_UI_RELIABILITY_IMPROVEMENTS.md - CAPTIVE_PORTAL_TESTING.md - NEXT_STEPS_COMMANDS.md - STATIC_IMAGE_MULTI_UPLOAD_PLAN.md - RECONNECT_AFTER_CAPTIVE_PORTAL_TESTING.md Archived implementation summaries: - PLUGIN_CONFIG_TABS_SUMMARY.md - PLUGIN_CONFIG_SYSTEM_VERIFICATION.md - PLUGIN_SCHEMA_AUDIT_SUMMARY.md - STARTUP_OPTIMIZATION_SUMMARY.md - PLUGIN_DISPATCH_IMPLEMENTATION.md - NESTED_SCHEMA_IMPLEMENTATION.md - AP_MODE_MANUAL_ENABLE_CHANGES.md - PLUGIN_CONFIG_SYSTEM_EXPLANATION.md Total archived: 27 files Preserves git history while cleaning up main docs directory * docs: rename API_REFERENCE.md to REST_API_REFERENCE.md Renamed for clarity - this is specifically the REST API reference for the web interface, not a general API reference. * docs: update README.md to reflect consolidated documentation structure Updated documentation index: - Reflects new consolidated guides (51 → 16-17 files) - Updated Quick Start sections with new file names - Added consolidation history (January 2026) - Updated file references (API_REFERENCE → REST_API_REFERENCE) - Documented archival of 33 files - Added benefits of consolidation - Updated statistics and highlights - Removed outdated references - Professional writing style maintained throughout * docs: add Vegas scroll mode system architecture documentation Added comprehensive internal architecture section for Vegas mode: - Component overview with diagram - VegasModeCoordinator responsibilities and main loop - StreamManager buffering strategy and content flow - PluginAdapter integration and fallback behavior - RenderPipeline 125 FPS rendering process - Component interaction flows - Thread safety patterns - Performance characteristics Covers: - How the four components work together - Initialization and render loop flows - Config update handling - Frame rate management and optimization - Memory usage and CPU characteristics --------- Co-authored-by: Chuck <chuck@example.com>
214 lines
6.4 KiB
Markdown
214 lines
6.4 KiB
Markdown
# Plugin Configuration Tabs - Implementation Summary
|
|
|
|
## What Was Changed
|
|
|
|
### Backend (web_interface_v2.py)
|
|
|
|
**Modified `/api/plugins/installed` endpoint:**
|
|
- Now loads each plugin's `config_schema.json` if it exists
|
|
- Returns `config_schema_data` along with plugin information
|
|
- Enables frontend to generate configuration forms dynamically
|
|
|
|
```python
|
|
# Added schema loading logic
|
|
schema_file = info.get('config_schema')
|
|
if schema_file:
|
|
schema_path = Path('plugins') / plugin_id / schema_file
|
|
if schema_path.exists():
|
|
with open(schema_path, 'r', encoding='utf-8') as f:
|
|
info['config_schema_data'] = json.load(f)
|
|
```
|
|
|
|
### Frontend (templates/index_v2.html)
|
|
|
|
**New Functions:**
|
|
|
|
1. `generatePluginTabs(plugins)` - Creates dynamic tabs for each installed plugin
|
|
2. `generatePluginConfigForm(plugin)` - Generates HTML form from JSON Schema
|
|
3. `savePluginConfiguration(pluginId)` - Saves configuration with type conversion
|
|
4. `resetPluginConfig(pluginId)` - Resets settings to schema defaults
|
|
|
|
**Modified Functions:**
|
|
|
|
1. `refreshPlugins()` - Now calls `generatePluginTabs()` to create dynamic tabs
|
|
2. `configurePlugin(pluginId)` - Navigates to plugin's configuration tab
|
|
|
|
**Initialization:**
|
|
|
|
- Plugins are now loaded on page load to generate tabs immediately
|
|
- Dynamic tabs use the `.plugin-tab-btn` and `.plugin-tab-content` classes for easy cleanup
|
|
|
|
## How It Works
|
|
|
|
### Tab Generation Flow
|
|
|
|
```
|
|
1. Page loads → DOMContentLoaded
|
|
2. refreshPlugins() called
|
|
3. Fetches /api/plugins/installed with config_schema_data
|
|
4. generatePluginTabs() creates:
|
|
- Tab button: <button class="tab-btn plugin-tab-btn">
|
|
- Tab content: <div class="tab-content plugin-tab-content">
|
|
5. generatePluginConfigForm() creates form from schema
|
|
6. Current config values populated into form
|
|
```
|
|
|
|
### Form Generation Logic
|
|
|
|
Based on JSON Schema `type`:
|
|
|
|
- **boolean** → Toggle switch
|
|
- **number/integer** → Number input with min/max
|
|
- **string** → Text input with maxLength
|
|
- **array** → Comma-separated text input
|
|
- **enum** → Dropdown select
|
|
|
|
### Save Process
|
|
|
|
1. User submits form
|
|
2. `savePluginConfiguration()` processes form data:
|
|
- Converts types per schema (parseInt, parseFloat, split for arrays)
|
|
- Handles boolean checkbox state
|
|
3. Each field sent to `/api/plugins/config` individually
|
|
4. Backend updates `config.json`
|
|
5. Success notification shown
|
|
6. Plugins refreshed to update display
|
|
|
|
## Benefits
|
|
|
|
### For Users
|
|
|
|
- **Organized UI**: Plugin management separate from configuration
|
|
- **Better UX**: Each plugin has its own dedicated space
|
|
- **Type Safety**: Inputs validated based on schema constraints
|
|
- **Easy Reset**: One-click reset to defaults
|
|
- **Clear Labels**: Schema descriptions shown as help text
|
|
|
|
### For Developers
|
|
|
|
- **Automatic**: No custom UI code needed
|
|
- **Declarative**: Just define JSON Schema
|
|
- **Flexible**: Supports all common data types
|
|
- **Validated**: Schema constraints enforced automatically
|
|
|
|
## Key Features
|
|
|
|
1. **Dynamic Tab Creation**: Tabs appear/disappear as plugins are installed/uninstalled
|
|
2. **JSON Schema Driven**: Forms generated from standard JSON Schema
|
|
3. **Type Conversion**: Automatic conversion between HTML form strings and config types
|
|
4. **Default Values**: Schema defaults used when config value missing
|
|
5. **Backward Compatible**: Plugins without schemas still work normally
|
|
|
|
## File Structure
|
|
|
|
```
|
|
LEDMatrix/
|
|
├── web_interface_v2.py # Backend API changes
|
|
├── templates/
|
|
│ └── index_v2.html # Frontend tab generation
|
|
└── docs/
|
|
├── PLUGIN_CONFIGURATION_TABS.md # Full documentation
|
|
└── PLUGIN_CONFIG_TABS_SUMMARY.md # This file
|
|
|
|
plugins/
|
|
├── hello-world/
|
|
│ ├── manifest.json # References config_schema.json
|
|
│ └── config_schema.json # Defines configuration structure
|
|
└── clock-simple/
|
|
├── manifest.json
|
|
└── config_schema.json
|
|
```
|
|
|
|
## Usage Example
|
|
|
|
### For Users
|
|
|
|
1. Install a plugin via Plugin Store
|
|
2. Navigate to Plugins tab
|
|
3. Click "Configure" on plugin card
|
|
4. Plugin's configuration tab opens automatically
|
|
5. Modify settings and click "Save Configuration"
|
|
6. Restart display to apply changes
|
|
|
|
### For Plugin Developers
|
|
|
|
Create `config_schema.json`:
|
|
|
|
```json
|
|
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"type": "object",
|
|
"properties": {
|
|
"enabled": {
|
|
"type": "boolean",
|
|
"default": true
|
|
},
|
|
"message": {
|
|
"type": "string",
|
|
"default": "Hello!",
|
|
"maxLength": 50
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
Reference in `manifest.json`:
|
|
|
|
```json
|
|
{
|
|
"id": "my-plugin",
|
|
"name": "My Plugin",
|
|
"icon": "fas fa-star", // Optional: custom icon
|
|
"config_schema": "config_schema.json"
|
|
}
|
|
```
|
|
|
|
That's it! The configuration tab will be automatically generated.
|
|
|
|
**Tip:** Add an `icon` field to customize your plugin's tab icon. Supports Font Awesome icons, emoji, or custom images. See [PLUGIN_CUSTOM_ICONS.md](PLUGIN_CUSTOM_ICONS.md) for details.
|
|
|
|
## Testing Checklist
|
|
|
|
- [x] Backend loads config schemas
|
|
- [x] Tabs generated for installed plugins
|
|
- [x] Forms render all field types correctly
|
|
- [x] Current values populated
|
|
- [x] Save updates config.json
|
|
- [x] Type conversion works (string → number, string → array)
|
|
- [x] Reset to defaults works
|
|
- [x] Configure button navigates to tab
|
|
- [x] Tabs removed when plugin uninstalled
|
|
- [x] Backward compatible with plugins without schemas
|
|
|
|
## Known Limitations
|
|
|
|
1. **Nested Objects**: Only supports flat property structures
|
|
2. **Conditional Fields**: No support for JSON Schema conditionals
|
|
3. **Custom Validation**: Only basic schema validation supported
|
|
4. **Array of Objects**: Arrays must be primitive types or simple lists
|
|
|
|
## Future Improvements
|
|
|
|
1. Support nested object properties
|
|
2. Add visual validation feedback
|
|
3. Color picker for RGB arrays
|
|
4. File upload support for assets
|
|
5. Configuration presets/templates
|
|
6. Export/import configurations
|
|
7. Plugin-specific custom renderers
|
|
|
|
## Migration Notes
|
|
|
|
- Existing plugins continue to work without changes
|
|
- Plugins with `config_schema.json` automatically get tabs
|
|
- No breaking changes to existing APIs
|
|
- The Plugins tab still handles management operations
|
|
- Raw JSON editor still available as fallback
|
|
|
|
## Related Documentation
|
|
|
|
- [PLUGIN_CONFIGURATION_TABS.md](PLUGIN_CONFIGURATION_TABS.md) - Full user and developer guide
|
|
- [Plugin Store Documentation](plugin_docs/) - Plugin system overview
|
|
- [JSON Schema Draft 07](https://json-schema.org/draft-07/schema) - Schema specification
|
|
|