Align Console version with title and refresh release availability every minute
This commit is contained in:
parent
8640409e3d
commit
fb48aa3768
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Console 3.1.12
|
||||||
|
|
||||||
|
Release date: 2026-10-04.
|
||||||
|
|
||||||
|
- Place the Console Version button directly beside the Edge Console title using the shared wrapping title row.
|
||||||
|
- Keep Check versions visible in the Console header, including when the cached catalog reports the latest installed version. Continue displaying the Update action when a newer release is available.
|
||||||
|
- Refresh the Git release catalog asynchronously every 60 seconds when status is requested, instead of every 15 minutes. Preserve request coalescing, error backoff and the existing 15-minute installation catalog validity limit.
|
||||||
|
|
||||||
|
Validation: stage-owner tests including refresh throttling; browser checks at four viewport widths for header controls and update confirmation.
|
||||||
|
|
@ -34,6 +34,7 @@ STAGES = {
|
||||||
'stage_reverse_tunnels': ('Reverse Tunnels', ['reverse_tunnel']),
|
'stage_reverse_tunnels': ('Reverse Tunnels', ['reverse_tunnel']),
|
||||||
}
|
}
|
||||||
CHECK_TTL = 900
|
CHECK_TTL = 900
|
||||||
|
CHECK_INTERVAL = 60
|
||||||
_guard = threading.Lock()
|
_guard = threading.Lock()
|
||||||
_job_guard = threading.Lock()
|
_job_guard = threading.Lock()
|
||||||
_checking = False
|
_checking = False
|
||||||
|
|
@ -128,7 +129,7 @@ def request_check(force=False):
|
||||||
with _guard:
|
with _guard:
|
||||||
cached = read_json(STATE / 'available.json')
|
cached = read_json(STATE / 'available.json')
|
||||||
age = time.time() - cached.get('attempt_at', 0)
|
age = time.time() - cached.get('attempt_at', 0)
|
||||||
minimum_age = 0 if force else (30 if cached.get('error') else CHECK_TTL)
|
minimum_age = 0 if force else (30 if cached.get('error') else CHECK_INTERVAL)
|
||||||
if _checking or age < minimum_age:
|
if _checking or age < minimum_age:
|
||||||
return
|
return
|
||||||
_checking = True
|
_checking = True
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,15 @@ class StageVersionsTest(unittest.TestCase):
|
||||||
self.assertEqual(expected, versions.read_json(versions.STATE / 'available.json')['error'])
|
self.assertEqual(expected, versions.read_json(versions.STATE / 'available.json')['error'])
|
||||||
self.assertFalse(self.snapshot()['can_install'])
|
self.assertFalse(self.snapshot()['can_install'])
|
||||||
|
|
||||||
|
def test_release_check_refreshes_after_one_minute(self):
|
||||||
|
for age, expected in [(59, False), (61, True)]:
|
||||||
|
with self.subTest(age=age), mock.patch.object(versions, '_checking', False), \
|
||||||
|
mock.patch.object(versions, 'read_json', return_value={'attempt_at': 1000}), \
|
||||||
|
mock.patch.object(versions.time, 'time', return_value=1000 + age), \
|
||||||
|
mock.patch.object(versions.threading, 'Thread') as thread:
|
||||||
|
versions.request_check()
|
||||||
|
self.assertEqual(expected, thread.return_value.start.called)
|
||||||
|
|
||||||
def test_release_fetch_is_async_coalesced_and_pinned(self):
|
def test_release_fetch_is_async_coalesced_and_pinned(self):
|
||||||
(versions.STATE / 'available.json').unlink()
|
(versions.STATE / 'available.json').unlink()
|
||||||
started, release = threading.Event(), threading.Event()
|
started, release = threading.Event(), threading.Event()
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
},
|
},
|
||||||
"stage_ui": {
|
"stage_ui": {
|
||||||
"version": "3.1.11"
|
"version": "3.1.12"
|
||||||
},
|
},
|
||||||
"stage_avahi": {
|
"stage_avahi": {
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ APP_DIR = "/opt/iomatex-console"
|
||||||
PUBLIC_DIR = os.path.join(APP_DIR, "public")
|
PUBLIC_DIR = os.path.join(APP_DIR, "public")
|
||||||
PROVIDERS_DIR = os.path.join(APP_DIR, "providers.d")
|
PROVIDERS_DIR = os.path.join(APP_DIR, "providers.d")
|
||||||
CONFIG_PATH = "/etc/iomatex/console.json"
|
CONFIG_PATH = "/etc/iomatex/console.json"
|
||||||
UI_VERSION = "V 3.1.11"
|
UI_VERSION = "V 3.1.12"
|
||||||
STORAGE_HEALTH_COMMAND = "/usr/local/sbin/iomatex-storage-health"
|
STORAGE_HEALTH_COMMAND = "/usr/local/sbin/iomatex-storage-health"
|
||||||
ZONEINFO_ROOT = "/usr/share/zoneinfo"
|
ZONEINFO_ROOT = "/usr/share/zoneinfo"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ const base=process.env.EDGE_CONSOLE_URL || 'http://192.168.0.109';
|
||||||
if(logs!==0)throw Error('Eager log fetch');
|
if(logs!==0)throw Error('Eager log fetch');
|
||||||
if(await page.locator('#tabContent [onclick="window.__openHelp(\'service:console\')"]').count())throw Error('Duplicate Console card');
|
if(await page.locator('#tabContent [onclick="window.__openHelp(\'service:console\')"]').count())throw Error('Duplicate Console card');
|
||||||
const header=page.locator('header #consoleRelease');
|
const header=page.locator('header #consoleRelease');
|
||||||
|
const titleRow=header.locator('.panelTitleRow');
|
||||||
|
if(await titleRow.getByRole('button',{name:/^Version:/}).count()!==1)throw Error('Version outside title row');
|
||||||
|
if(await header.getByRole('button',{name:'Check versions',exact:true}).count()!==1)throw Error('No header release check');
|
||||||
await header.getByRole('button',{name:'Update 3.1.9',exact:true}).click();
|
await header.getByRole('button',{name:'Update 3.1.9',exact:true}).click();
|
||||||
await page.locator('.platformDialog').waitFor();
|
await page.locator('.platformDialog').waitFor();
|
||||||
await page.keyboard.press('Escape');
|
await page.keyboard.press('Escape');
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
{ mode: "test_by", label: "test.it-screen.by", host: "rest.test.it-screen.by" },
|
{ mode: "test_by", label: "test.it-screen.by", host: "rest.test.it-screen.by" },
|
||||||
{ mode: "custom", label: "Custom", host: "" }
|
{ mode: "custom", label: "Custom", host: "" }
|
||||||
];
|
];
|
||||||
const UI_VERSION = "V 3.1.11";
|
const UI_VERSION = "V 3.1.12";
|
||||||
const ITSCREEN_LOG_INITIAL_LINES = 50;
|
const ITSCREEN_LOG_INITIAL_LINES = 50;
|
||||||
const ITSCREEN_LOG_BUFFER_LIMIT = 300;
|
const ITSCREEN_LOG_BUFFER_LIMIT = 300;
|
||||||
const ITSCREEN_LOG_BATCH_MS = 250;
|
const ITSCREEN_LOG_BATCH_MS = 250;
|
||||||
|
|
@ -823,10 +823,11 @@
|
||||||
return `<button class="helpIconBtn" type="button" aria-label="${esc(t("Help"))}" title="${esc(t("Help"))}" onclick="window.__openHelp('${esc(helpId)}')">?</button>`;
|
return `<button class="helpIconBtn" type="button" aria-label="${esc(t("Help"))}" title="${esc(t("Help"))}" onclick="window.__openHelp('${esc(helpId)}')">?</button>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderPanelTitle(title, helpId, subtitle = "") {
|
function renderPanelTitle(title, helpId, subtitle = "", actions = "") {
|
||||||
return `
|
return `
|
||||||
<div class="panelTitleRow">
|
<div class="panelTitleRow">
|
||||||
<h2>${esc(title)}</h2>
|
<h2>${esc(title)}</h2>
|
||||||
|
${actions}
|
||||||
${renderHelpButton(helpId)}
|
${renderHelpButton(helpId)}
|
||||||
</div>
|
</div>
|
||||||
${subtitle ? `<p class="cardSubtitle">${esc(subtitle)}</p>` : ""}
|
${subtitle ? `<p class="cardSubtitle">${esc(subtitle)}</p>` : ""}
|
||||||
|
|
@ -2421,17 +2422,19 @@
|
||||||
: updates.checking ? t("Checking versions...")
|
: updates.checking ? t("Checking versions...")
|
||||||
: updates.error ? t(updates.error)
|
: updates.error ? t(updates.error)
|
||||||
: needsCheck ? t("Check available versions before installing.") : "";
|
: needsCheck ? t("Check available versions before installing.") : "";
|
||||||
|
const versionButton = `<button class="actionBtn secondary" type="button" onclick="window.__stageVersion('${esc(card.id)}')">${esc(t("Version"))}: ${esc(release.current || t("Unknown"))}</button>`;
|
||||||
return `<div class="list">
|
return `<div class="list">
|
||||||
${compact ? renderPanelTitle(t(card.title), `service:${card.id}`) : `<div class="listTitle">${esc(t("Stage version"))}</div>
|
${compact ? renderPanelTitle(t(card.title), `service:${card.id}`, "", versionButton) : `<div class="listTitle">${esc(t("Stage version"))}</div>
|
||||||
<div class="meta compactMeta">${renderKeyValueRows([
|
<div class="meta compactMeta">${renderKeyValueRows([
|
||||||
{ label: t("Installed"), value: release.current || t("Unknown") },
|
{ label: t("Installed"), value: release.current || t("Unknown") },
|
||||||
{ label: t("Available"), value: release.latest || t("Not checked") },
|
{ label: t("Available"), value: release.latest || t("Not checked") },
|
||||||
{ label: t("Status"), value: stageReleaseStatus(release) }
|
{ label: t("Status"), value: stageReleaseStatus(release) }
|
||||||
])}</div>`}
|
])}</div>`}
|
||||||
<div class="actionRow serviceActionRow">
|
<div class="actionRow serviceActionRow">
|
||||||
<button class="actionBtn secondary" type="button" onclick="window.__stageVersion('${esc(card.id)}')">${esc(t("Version"))}: ${esc(release.current || t("Unknown"))}</button>
|
${compact ? "" : versionButton}
|
||||||
${needsCheck && !running ? `<button class="actionBtn secondary" type="button" ${updates.checking || updates.busy ? "disabled" : ""} onclick="window.__checkStageVersions()">${esc(t(updates.checking ? "Checking versions..." : "Check versions"))}</button>`
|
${(needsCheck || compact) && !running ? `<button class="actionBtn secondary" type="button" ${updates.checking || updates.busy ? "disabled" : ""} onclick="window.__checkStageVersions()">${esc(t(updates.checking ? "Checking versions..." : "Check versions"))}</button>`
|
||||||
: release.status !== "latest" && release.status !== "ahead" ? `<button class="actionBtn" type="button" ${release.can_install ? "" : "disabled"} onclick="window.__stageVersion('${esc(card.id)}')">${esc(running ? t("Installing...") : `${action}${release.latest ? ` ${release.latest}` : ""}`)}</button>` : ""}
|
: ""}
|
||||||
|
${!needsCheck && release.status !== "latest" && release.status !== "ahead" ? `<button class="actionBtn" type="button" ${release.can_install ? "" : "disabled"} onclick="window.__stageVersion('${esc(card.id)}')">${esc(running ? t("Installing...") : `${action}${release.latest ? ` ${release.latest}` : ""}`)}</button>` : ""}
|
||||||
${job.stage === release.stage && job.state ? `<button class="actionBtn secondary" type="button" onclick="window.__stageInstallLog('${esc(release.stage)}', '${esc(job.unit || "")}')">${esc(t("Installation log"))}</button>` : ""}
|
${job.stage === release.stage && job.state ? `<button class="actionBtn secondary" type="button" onclick="window.__stageInstallLog('${esc(release.stage)}', '${esc(job.unit || "")}')">${esc(t("Installation log"))}</button>` : ""}
|
||||||
</div>
|
</div>
|
||||||
${job.stage === release.stage && ["failed", "interrupted"].includes(job.state) ? `<div class="banner warn" role="status">${esc(t(job.reason || "Installation did not complete. Open the installation log for details."))}</div>` : ""}
|
${job.stage === release.stage && ["failed", "interrupted"].includes(job.state) ? `<div class="banner warn" role="status">${esc(t(job.reason || "Installation did not complete. Open the installation log for details."))}</div>` : ""}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<link rel="stylesheet" href="/console.css?v=3.1.11&rev=camera-snapshot-1">
|
<link rel="stylesheet" href="/console.css?v=3.1.12&rev=camera-snapshot-1">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main class="shell">
|
<main class="shell">
|
||||||
|
|
@ -109,7 +109,7 @@
|
||||||
</main>
|
</main>
|
||||||
<div id="menuBackdrop" class="menuBackdrop" hidden></div>
|
<div id="menuBackdrop" class="menuBackdrop" hidden></div>
|
||||||
<div id="toastStack" class="toastStack" aria-live="polite" aria-atomic="true"></div>
|
<div id="toastStack" class="toastStack" aria-live="polite" aria-atomic="true"></div>
|
||||||
<script src="/console.i18n.js?v=3.1.11&rev=camera-snapshot-1"></script>
|
<script src="/console.i18n.js?v=3.1.12&rev=camera-snapshot-1"></script>
|
||||||
<script src="/console.js?v=3.1.11&rev=camera-snapshot-1"></script>
|
<script src="/console.js?v=3.1.12&rev=camera-snapshot-1"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"version": "3.1.11"
|
"version": "3.1.12"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue