Fix SVG markup in select options, add missing name placeholders

Remove SVG icon function calls from <option> textContent — native
select elements render markup as literal text. Capture template options
now show "name (engine_type)", source options show just the name.

Add i18n placeholders to automation and scene editor name inputs.
Rename HAOS Scenes device from "{server_name} Scenes" to "Scenes".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 20:08:06 +03:00
parent 252db09145
commit 175a2c6c10
10 changed files with 15 additions and 9 deletions

View File

@@ -87,7 +87,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
device_registry.async_get_or_create( device_registry.async_get_or_create(
config_entry_id=entry.entry_id, config_entry_id=entry.entry_id,
identifiers={scenes_identifier}, identifiers={scenes_identifier},
name=f"{server_name} Scenes", name="Scenes",
manufacturer=server_name, manufacturer=server_name,
model="Scene Presets", model="Scene Presets",
configuration_url=server_url, configuration_url=server_url,

View File

@@ -750,7 +750,7 @@ export async function showCSSEditor(cssId = null, cloneData = null) {
const opt = document.createElement('option'); const opt = document.createElement('option');
opt.value = s.id; opt.value = s.id;
opt.dataset.name = s.name; opt.dataset.name = s.name;
opt.textContent = `${getPictureSourceIcon(s.stream_type)} ${s.name}`; opt.textContent = s.name;
sourceSelect.appendChild(opt); sourceSelect.appendChild(opt);
}); });

View File

@@ -428,7 +428,7 @@ export async function showKCEditor(targetId = null, cloneData = null) {
const opt = document.createElement('option'); const opt = document.createElement('option');
opt.value = s.id; opt.value = s.id;
opt.dataset.name = s.name; opt.dataset.name = s.name;
opt.textContent = `${getPictureSourceIcon(s.stream_type)} ${s.name}`; opt.textContent = s.name;
sourceSelect.appendChild(opt); sourceSelect.appendChild(opt);
}); });

View File

@@ -81,7 +81,7 @@ export async function showPatternTemplateEditor(templateId = null, cloneData = n
sources.forEach(s => { sources.forEach(s => {
const opt = document.createElement('option'); const opt = document.createElement('option');
opt.value = s.id; opt.value = s.id;
opt.textContent = `${getPictureSourceIcon(s.stream_type)} ${s.name}`; opt.textContent = s.name;
bgSelect.appendChild(opt); bgSelect.appendChild(opt);
}); });

View File

@@ -282,7 +282,7 @@ async function loadAvailableEngines() {
availableEngines.forEach(engine => { availableEngines.forEach(engine => {
const option = document.createElement('option'); const option = document.createElement('option');
option.value = engine.type; option.value = engine.type;
option.textContent = `${getEngineIcon(engine.type)} ${engine.name}`; option.textContent = engine.name;
if (!engine.available) { if (!engine.available) {
option.disabled = true; option.disabled = true;
option.textContent += ` (${t('templates.engine.unavailable')})`; option.textContent += ` (${t('templates.engine.unavailable')})`;
@@ -1563,7 +1563,7 @@ async function populateStreamModalDropdowns() {
opt.value = tmpl.id; opt.value = tmpl.id;
opt.dataset.name = tmpl.name; opt.dataset.name = tmpl.name;
opt.dataset.engineType = tmpl.engine_type; opt.dataset.engineType = tmpl.engine_type;
opt.textContent = `${getEngineIcon(tmpl.engine_type)} ${tmpl.name}`; opt.textContent = `${tmpl.name} (${tmpl.engine_type})`;
templateSelect.appendChild(opt); templateSelect.appendChild(opt);
}); });
} }
@@ -1581,7 +1581,7 @@ async function populateStreamModalDropdowns() {
const opt = document.createElement('option'); const opt = document.createElement('option');
opt.value = s.id; opt.value = s.id;
opt.dataset.name = s.name; opt.dataset.name = s.name;
opt.textContent = `${getPictureSourceIcon(s.stream_type)} ${s.name}`; opt.textContent = s.name;
sourceSelect.appendChild(opt); sourceSelect.appendChild(opt);
}); });
} }

View File

@@ -551,6 +551,7 @@
"automations.delete.confirm": "Delete automation \"{name}\"?", "automations.delete.confirm": "Delete automation \"{name}\"?",
"automations.name": "Name:", "automations.name": "Name:",
"automations.name.hint": "A descriptive name for this automation", "automations.name.hint": "A descriptive name for this automation",
"automations.name.placeholder": "My Automation",
"automations.enabled": "Enabled:", "automations.enabled": "Enabled:",
"automations.enabled.hint": "Disabled automations won't activate even when conditions are met", "automations.enabled.hint": "Disabled automations won't activate even when conditions are met",
"automations.condition_logic": "Condition Logic:", "automations.condition_logic": "Condition Logic:",
@@ -626,6 +627,7 @@
"scenes.edit": "Edit Scene", "scenes.edit": "Edit Scene",
"scenes.name": "Name:", "scenes.name": "Name:",
"scenes.name.hint": "A descriptive name for this scene preset", "scenes.name.hint": "A descriptive name for this scene preset",
"scenes.name.placeholder": "My Scene",
"scenes.description": "Description:", "scenes.description": "Description:",
"scenes.description.hint": "Optional description of what this scene does", "scenes.description.hint": "Optional description of what this scene does",
"scenes.color": "Card Color:", "scenes.color": "Card Color:",

View File

@@ -551,6 +551,7 @@
"automations.delete.confirm": "Удалить автоматизацию \"{name}\"?", "automations.delete.confirm": "Удалить автоматизацию \"{name}\"?",
"automations.name": "Название:", "automations.name": "Название:",
"automations.name.hint": "Описательное имя для автоматизации", "automations.name.hint": "Описательное имя для автоматизации",
"automations.name.placeholder": "Моя автоматизация",
"automations.enabled": "Включена:", "automations.enabled": "Включена:",
"automations.enabled.hint": "Отключённые автоматизации не активируются даже при выполнении условий", "automations.enabled.hint": "Отключённые автоматизации не активируются даже при выполнении условий",
"automations.condition_logic": "Логика условий:", "automations.condition_logic": "Логика условий:",
@@ -626,6 +627,7 @@
"scenes.edit": "Редактировать сцену", "scenes.edit": "Редактировать сцену",
"scenes.name": "Название:", "scenes.name": "Название:",
"scenes.name.hint": "Описательное имя для этого пресета сцены", "scenes.name.hint": "Описательное имя для этого пресета сцены",
"scenes.name.placeholder": "Моя сцена",
"scenes.description": "Описание:", "scenes.description": "Описание:",
"scenes.description.hint": "Необязательное описание назначения этой сцены", "scenes.description.hint": "Необязательное описание назначения этой сцены",
"scenes.color": "Цвет карточки:", "scenes.color": "Цвет карточки:",

View File

@@ -551,6 +551,7 @@
"automations.delete.confirm": "删除自动化 \"{name}\"", "automations.delete.confirm": "删除自动化 \"{name}\"",
"automations.name": "名称:", "automations.name": "名称:",
"automations.name.hint": "此自动化的描述性名称", "automations.name.hint": "此自动化的描述性名称",
"automations.name.placeholder": "我的自动化",
"automations.enabled": "启用:", "automations.enabled": "启用:",
"automations.enabled.hint": "禁用的自动化即使满足条件也不会激活", "automations.enabled.hint": "禁用的自动化即使满足条件也不会激活",
"automations.condition_logic": "条件逻辑:", "automations.condition_logic": "条件逻辑:",
@@ -626,6 +627,7 @@
"scenes.edit": "编辑场景", "scenes.edit": "编辑场景",
"scenes.name": "名称:", "scenes.name": "名称:",
"scenes.name.hint": "此场景预设的描述性名称", "scenes.name.hint": "此场景预设的描述性名称",
"scenes.name.placeholder": "我的场景",
"scenes.description": "描述:", "scenes.description": "描述:",
"scenes.description.hint": "此场景功能的可选描述", "scenes.description.hint": "此场景功能的可选描述",
"scenes.color": "卡片颜色:", "scenes.color": "卡片颜色:",

View File

@@ -15,7 +15,7 @@
<button type="button" class="hint-toggle" onclick="toggleHint(this)" title="?">?</button> <button type="button" class="hint-toggle" onclick="toggleHint(this)" title="?">?</button>
</div> </div>
<small class="input-hint" style="display:none" data-i18n="automations.name.hint">A descriptive name for this automation</small> <small class="input-hint" style="display:none" data-i18n="automations.name.hint">A descriptive name for this automation</small>
<input type="text" id="automation-editor-name" required> <input type="text" id="automation-editor-name" data-i18n-placeholder="automations.name.placeholder" placeholder="My Automation" required>
</div> </div>
<div class="form-group settings-toggle-group"> <div class="form-group settings-toggle-group">

View File

@@ -15,7 +15,7 @@
<button type="button" class="hint-toggle" onclick="toggleHint(this)" title="?">?</button> <button type="button" class="hint-toggle" onclick="toggleHint(this)" title="?">?</button>
</div> </div>
<small class="input-hint" style="display:none" data-i18n="scenes.name.hint">A descriptive name for this scene preset</small> <small class="input-hint" style="display:none" data-i18n="scenes.name.hint">A descriptive name for this scene preset</small>
<input type="text" id="scene-preset-editor-name" required> <input type="text" id="scene-preset-editor-name" data-i18n-placeholder="scenes.name.placeholder" placeholder="My Scene" required>
</div> </div>
<div class="form-group"> <div class="form-group">