From 1b5b04afaa73df9ae5ff4dd5ac45d7d0c8d13d85 Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Mon, 23 Mar 2026 15:01:45 +0300 Subject: [PATCH] feat: add scene crosslinks to automation cards Scene name and fallback scene in automation cards are now clickable, navigating to the corresponding scene preset card. Also renders the deactivation mode label which was previously set but never displayed. --- .../static/js/features/automations.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/server/src/wled_controller/static/js/features/automations.ts b/server/src/wled_controller/static/js/features/automations.ts index d392fbf..4f92ba6 100644 --- a/server/src/wled_controller/static/js/features/automations.ts +++ b/server/src/wled_controller/static/js/features/automations.ts @@ -9,7 +9,7 @@ import { showToast, showConfirm, setTabRefreshing } from '../core/ui.ts'; import { Modal } from '../core/modal.ts'; import { CardSection } from '../core/card-sections.ts'; import { updateTabBadge, updateSubTabHash } from './tabs.ts'; -import { ICON_SETTINGS, ICON_START, ICON_PAUSE, ICON_CLOCK, ICON_AUTOMATION, ICON_HELP, ICON_OK, ICON_TIMER, ICON_MONITOR, ICON_RADIO, ICON_SCENE, ICON_CLONE, ICON_TRASH, ICON_CIRCLE_OFF } from '../core/icons.ts'; +import { ICON_SETTINGS, ICON_START, ICON_PAUSE, ICON_CLOCK, ICON_AUTOMATION, ICON_HELP, ICON_OK, ICON_TIMER, ICON_MONITOR, ICON_RADIO, ICON_SCENE, ICON_CLONE, ICON_TRASH, ICON_CIRCLE_OFF, ICON_UNDO } from '../core/icons.ts'; import * as P from '../core/icon-paths.ts'; import { wrapCard } from '../core/card-colors.ts'; import { TagInput, renderTagChips } from '../core/tag-input.ts'; @@ -255,12 +255,17 @@ function createAutomationCard(automation: Automation, sceneMap = new Map()) { const sceneColor = scene ? scene.color || '#4fc3f7' : '#888'; // Deactivation mode label - let deactivationLabel = ''; + let deactivationMeta = ''; if (automation.deactivation_mode === 'revert') { - deactivationLabel = t('automations.deactivation_mode.revert'); + deactivationMeta = `${ICON_UNDO} ${t('automations.deactivation_mode.revert')}`; } else if (automation.deactivation_mode === 'fallback_scene') { const fallback = automation.deactivation_scene_preset_id ? sceneMap.get(automation.deactivation_scene_preset_id) : null; - deactivationLabel = fallback ? `${t('automations.deactivation_mode.fallback_scene')}: ${escapeHtml(fallback.name)}` : t('automations.deactivation_mode.fallback_scene'); + if (fallback) { + const fbColor = fallback.color || '#4fc3f7'; + deactivationMeta = `${ICON_UNDO} ${escapeHtml(fallback.name)}`; + } else { + deactivationMeta = `${ICON_UNDO} ${t('automations.deactivation_mode.fallback_scene')}`; + } } let lastActivityMeta = ''; @@ -284,7 +289,8 @@ function createAutomationCard(automation: Automation, sceneMap = new Map()) {
${condPills} - ${ICON_SCENE} ${sceneName} + ${ICON_SCENE} ${sceneName} + ${deactivationMeta}
${renderTagChips(automation.tags)}`, actions: `