feat: typed script parameters with validation and icon-grid selector
- Add ScriptParameterConfig model (string, integer, float, boolean, select types) - Server-side validation at both define-time and execute-time - Parameters passed as SCRIPT_PARAM_* environment variables - Web UI parameter editor in script create/edit dialog (add/remove/reorder) - Icon-grid selector component (ported from wled-screen-controller) - Replace audio device dropdown with icon-grid selector - Replace callback event dropdown with icon-grid selector - Localization for parameter UI (en, ru)
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
} from './core.js';
|
||||
import { updateBackgroundColors } from './background.js';
|
||||
import { loadDisplayMonitors } from './links.js';
|
||||
import { IconSelect } from './icon-select.js';
|
||||
|
||||
// Tab management
|
||||
export let activeTab = 'player';
|
||||
@@ -422,6 +423,8 @@ function renderVisualizerFrame() {
|
||||
}
|
||||
|
||||
// Audio device selection
|
||||
let _audioDeviceIconSelect = null;
|
||||
|
||||
export async function loadAudioDevices() {
|
||||
const section = document.getElementById('audioDeviceSection');
|
||||
const select = document.getElementById('audioDeviceSelect');
|
||||
@@ -466,6 +469,22 @@ export async function loadAudioDevices() {
|
||||
}
|
||||
}
|
||||
|
||||
// Enhance with icon grid
|
||||
const audioSvg = '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3A4.5 4.5 0 0 0 14 8.5v7a4.5 4.5 0 0 0 2.5-3.5z"/></svg>';
|
||||
const items = [
|
||||
{ value: '', icon: audioSvg, label: t('settings.audio.auto') },
|
||||
...devices.map(dev => ({ value: dev.name, icon: audioSvg, label: dev.name })),
|
||||
];
|
||||
if (_audioDeviceIconSelect) _audioDeviceIconSelect.destroy();
|
||||
_audioDeviceIconSelect = new IconSelect({
|
||||
target: select,
|
||||
items,
|
||||
columns: 1,
|
||||
horizontal: true,
|
||||
onChange: () => onAudioDeviceChanged(),
|
||||
});
|
||||
_audioDeviceIconSelect.setValue(select.value, false);
|
||||
|
||||
updateAudioDeviceStatus(status);
|
||||
} catch (e) {
|
||||
section.style.display = 'none';
|
||||
|
||||
Reference in New Issue
Block a user