diff --git a/docs/releases/console-3.1.8.md b/docs/releases/console-3.1.8.md new file mode 100644 index 0000000..315027b --- /dev/null +++ b/docs/releases/console-3.1.8.md @@ -0,0 +1,13 @@ +# Console 3.1.8 + +Release date: 2026-10-04. + +- Explain each service's actual purpose through the existing help control, including the separation between OS environment, client, camera discovery and video streaming. +- Show FFmpeg availability/version in the IP Camera Streaming card even when the service is not installed; warn when the dependency is missing. +- Show a clear reason for failed installation and provide an on-demand installation log button in the matching module card. +- Bind log requests to the latest installation job, reject mismatched jobs, cap output at 64 KB / 300 lines, escape rendered text and redact sensitive log lines. +- Keep log access behind Console authentication and reuse the shared dialog and diagnostic styles. + +This release improves diagnostics; it does not add FFmpeg to Edge Environment or silently install it. Streaming installer 1.0.2 still requires that dependency. + +Validation: backend and stage-owner tests; browser checks at 360, 768, 1024 and 1440 pixels for service-specific help, on-demand log requests, escaped output, dialog viewport bounds and Escape closure. Existing Console dialog is the shared owner; its scrolling now respects symmetric viewport insets. diff --git a/offline/stage_versions.py b/offline/stage_versions.py index be06b08..fc419e1 100644 --- a/offline/stage_versions.py +++ b/offline/stage_versions.py @@ -172,10 +172,48 @@ def job_status(): return job + +def installation_log(stage, unit=""): + """Only the latest job owns install.log; never accept a filesystem path.""" + job = read_json(STATE / 'job.json') + if stage not in STAGES or job.get('stage') != stage or (unit and job.get('unit') != unit): + raise ValueError('Installation log belongs to a different job; refresh the card') + try: + with (STATE / 'install.log').open('rb') as stream: + stream.seek(0, 2) + size = stream.tell() + stream.seek(max(0, size - 65536)) + text = stream.read(65536).decode('utf-8', errors='replace') + except OSError: + text = '' + latest_job = read_json(STATE / 'job.json') + if (latest_job.get('stage'), latest_job.get('unit')) != (job.get('stage'), job.get('unit')): + raise ValueError('Installation job changed; refresh the card') + reason = '' + if job.get('state') in ('failed', 'interrupted'): + reason = ('FFmpeg is missing. The streaming installer stopped before creating the service.' + if 'ffmpeg is required' in text else + 'Installation did not complete. Open the installation log for details.') + # Installer output can include URLs and environment diagnostics. + text = re.sub(r'(?i)(https?://|rtsp://)[^/\s@]+@', r'\1[redacted]@', text) + text = re.sub(r'(?im)^.*(?:password|passwd|authorization|secret|token|credential|private.key).*$','[sensitive line hidden]',text) + lines = text.splitlines()[-300:] + return {'ok': True, 'stage': stage, 'unit': job.get('unit'), + 'state': job.get('state'), 'reason': reason, 'lines': lines, + 'truncated': size > 65536 or len(text.splitlines()) > 300} if text else { + 'ok': True, 'stage': stage, 'unit': job.get('unit'), 'state': job.get('state'), + 'reason': reason, 'lines': [], 'truncated': False} + + def snapshot(cards): request_check() available = read_json(STATE / 'available.json') job = job_status() + if job.get('stage') in STAGES and job.get('state') in ('failed', 'interrupted'): + try: + job = {**job, 'reason': installation_log(job['stage'], job.get('unit', ''))['reason']} + except ValueError: + job = job_status() busy = job.get('state') in ('queued', 'running') or installer_busy() fresh = bool(available.get('commit') and not available.get('error') and time.time() - available.get('checked_at', 0) <= CHECK_TTL) diff --git a/offline/test_stage_versions.py b/offline/test_stage_versions.py index c68e38b..9349756 100644 --- a/offline/test_stage_versions.py +++ b/offline/test_stage_versions.py @@ -50,6 +50,26 @@ class StageVersionsTest(unittest.TestCase): with self.assertRaises(ValueError): versions.validate_manifest(raw) + def test_install_log_is_bounded_redacted_and_bound_to_job(self): + versions.delivery.write_json(versions.STATE / 'job.json', { + 'stage': 'stage_ip_stream', 'unit': 'job-1', 'state': 'failed'}) + (versions.STATE / 'install.log').write_text( + 'line\n' * 500 + 'ffmpeg is required\nhttps://user:pass@host/path\nTOKEN=secret\n') + result = versions.installation_log('stage_ip_stream', 'job-1') + self.assertTrue(result['truncated']) + self.assertEqual(300, len(result['lines'])) + self.assertIn('FFmpeg is missing', result['reason']) + self.assertNotIn('user:pass', str(result)) + self.assertNotIn('TOKEN=secret', str(result)) + for stage, unit in [('stage_ui', 'job-1'), ('stage_ip_stream', 'old-job'), ('../../etc/passwd', '')]: + with self.assertRaises(ValueError): + versions.installation_log(stage, unit) + + def test_missing_install_log_is_reported_without_read_failure(self): + versions.delivery.write_json(versions.STATE / 'job.json', { + 'stage': 'stage_ip_stream', 'unit': 'job-1', 'state': 'failed'}) + self.assertEqual([], versions.installation_log('stage_ip_stream')['lines']) + def test_every_stage_has_matching_manifest(self): for stage, release in self.catalog['stages'].items(): self.assertEqual(release, json.loads((ROOT / stage / 'version.json').read_text())) diff --git a/stage-releases.json b/stage-releases.json index 88d2884..d0e7016 100644 --- a/stage-releases.json +++ b/stage-releases.json @@ -14,7 +14,7 @@ "version": "1.0.0" }, "stage_ui": { - "version": "3.1.7" + "version": "3.1.8" }, "stage_avahi": { "version": "1.0.0" diff --git a/stage_ui/console_core/backend/app.py b/stage_ui/console_core/backend/app.py index c89c7e6..01141bc 100644 --- a/stage_ui/console_core/backend/app.py +++ b/stage_ui/console_core/backend/app.py @@ -54,7 +54,7 @@ APP_DIR = "/opt/iomatex-console" PUBLIC_DIR = os.path.join(APP_DIR, "public") PROVIDERS_DIR = os.path.join(APP_DIR, "providers.d") CONFIG_PATH = "/etc/iomatex/console.json" -UI_VERSION = "V 3.1.7" +UI_VERSION = "V 3.1.8" STORAGE_HEALTH_COMMAND = "/usr/local/sbin/iomatex-storage-health" ZONEINFO_ROOT = "/usr/share/zoneinfo" @@ -3371,6 +3371,14 @@ class Handler(BaseHTTPRequestHandler): except Exception as exc: self.send_json({"ok": False, "error": str(exc)}, code=500) return + if parsed.path == "/api/stages/log": + query = parse_qs(parsed.query) + try: + self.send_json(stage_versions.installation_log( + query.get("stage", [""])[0], query.get("unit", [""])[0])) + except ValueError as exc: + self.send_json({"ok": False, "error": str(exc)}, code=409) + return if parsed.path == "/api/system/timezone": try: self.send_json(get_timezone_payload(include_available=True)) diff --git a/stage_ui/console_core/backend/test_service_diagnostics.py b/stage_ui/console_core/backend/test_service_diagnostics.py new file mode 100644 index 0000000..1f1c364 --- /dev/null +++ b/stage_ui/console_core/backend/test_service_diagnostics.py @@ -0,0 +1,30 @@ +import importlib.util +from pathlib import Path +import unittest +from unittest.mock import patch + +ROOT = Path(__file__).resolve().parents[1] +spec = importlib.util.spec_from_file_location('diagnostic_provider', ROOT / 'providers/00_core_services.py') +provider = importlib.util.module_from_spec(spec) +spec.loader.exec_module(provider) + +class ServiceDiagnosticsTest(unittest.TestCase): + def test_ffmpeg_is_visible_even_before_service_installation(self): + ctx = {'systemd_unit': lambda _: {'installed': False, 'active': False, 'active_state': 'inactive', 'result': '', 'exec_main_status': '', 'raw_error': ''}, + 'read_text': lambda _: '{}', 'run': lambda *a, **kw: (0, 'ffmpeg version 4.3.7\n', '')} + for path, expected in [(None, 'Not installed'), ('/usr/bin/ffmpeg', 'ffmpeg version 4.3.7')]: + with patch.object(provider.shutil, 'which', return_value=path): + card = provider.ip_stream_card(ctx) + self.assertEqual({'label': 'FFmpeg', 'value': expected}, card['details'][0]) + self.assertEqual(not bool(path), bool(card['warnings'])) + + def test_shared_help_and_log_controls(self): + source = (ROOT / 'frontend/console.js').read_text() + for service in ['console', 'environment', 'itscreen', 'ip_stream', 'mosquitto', + 'mqtt_bridge', 'zigbee2mqtt', 'cockpit', 'reverse_tunnel', 'avahi', 'display', 'access_point']: + self.assertIn('"'+service+'": {', source) + self.assertIn('`service:${card.id}`', source) + self.assertIn('window.__stageInstallLog', source) + self.assertIn('esc(details)', source) + app = (ROOT / 'backend/app.py').read_text() + self.assertGreater(app.index('if parsed.path == "/api/stages/log"'), app.index('if not self.require_auth(parsed):')) diff --git a/stage_ui/console_core/backend/test_service_diagnostics_browser.cjs b/stage_ui/console_core/backend/test_service_diagnostics_browser.cjs new file mode 100644 index 0000000..f374d55 --- /dev/null +++ b/stage_ui/console_core/backend/test_service_diagnostics_browser.cjs @@ -0,0 +1,34 @@ +// Optional live Console smoke test; requires EDGE_PASSWORD and mounted /repo. +const {chromium}=require('playwright'); +const base=process.env.EDGE_CONSOLE_URL || 'http://192.168.0.109'; +(async()=>{ + const browser=await chromium.launch({headless:true}); + for(const width of [360,768,1024,1440]){ + const ctx=await browser.newContext({viewport:{width,height:900}}); + await ctx.request.post(base+'/api/auth/login',{data:{username:'iomatex',password:process.env.EDGE_PASSWORD}}); + const page=await ctx.newPage();const errors=[];page.on('pageerror',e=>errors.push(e.message));let logs=0; + await page.route('**/*',async route=>{ + const p=new URL(route.request().url()).pathname; + if(['/console.js','/console.css','/console.i18n.js'].includes(p))return route.fulfill({path:'/repo/stage_ui/console_core/frontend'+p}); + if(p==='/api/stages/log'){logs++;return route.fulfill({json:{stage:'stage_ip_stream',state:'failed',reason:'FFmpeg is missing. The streaming installer stopped before creating the service.',lines:Array(300).fill('ffmpeg is required; '),truncated:true}})} + if(p==='/api/health/services'){ + const r=await route.fetch();const d=await r.json();d.updates.job={stage:'stage_ip_stream',unit:'fixture',state:'failed',reason:'FFmpeg is missing. The streaming installer stopped before creating the service.'}; + d.services.find(s=>s.id==='ip_stream').details=[{label:'FFmpeg',value:'Not installed'}];return route.fulfill({json:d}); + }return route.continue(); + }); + await page.goto(base+'/',{waitUntil:'networkidle'}); + if(logs!==0)throw Error('Eager log fetch'); + await page.locator('[onclick="window.__openHelp(\'service:console\')"]').click(); + await page.locator('.helpModal').waitFor(); + if(!(await page.locator('.helpModal').innerText()).includes('local device control'))throw Error('Generic help'); + await page.evaluate(()=>window.__closeHelp()); + await page.locator('button[onclick^="window.__stageInstallLog"]').click(); + const modal=page.locator('.platformDialog');await modal.waitFor(); + const bounds=await modal.boundingBox();if(bounds.y<19||bounds.y+bounds.height>881)throw Error('Modal overflow '+width); + if(await modal.locator('script').count())throw Error('Unescaped output'); + await page.keyboard.press('Escape');await modal.waitFor({state:'detached'}); + if(logs!==1||errors.length)throw Error(errors.join(';')||'Log requests mismatch'); + console.log('help, lazy logs, escaping, viewport and Escape passed at '+width); + await ctx.request.post(base+'/api/auth/logout',{data:{}});await ctx.close(); + }await browser.close(); +})().catch(e=>{console.error(e);process.exit(1)}); diff --git a/stage_ui/console_core/frontend/console.css b/stage_ui/console_core/frontend/console.css index 90e5862..9242b00 100644 --- a/stage_ui/console_core/frontend/console.css +++ b/stage_ui/console_core/frontend/console.css @@ -1568,6 +1568,9 @@ html[dir="rtl"] .timezoneOption{text-align:right} } .modalCard{ width:min(520px,100%); + max-height:calc(100vh - 40px); + max-height:calc(100dvh - 40px); + overflow:auto; padding:20px; border:1px solid var(--line); border-radius:18px; diff --git a/stage_ui/console_core/frontend/console.i18n.js b/stage_ui/console_core/frontend/console.i18n.js index 93f7594..cd80718 100644 --- a/stage_ui/console_core/frontend/console.i18n.js +++ b/stage_ui/console_core/frontend/console.i18n.js @@ -2126,4 +2126,5 @@ "Critical": "गंभीर", "Wear is a coarse JEDEC estimate. This eMMC does not expose exact power-on hours or write cycles.": "घिसाव एक मोटा JEDEC अनुमान है। यह eMMC सटीक चालू घंटे या लेखन चक्र नहीं बताती।" }); + Object.assign(window.ConsoleI18n.translations.ru, {"Installation log": "Лог установки", "FFmpeg is required for camera video and snapshots.": "Для видео и снимков камер необходим FFmpeg.", "FFmpeg is missing. The streaming installer stopped before creating the service.": "FFmpeg отсутствует. Установка видеосервиса остановилась до создания службы.", "Installation did not complete. Open the installation log for details.": "Установка не завершена. Откройте лог установки для выяснения причины.", "Installed but unavailable": "Установлен, но не работает", "Showing the last 300 lines (maximum 64 KB).": "Показаны последние 300 строк (не более 64 КБ).", "Installation log is empty": "Лог установки пока пуст"}); })(); diff --git a/stage_ui/console_core/frontend/console.js b/stage_ui/console_core/frontend/console.js index 60edd38..8d03a86 100644 --- a/stage_ui/console_core/frontend/console.js +++ b/stage_ui/console_core/frontend/console.js @@ -48,7 +48,7 @@ { mode: "test_by", label: "test.it-screen.by", host: "rest.test.it-screen.by" }, { mode: "custom", label: "Custom", host: "" } ]; - const UI_VERSION = "V 3.1.7"; + const UI_VERSION = "V 3.1.8"; const ITSCREEN_LOG_INITIAL_LINES = 50; const ITSCREEN_LOG_BUFFER_LIMIT = 300; const ITSCREEN_LOG_BATCH_MS = 250; @@ -653,7 +653,167 @@ return String(value || ""); } + const SERVICE_HELP = { + "console": { + "title": { + "en": "Edge Console", + "ru": "Edge Console" + }, + "body": [ + { + "en": "The local device control panel: network, registration, diagnostics and module updates. Updating Console does not update the player or install camera streaming.", + "ru": "Локальная панель управления устройством: сеть, регистрация, диагностика и обновление модулей. Обновление Console не обновляет клиент и не устанавливает видеосервис камер." + } + ] + }, + "environment": { + "title": { + "en": "Edge environment", + "ru": "Edge environment" + }, + "body": [ + { + "en": "Prepares OS users, storage and system startup. Version 1.0.3 adds backed-up userdata recovery. This stage does not install the FFmpeg command used by camera streaming; Installed means the environment stage is present, not that every optional dependency exists.", + "ru": "Подготавливает системных пользователей, хранилище и запуск ОС. Версия 1.0.3 добавляет восстановление userdata с резервной копией. Этот модуль не устанавливает команду FFmpeg для камер. Статус Installed относится к окружению, а не ко всем дополнительным программам." + } + ] + }, + "itscreen": { + "title": { + "en": "IT-Screen App", + "ru": "IT-Screen App" + }, + "body": [ + { + "en": "Runs behavior models, schedules, display content and device interfaces. The client discovers ONVIF cameras and reports their state. Camera video and snapshots require the separate IP Camera Streaming module and FFmpeg.", + "ru": "Выполняет модели поведения, расписания, показ контента и работу с интерфейсами устройства. Клиент обнаруживает ONVIF-камеры и передаёт их состояние. Для видео и снимков нужен отдельный IP Camera Streaming и FFmpeg." + } + ] + }, + "ip_stream": { + "title": { + "en": "IP Camera Streaming", + "ru": "IP Camera Streaming" + }, + "body": [ + { + "en": "Receives camera video and uses FFmpeg to prepare browser previews and JPEG snapshots. Camera discovery belongs to IT-Screen. Version 1.0.2 stops before creating the service if FFmpeg is missing. Check FFmpeg below and open the installation log after a failure.", + "ru": "Получает видео камер и с помощью FFmpeg подготавливает предпросмотр в браузере и JPEG-снимки. Обнаружением камер занимается IT-Screen. Установщик 1.0.2 прекращает работу до создания сервиса, если FFmpeg отсутствует. Его состояние показано в карточке; после ошибки откройте лог установки." + } + ] + }, + "mosquitto": { + "title": { + "en": "Local MQTT", + "ru": "Local MQTT" + }, + "body": [ + { + "en": "The local message broker connects the player, Console and integrations. It handles messages inside the Edge; the MQTT Bridge separately carries cloud traffic.", + "ru": "Локальный брокер сообщений связывает клиент, Console и интеграции внутри Edge. Обмен с облаком выполняет отдельный MQTT Bridge." + } + ] + }, + "mqtt_bridge": { + "title": { + "en": "MQTT Bridge", + "ru": "MQTT Bridge" + }, + "body": [ + { + "en": "Connects local MQTT to the selected cloud server for commands, status and telemetry. A running broker alone does not prove cloud connectivity; use the bridge test.", + "ru": "Соединяет локальный MQTT с выбранным облачным сервером: передаёт команды, состояния и телеметрию. Работа локального брокера не означает наличие связи с облаком — её проверяет тест моста." + } + ] + }, + "zigbee2mqtt": { + "title": { + "en": "Zigbee2MQTT", + "ru": "Zigbee2MQTT" + }, + "body": [ + { + "en": "Connects Zigbee sensors and actuators through a compatible radio adapter and publishes their states to MQTT. Needed only for Zigbee devices, not Modbus or Ethernet cameras.", + "ru": "Подключает Zigbee-датчики и исполнительные устройства через совместимый радиоадаптер и передаёт состояния в MQTT. Нужен для Zigbee, но не для Modbus или Ethernet-камер." + } + ] + }, + "cockpit": { + "title": { + "en": "Cockpit", + "ru": "Cockpit" + }, + "body": [ + { + "en": "An engineering web interface for Linux services, system logs and terminal access. It is separate from the everyday Edge Console.", + "ru": "Инженерный веб-интерфейс Linux: системные службы, журналы и терминал. Используется для углублённой диагностики отдельно от обычной Edge Console." + } + ] + }, + "reverse_tunnel": { + "title": { + "en": "Reverse Tunnels", + "ru": "Reverse Tunnels" + }, + "body": [ + { + "en": "Provides remote access to the local Console, Cockpit and Zigbee interface without opening inbound router ports. Installation alone is not enough: cloud enrollment and an established tunnel are also required.", + "ru": "Обеспечивает удалённый доступ к Console, Cockpit и Zigbee без открытия входящих портов роутера. Помимо установки нужны регистрация в облаке и установленное туннельное соединение." + } + ] + }, + "avahi": { + "title": { + "en": "Avahi / mDNS", + "ru": "Avahi / mDNS" + }, + "body": [ + { + "en": "Advertises the Edge by its .local name on the local network. It helps open the device without remembering its IP address and does not provide Internet access.", + "ru": "Позволяет найти Edge в локальной сети по имени .local, не запоминая IP-адрес. Не обеспечивает доступ через интернет." + } + ] + }, + "access_point": { + "title": { + "en": "Wi-Fi / Access Point", + "ru": "Wi-Fi / Access Point" + }, + "body": [ + { + "en": "Manages the Wi-Fi connection or a local access point used to configure the Edge. Network changes may interrupt the current browser connection.", + "ru": "Управляет подключением Wi-Fi или локальной точкой доступа для настройки Edge. Изменение сети может прервать текущее соединение с браузером." + } + ] + }, + "display": { + "title": { + "en": "Display", + "ru": "Display" + }, + "body": [ + { + "en": "Shows connected monitors and controls display mode and audio output. It shares the IT-Screen installation package; it is not a second player.", + "ru": "Показывает подключённые мониторы, управляет режимом экрана и аудиовыходом. Использует общий установочный пакет IT-Screen и не является вторым клиентом." + } + ] + }, + "edge_api": { + "title": { + "en": "Edge API", + "ru": "Edge API" + }, + "body": [ + { + "en": "Local integration API for device data and commands. This card indicates whether that optional component is installed; it is separate from the cloud server API.", + "ru": "Локальный API для интеграций, данных и команд устройства. Карточка показывает наличие этого дополнительного компонента; это не API облачного сервера." + } + ] + } +}; + function helpGuide(id) { + if (id.startsWith("service:")) return SERVICE_HELP[id.slice(8)] || HELP_GUIDES.service_generic; return HELP_GUIDES[id] || null; } @@ -1028,7 +1188,7 @@ }, 3600); } - function platformDialog({ tone = "warn", title, message, primaryLabel, secondaryLabel = "" }) { + function platformDialog({ tone = "warn", title, message, primaryLabel, secondaryLabel = "", details = "" }) { return new Promise((resolve) => { const backdrop = document.createElement("div"); backdrop.className = "modalBackdrop"; @@ -1037,6 +1197,7 @@

${esc(title)}

${esc(message)}

+ ${details ? `
${esc(details)}
` : ""}
${secondaryLabel ? `` : ""} @@ -1337,7 +1498,7 @@
- ${renderPanelTitle(t(card.title), "reverse_tunnels", card.subtitle ? translateUiText(card.subtitle) : "")} + ${renderPanelTitle(t(card.title), `service:${card.id}`, card.subtitle ? translateUiText(card.subtitle) : "")}
${esc(translateStatusValue(card.status_text || card.state || "Unknown"))}
@@ -1653,7 +1814,7 @@
- ${renderPanelTitle(t(card.title), "service_generic", card.subtitle ? translateUiText(card.subtitle) : "")} + ${renderPanelTitle(t(card.title), `service:${card.id}`, card.subtitle ? translateUiText(card.subtitle) : "")}
${esc(translateStatusValue(card.status_text || card.state || "Unknown"))}
@@ -1864,7 +2025,7 @@
- ${renderPanelTitle(t(card.title), "display")} + ${renderPanelTitle(t(card.title), `service:${card.id}`)}
${esc(translateStatusValue(card.status_text || card.state || "Unknown"))}
@@ -2009,7 +2170,7 @@
- ${renderPanelTitle(t(card.title), "access_point")} + ${renderPanelTitle(t(card.title), `service:${card.id}`)}
${esc(translateStatusValue(card.status_text || card.state || "Unknown"))}
@@ -2282,6 +2443,8 @@ ${needsCheck && !running ? `` : release.status !== "latest" && release.status !== "ahead" ? `` : ""}
+ ${job.stage === release.stage && ["failed", "interrupted"].includes(job.state) ? `` : ""} + ${job.stage === release.stage && job.state ? `` : ""} ${!release.can_install && reason ? `
${esc(reason)}
` : ""} `; } @@ -2311,7 +2474,7 @@
- ${renderPanelTitle(t(card.title), "service_generic", card.subtitle ? translateUiText(card.subtitle) : "")} + ${renderPanelTitle(t(card.title), `service:${card.id}`, card.subtitle ? translateUiText(card.subtitle) : "")}
${esc(translateStatusValue(card.status_text || card.state || "Unknown"))}
@@ -2581,7 +2744,7 @@ ${esc(t("Last version check"))}: ${esc(updates.checked_at ? new Date(updates.checked_at * 1000).toLocaleString() : t("Not checked"))} ${updates.error ? `` : ""} - ${updateJob.state ? `` : ""} + ${updateJob.state ? `` : ""}
${serviceCards.map(renderServiceCard).join("") || `
${esc(t("No service cards available."))}
`}
@@ -5262,6 +5425,15 @@ } catch (error) { showToast("error", error.message); } }; + window.__stageInstallLog = async function (stage, unit) { + try { + const log = await fetchJson(`/api/stages/log?stage=${encodeURIComponent(stage)}&unit=${encodeURIComponent(unit)}`, {cache: "no-store"}); + await platformDialog({title: t("Installation log"), + message: [stage, t(log.state || ""), t(log.reason || ""), log.truncated ? t("Showing the last 300 lines (maximum 64 KB).") : ""].filter(Boolean).join(" · "), + details: (log.lines || []).join("\n") || t("Installation log is empty"), primaryLabel: t("Close")}); + } catch (error) { showToast("error", error.message); } + }; + window.__stageVersion = async function (serviceId) { if (state.stageUpdateDialogOpen) return; const card = ((state.healthServices && state.healthServices.services) || []).find(item => item.id === serviceId); diff --git a/stage_ui/console_core/frontend/index.html b/stage_ui/console_core/frontend/index.html index 2608023..c83b0fb 100644 --- a/stage_ui/console_core/frontend/index.html +++ b/stage_ui/console_core/frontend/index.html @@ -23,7 +23,7 @@ } catch (error) {} })(); - +
@@ -108,7 +108,7 @@
- - + + diff --git a/stage_ui/console_core/providers/00_core_services.py b/stage_ui/console_core/providers/00_core_services.py index c0977b4..503f836 100644 --- a/stage_ui/console_core/providers/00_core_services.py +++ b/stage_ui/console_core/providers/00_core_services.py @@ -4,6 +4,7 @@ import math import os import re import shlex +import shutil DRM_ROOT = "/sys/class/drm" @@ -977,10 +978,16 @@ def ip_stream_card(ctx): active, failed=unit["active_state"] == "failed", ) - details = [] + ffmpeg = shutil.which("ffmpeg") + ffmpeg_status = "Not installed" + if ffmpeg: + rc, output, _ = ctx["run"]([ffmpeg, "-version"], timeout=3) + ffmpeg_status = output.splitlines()[0] if rc == 0 and output.strip() else "Installed but unavailable" + details = [{"label": "FFmpeg", "value": ffmpeg_status}] + try: status = json.loads(ctx["read_text"]("/run/iomatex-ip-stream/status.json")) - details = [ + details += [ {"label": "Active streams", "value": str(status.get("active_count", 0))}, {"label": "Stream limit", "value": str(status.get("max_streams", 0))}, ] @@ -997,7 +1004,7 @@ def ip_stream_card(ctx): state, status_text, _short_unit_errors(unit), - [], + [] if ffmpeg else ["FFmpeg is required for camera video and snapshots."], details=details, ) diff --git a/stage_ui/version.json b/stage_ui/version.json index e3c5bbe..a71de18 100644 --- a/stage_ui/version.json +++ b/stage_ui/version.json @@ -1,3 +1,3 @@ { - "version": "3.1.7" + "version": "3.1.8" }