General settings: About block — card version, GitHub and Telegram links
Validate / hacs (push) Failing after 9s
Validate / hassfest (push) Failing after 8s
Validate / frontend (push) Successful in 2m22s
Validate / backend (push) Failing after 7m51s
Validate / smoke (push) Failing after 1m3s

- new i18n group gs.about_* (en/ru), rendered after the Sun group
- version line reuses CARD_VERSION (integration version is not exposed
  to the frontend by any backend response, so no second line)
- links open in a new tab (rel=noopener), mdi:github / mdi:send icons
- demo icons.js: added the two mdi paths for the ha-icon shim
- smoke_general_settings: pins the About group, the rendered version
  (must equal CARD_VERSION extracted from the built bundle) and both
  link href/target/rel; verified red on the pre-feature bundle
This commit is contained in:
Matysh
2026-08-03 17:04:53 +03:00
parent ca66791440
commit 53e1c7163d
9 changed files with 147 additions and 30 deletions
File diff suppressed because one or more lines are too long
+19 -2
View File
@@ -1,4 +1,5 @@
import { launch, checkAll, finish } from './serve.mjs';
import { launch, check, checkAll, finish } from './serve.mjs';
import { readFileSync } from 'node:fs';
const { page, browser } = await launch();
const res = await page.evaluate(async () => {
const out = {};
@@ -8,6 +9,10 @@ const res = await page.evaluate(async () => {
c._openSettingsDialog(); await c.updateComplete;
out.rows = sr().querySelectorAll('.gsrow').length;
out.groups = [...sr().querySelectorAll('.dialog .dispsection')].map((l) => l.textContent.trim());
// 1b) блок About: версия + две внешние ссылки (target=_blank rel=noopener)
out.aboutVersion = sr().querySelector('.dialog .aboutver')?.textContent.trim() ?? null;
out.aboutLinks = [...sr().querySelectorAll('.dialog a.aboutlink')].map((a) => ({
href: a.getAttribute('href'), target: a.getAttribute('target'), rel: a.getAttribute('rel') }));
// 2) сменить цвет light_on и сохранить
c._setFillColor('light_on', { c: '#ff00ff', a: 0.5 });
await c._saveSettingsDialog(); await c.updateComplete;
@@ -26,10 +31,22 @@ const res = await page.evaluate(async () => {
out.lqiAfter = sr().querySelectorAll('.dev .lqi').length;
return out;
});
// CARD_VERSION из собранного бандла (тот же текст уходит в console-баннер).
// terser либо инлайнит строку (v1.56.0), либо оставляет переменную (v${xx}) —
// во втором случае доразрешаем её по присваиванию xx="1.56.0".
const bundle = readFileSync(new URL('./srv/assets/houseplan-card.js', import.meta.url), 'utf8');
const m = bundle.match(/HOUSEPLAN-CARD %c v(?:(\d+\.\d+\.\d+)|\$\{(\w+)\})/);
const BUNDLE_VERSION = m?.[1] ?? (m?.[2] && bundle.match(new RegExp(`[^\\w$]${m[2]}="(\\d+\\.\\d+\\.\\d+)"`))?.[1]);
check('bundleVersionFound', typeof BUNDLE_VERSION === 'string' && BUNDLE_VERSION.length > 0);
// значения зафиксированы прогоном на v1.43.1 и сверены с кодом (audit T1)
checkAll(res, {
"rows": 14, // 10 цветов + радиус свечения + режим фона + цвет фона + погода (docs/SUN.md)
"groups": ["Fill: lights", "Fill: temperature", "Fill: zigbee signal", "Light-sources fill", "Stage background", "Sun"],
"groups": ["Fill: lights", "Fill: temperature", "Fill: zigbee signal", "Light-sources fill", "Stage background", "Sun", "About"],
"aboutVersion": `Houseplan Card v${BUNDLE_VERSION}`, // та же константа, что в баннере
"aboutLinks": [
{ "href": "https://github.com/Matysh/houseplan-card", "target": "_blank", "rel": "noopener" },
{ "href": "https://t.me/ha_houseplan", "target": "_blank", "rel": "noopener" },
],
"saved": {"c": "#ff00ff", "a": 0.5},
"lqiBefore": 7,
"lqiAfter": 0,
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+32 -9
View File
File diff suppressed because one or more lines are too long
+6
View File
@@ -4973,6 +4973,12 @@ class HouseplanCard extends LitElement {
)}
</datalist>
</div>
<label class="dispsection">${this._t('gs.about_group')}</label>
<div class="aboutver">${this._t('gs.about_version', { v: CARD_VERSION })}</div>
<a class="aboutlink" href="https://github.com/Matysh/houseplan-card" target="_blank" rel="noopener">
<ha-icon icon="mdi:github"></ha-icon>${this._t('gs.about_github')}</a>
<a class="aboutlink" href="https://t.me/ha_houseplan" target="_blank" rel="noopener">
<ha-icon icon="mdi:send"></ha-icon>${this._t('gs.about_telegram')}</a>
</div>
<div class="row">
<button class="btn ghost" @click=${() =>
+4
View File
@@ -400,6 +400,10 @@
"gs.sun_rays": "Sunlight through windows",
"gs.weather": "Weather entity",
"gs.weather_ph": "weather.home (optional)",
"gs.about_group": "About",
"gs.about_version": "Houseplan Card v{v}",
"gs.about_github": "GitHub \u00b7 docs & issues",
"gs.about_telegram": "Telegram chat",
"space.bg_color": "Background around the plan",
"space.bg_inherit": "Inherit general",
"space.bg_inherited": "inherits general settings",
+4
View File
@@ -400,6 +400,10 @@
"gs.sun_rays": "Солнце в окнах",
"gs.weather": "Сущность погоды",
"gs.weather_ph": "weather.home (необязательно)",
"gs.about_group": "\u041e \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0435",
"gs.about_version": "Houseplan Card v{v}",
"gs.about_github": "GitHub \u00b7 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438 issues",
"gs.about_telegram": "\u0427\u0430\u0442 \u0432 Telegram",
"space.bg_color": "Цвет фона вокруг плана",
"space.bg_inherit": "Наследовать общий",
"space.bg_inherited": "наследуется из общих настроек",
+17
View File
@@ -1858,6 +1858,23 @@ export const cardStyles = css`
font-size: var(--fs-m);
color: var(--hp-muted);
}
.aboutver {
font-size: var(--fs-s);
color: var(--hp-muted);
margin: var(--sp-2) 0 var(--sp-3);
}
.aboutlink {
display: flex;
align-items: center;
gap: var(--sp-3);
width: fit-content;
color: var(--hp-accent);
text-decoration: none;
font-size: var(--fs-m);
padding: var(--sp-1) 0;
}
.aboutlink:hover { text-decoration: underline; }
.aboutlink ha-icon { --mdc-icon-size: 18px; line-height: 1; }
.dialogwrap {
background: rgba(0, 0, 0, 0.45);
display: flex;