Preserve registration app version on initial It-Screen navigation

This commit is contained in:
Andrei Smaliak 2026-10-06 05:44:09 +02:00
parent cc8a2e182a
commit 54d5feaa91
7 changed files with 43 additions and 8 deletions

View File

@ -0,0 +1,8 @@
# Console 3.1.13
Release date: 2026-10-06.
- Fix App version disappearing on first navigation to It-Screen after Health loaded registration. An empty version from the service-status response previously replaced the known registration version; the shared service accessor now falls back to registration data while preferring a nonempty installed binary version.
- Keep existing request cadence and manual refresh behavior. No polling or extra registration requests are added.
Validation: response-order and tab-refresh regression test, browser reproduction using empty status version and known registration version, and live local Edge verification.

View File

@ -14,7 +14,7 @@
"version": "1.0.0"
},
"stage_ui": {
"version": "3.1.12"
"version": "3.1.13"
},
"stage_avahi": {
"version": "1.0.0"

View File

@ -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.12"
UI_VERSION = "V 3.1.13"
STORAGE_HEALTH_COMMAND = "/usr/local/sbin/iomatex-storage-health"
ZONEINFO_ROOT = "/usr/share/zoneinfo"

View File

@ -0,0 +1,23 @@
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const vm = require('node:vm');
const source = fs.readFileSync(path.join(__dirname, '../frontend/console.js'), 'utf8');
const state = {itscreen: {data: {}}};
const ctx = {state, textValue: (value, fallback) => value == null || String(value).trim() === '' ? fallback : String(value).trim()};
vm.createContext(ctx);
vm.runInContext(source.slice(source.indexOf(' function itscreenPayload()'), source.indexOf(' function itscreenServerMode(')), ctx);
for (const order of [['registration', 'service'], ['service', 'registration']]) {
state.itscreen.data = {};
for (const key of order) state.itscreen.data[key] = key === 'registration' ? {app_version: '4.410.142'} : {version: '', state: 'running'};
assert.equal(ctx.itscreenService().version, '4.410.142');
// Navigating from Health loads another status response without reloading registration.
state.itscreen.data.service = {version: '', state: 'running'};
assert.equal(ctx.itscreenService().version, '4.410.142');
assert.equal(state.itscreen.data.service.version, '', 'Read must not mutate API data');
}
state.itscreen.data.service.version = '4.410.143';
assert.equal(ctx.itscreenService().version, '4.410.143');
state.itscreen.data = {};
assert.equal(ctx.itscreenService().version, '');
console.log('App version survives response ordering and tab status refresh; installed version takes precedence');

View File

@ -49,7 +49,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.12";
const UI_VERSION = "V 3.1.13";
const ITSCREEN_LOG_INITIAL_LINES = 50;
const ITSCREEN_LOG_BUFFER_LIMIT = 300;
const ITSCREEN_LOG_BATCH_MS = 250;
@ -1593,7 +1593,11 @@
}
function itscreenService() {
return itscreenPayload().service || {};
const payload = itscreenPayload();
const service = payload.service || {};
// Status may not discover the binary version; registration already has it.
// Resolve on read so either response order and later status refreshes are safe.
return { ...service, version: textValue(service.version, "") || itscreenAppVersionFromRegistration(payload.registration) };
}
function itscreenRuntime() {

View File

@ -23,7 +23,7 @@
} catch (error) {}
})();
</script>
<link rel="stylesheet" href="/console.css?v=3.1.12&amp;rev=camera-snapshot-1">
<link rel="stylesheet" href="/console.css?v=3.1.13&amp;rev=camera-snapshot-1">
</head>
<body>
<main class="shell">
@ -109,7 +109,7 @@
</main>
<div id="menuBackdrop" class="menuBackdrop" hidden></div>
<div id="toastStack" class="toastStack" aria-live="polite" aria-atomic="true"></div>
<script src="/console.i18n.js?v=3.1.12&amp;rev=camera-snapshot-1"></script>
<script src="/console.js?v=3.1.12&amp;rev=camera-snapshot-1"></script>
<script src="/console.i18n.js?v=3.1.13&amp;rev=camera-snapshot-1"></script>
<script src="/console.js?v=3.1.13&amp;rev=camera-snapshot-1"></script>
</body>
</html>

View File

@ -1,3 +1,3 @@
{
"version": "3.1.12"
"version": "3.1.13"
}