Codebase review: stability, performance, usability, and i18n fixes

Stability:
- Fix race condition: set _is_running before create_task in target processors
- Await probe task after cancel in wled_target_processor
- Replace raw fetch() with fetchWithAuth() across devices, kc-targets, pattern-templates
- Add try/catch to showTestTemplateModal in streams.js
- Wrap blocking I/O in asyncio.to_thread (picture_targets, system restore)
- Fix dashboardStopAll to filter only running targets with ok guard

Performance:
- Vectorize fire effect spark loop with numpy in effect_stream
- Vectorize FFT band binning with cumulative sum in analysis.py
- Rewrite pixel_processor with vectorized numpy (accept ndarray or list)
- Add httpx.AsyncClient connection pooling with lock in wled_provider
- Optimize _send_pixels_http to avoid np.hstack allocation in wled_client
- Mutate chart arrays in-place in dashboard, perf-charts, targets
- Merge dashboard 2-batch fetch into single Promise.all
- Hoist frame_time outside loop in mapped_stream

Usability:
- Fix health check interval load/save in device settings
- Swap confirm modal button classes (No=secondary, Yes=danger)
- Add aria-modal to audio/value source editors, fix close button aria-labels
- Add modal footer close button to settings modal
- Add dedicated calibration LED count validation error keys

i18n:
- Replace ~50 hardcoded English strings with t() calls across 12 JS files
- Add 50 new keys to en.json, ru.json, zh.json
- Localize inline toasts in index.html with window.t fallback
- Add data-i18n to command palette footer
- Add localization policy to CLAUDE.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 12:12:37 +03:00
parent c95c6e9a44
commit bd8d7a019f
31 changed files with 460 additions and 233 deletions

View File

@@ -992,5 +992,54 @@
"settings.saved_backups.download": "Download",
"settings.saved_backups.delete": "Delete",
"settings.saved_backups.delete_confirm": "Delete this backup file?",
"settings.saved_backups.delete_error": "Failed to delete backup"
"settings.saved_backups.delete_error": "Failed to delete backup",
"device.error.power_off_failed": "Failed to turn off device",
"device.removed": "Device removed",
"device.error.remove_failed": "Failed to remove device",
"device.error.settings_load_failed": "Failed to load device settings",
"device.error.brightness": "Failed to update brightness",
"device.error.required": "Please fill in all fields correctly",
"device.error.update": "Failed to update device",
"device.error.save": "Failed to save settings",
"device_discovery.error.fill_all_fields": "Please fill in all fields",
"device_discovery.added": "Device added successfully",
"device_discovery.error.add_failed": "Failed to add device",
"calibration.error.load_failed": "Failed to load calibration",
"calibration.error.css_load_failed": "Failed to load color strip source",
"calibration.error.test_toggle_failed": "Failed to toggle test edge",
"calibration.saved": "Calibration saved",
"calibration.error.save_failed": "Failed to save calibration",
"calibration.error.led_count_mismatch": "Total LEDs must equal the device LED count",
"calibration.error.led_count_exceeded": "Calibrated LEDs exceed the total LED count",
"dashboard.error.profile_toggle_failed": "Failed to toggle profile",
"dashboard.error.start_failed": "Failed to start processing",
"dashboard.error.stop_failed": "Failed to stop processing",
"dashboard.error.autostart_toggle_failed": "Failed to toggle auto-start",
"dashboard.error.stop_all": "Failed to stop all targets",
"target.error.editor_open_failed": "Failed to open target editor",
"target.error.start_failed": "Failed to start target",
"target.error.stop_failed": "Failed to stop target",
"target.error.clone_failed": "Failed to clone target",
"target.error.autostart_toggle_failed": "Failed to toggle auto-start",
"target.error.delete_failed": "Failed to delete target",
"audio_source.error.load": "Failed to load audio source",
"audio_template.error.clone_failed": "Failed to clone audio template",
"value_source.error.load": "Failed to load value source",
"color_strip.error.editor_open_failed": "Failed to open color strip editor",
"color_strip.error.clone_failed": "Failed to clone color strip source",
"color_strip.error.delete_failed": "Failed to delete color strip source",
"pattern.error.editor_open_failed": "Failed to open pattern template editor",
"pattern.error.clone_failed": "Failed to clone pattern template",
"pattern.error.delete_failed": "Failed to delete pattern template",
"pattern.error.capture_bg_failed": "Failed to capture background",
"stream.error.clone_picture_failed": "Failed to clone picture source",
"stream.error.clone_capture_failed": "Failed to clone capture template",
"stream.error.clone_pp_failed": "Failed to clone postprocessing template",
"kc_target.error.editor_open_failed": "Failed to open key colors editor",
"kc_target.error.clone_failed": "Failed to clone key colors target",
"kc_target.error.delete_failed": "Failed to delete key colors target",
"theme.switched.dark": "Switched to dark theme",
"theme.switched.light": "Switched to light theme",
"accent.color.updated": "Accent color updated",
"search.footer": "↑↓ navigate · Enter select · Esc close"
}

View File

@@ -992,5 +992,54 @@
"settings.saved_backups.download": "Скачать",
"settings.saved_backups.delete": "Удалить",
"settings.saved_backups.delete_confirm": "Удалить эту резервную копию?",
"settings.saved_backups.delete_error": "Не удалось удалить копию"
"settings.saved_backups.delete_error": "Не удалось удалить копию",
"device.error.power_off_failed": "Не удалось выключить устройство",
"device.removed": "Устройство удалено",
"device.error.remove_failed": "Не удалось удалить устройство",
"device.error.settings_load_failed": "Не удалось загрузить настройки устройства",
"device.error.brightness": "Не удалось обновить яркость",
"device.error.required": "Пожалуйста, заполните все поля",
"device.error.update": "Не удалось обновить устройство",
"device.error.save": "Не удалось сохранить настройки",
"device_discovery.error.fill_all_fields": "Пожалуйста, заполните все поля",
"device_discovery.added": "Устройство успешно добавлено",
"device_discovery.error.add_failed": "Не удалось добавить устройство",
"calibration.error.load_failed": "Не удалось загрузить калибровку",
"calibration.error.css_load_failed": "Не удалось загрузить источник цветовой полосы",
"calibration.error.test_toggle_failed": "Не удалось переключить тестовый край",
"calibration.saved": "Калибровка сохранена",
"calibration.error.save_failed": "Не удалось сохранить калибровку",
"calibration.error.led_count_mismatch": "Общее количество LED должно совпадать с количеством LED устройства",
"calibration.error.led_count_exceeded": "Калиброванных LED больше, чем общее количество LED",
"dashboard.error.profile_toggle_failed": "Не удалось переключить профиль",
"dashboard.error.start_failed": "Не удалось запустить обработку",
"dashboard.error.stop_failed": "Не удалось остановить обработку",
"dashboard.error.autostart_toggle_failed": "Не удалось переключить автозапуск",
"dashboard.error.stop_all": "Не удалось остановить все цели",
"target.error.editor_open_failed": "Не удалось открыть редактор цели",
"target.error.start_failed": "Не удалось запустить цель",
"target.error.stop_failed": "Не удалось остановить цель",
"target.error.clone_failed": "Не удалось клонировать цель",
"target.error.autostart_toggle_failed": "Не удалось переключить автозапуск",
"target.error.delete_failed": "Не удалось удалить цель",
"audio_source.error.load": "Не удалось загрузить аудиоисточник",
"audio_template.error.clone_failed": "Не удалось клонировать аудиошаблон",
"value_source.error.load": "Не удалось загрузить источник значений",
"color_strip.error.editor_open_failed": "Не удалось открыть редактор цветовой полосы",
"color_strip.error.clone_failed": "Не удалось клонировать источник цветовой полосы",
"color_strip.error.delete_failed": "Не удалось удалить источник цветовой полосы",
"pattern.error.editor_open_failed": "Не удалось открыть редактор шаблона узоров",
"pattern.error.clone_failed": "Не удалось клонировать шаблон узоров",
"pattern.error.delete_failed": "Не удалось удалить шаблон узоров",
"pattern.error.capture_bg_failed": "Не удалось захватить фон",
"stream.error.clone_picture_failed": "Не удалось клонировать источник изображения",
"stream.error.clone_capture_failed": "Не удалось клонировать шаблон захвата",
"stream.error.clone_pp_failed": "Не удалось клонировать шаблон постобработки",
"kc_target.error.editor_open_failed": "Не удалось открыть редактор ключевых цветов",
"kc_target.error.clone_failed": "Не удалось клонировать цель ключевых цветов",
"kc_target.error.delete_failed": "Не удалось удалить цель ключевых цветов",
"theme.switched.dark": "Переключено на тёмную тему",
"theme.switched.light": "Переключено на светлую тему",
"accent.color.updated": "Цвет акцента обновлён",
"search.footer": "↑↓ навигация · Enter выбор · Esc закрыть"
}

View File

@@ -992,5 +992,54 @@
"settings.saved_backups.download": "下载",
"settings.saved_backups.delete": "删除",
"settings.saved_backups.delete_confirm": "删除此备份文件?",
"settings.saved_backups.delete_error": "删除备份失败"
"settings.saved_backups.delete_error": "删除备份失败",
"device.error.power_off_failed": "关闭设备失败",
"device.removed": "设备已移除",
"device.error.remove_failed": "移除设备失败",
"device.error.settings_load_failed": "加载设备设置失败",
"device.error.brightness": "更新亮度失败",
"device.error.required": "请填写所有字段",
"device.error.update": "更新设备失败",
"device.error.save": "保存设置失败",
"device_discovery.error.fill_all_fields": "请填写所有字段",
"device_discovery.added": "设备添加成功",
"device_discovery.error.add_failed": "添加设备失败",
"calibration.error.load_failed": "加载校准失败",
"calibration.error.css_load_failed": "加载色带源失败",
"calibration.error.test_toggle_failed": "切换测试边缘失败",
"calibration.saved": "校准已保存",
"calibration.error.save_failed": "保存校准失败",
"calibration.error.led_count_mismatch": "LED总数必须等于设备LED数量",
"calibration.error.led_count_exceeded": "校准的LED超过了LED总数",
"dashboard.error.profile_toggle_failed": "切换配置文件失败",
"dashboard.error.start_failed": "启动处理失败",
"dashboard.error.stop_failed": "停止处理失败",
"dashboard.error.autostart_toggle_failed": "切换自动启动失败",
"dashboard.error.stop_all": "停止所有目标失败",
"target.error.editor_open_failed": "打开目标编辑器失败",
"target.error.start_failed": "启动目标失败",
"target.error.stop_failed": "停止目标失败",
"target.error.clone_failed": "克隆目标失败",
"target.error.autostart_toggle_failed": "切换自动启动失败",
"target.error.delete_failed": "删除目标失败",
"audio_source.error.load": "加载音频源失败",
"audio_template.error.clone_failed": "克隆音频模板失败",
"value_source.error.load": "加载数值源失败",
"color_strip.error.editor_open_failed": "打开色带编辑器失败",
"color_strip.error.clone_failed": "克隆色带源失败",
"color_strip.error.delete_failed": "删除色带源失败",
"pattern.error.editor_open_failed": "打开图案模板编辑器失败",
"pattern.error.clone_failed": "克隆图案模板失败",
"pattern.error.delete_failed": "删除图案模板失败",
"pattern.error.capture_bg_failed": "捕获背景失败",
"stream.error.clone_picture_failed": "克隆图片源失败",
"stream.error.clone_capture_failed": "克隆捕获模板失败",
"stream.error.clone_pp_failed": "克隆后处理模板失败",
"kc_target.error.editor_open_failed": "打开关键颜色编辑器失败",
"kc_target.error.clone_failed": "克隆关键颜色目标失败",
"kc_target.error.delete_failed": "删除关键颜色目标失败",
"theme.switched.dark": "已切换到深色主题",
"theme.switched.light": "已切换到浅色主题",
"accent.color.updated": "强调色已更新",
"search.footer": "↑↓ 导航 · Enter 选择 · Esc 关闭"
}