Show client updates in the IT-Screen profile card
This commit is contained in:
parent
a07871f4d7
commit
9491a45864
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Console 3.1.34 — client update in the IT-Screen profile card
|
||||||
|
|
||||||
|
- Show the shared Debian client update state and action directly in the
|
||||||
|
IT-Screen service profile card on Health: installed version, available
|
||||||
|
version, availability/progress/error status, and Check and update client.
|
||||||
|
- Use the same update controller and authenticated API as the dedicated
|
||||||
|
It-Screen tab. Health performs a check-only request and local status polling;
|
||||||
|
it does not change the automatic-update preference.
|
||||||
|
- Rename the separate stage 1.0.40 presentation to Client update system module
|
||||||
|
and explain that it is the technical updater module, not the application
|
||||||
|
version.
|
||||||
|
- Keep the generic stage renderer as the single owner; the IT-Screen card only
|
||||||
|
supplies contextual labels. No parallel installation path is introduced.
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
"version": "1.0.1"
|
"version": "1.0.1"
|
||||||
},
|
},
|
||||||
"stage_ui": {
|
"stage_ui": {
|
||||||
"version": "3.1.33"
|
"version": "3.1.34"
|
||||||
},
|
},
|
||||||
"stage_avahi": {
|
"stage_avahi": {
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,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.33"
|
UI_VERSION = "V 3.1.34"
|
||||||
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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,7 @@ for (const [phase, label] of [['ready', 'A new client version'], ['not_required'
|
||||||
assert.ok(!html.includes('<error>'));
|
assert.ok(!html.includes('<error>'));
|
||||||
}
|
}
|
||||||
assert.ok(source.includes('panel.innerHTML = renderClientUpdate()'), 'Polling updates only the updater panel, preserving form edits');
|
assert.ok(source.includes('panel.innerHTML = renderClientUpdate()'), 'Polling updates only the updater panel, preserving form edits');
|
||||||
|
assert.ok(source.includes('["health", "tscreen"].includes(state.activeTab)'), 'Health profile and It-Screen tab share the update owner');
|
||||||
|
assert.equal((source.match(/id="itscreenClientUpdate"/g) || []).length, 2, 'Both views expose the shared client update panel');
|
||||||
|
assert.ok(source.includes('Client update system module'), 'Technical stage is explicitly distinguished from the client version');
|
||||||
console.log('Client update versions, available/current/error/busy states and local panel rendering passed');
|
console.log('Client update versions, available/current/error/busy states and local panel rendering passed');
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@
|
||||||
"Client updated": "Клиент обновлён",
|
"Client updated": "Клиент обновлён",
|
||||||
"Client update failed": "Не удалось обновить клиент",
|
"Client update failed": "Не удалось обновить клиент",
|
||||||
"Updates come from git.iomatex.com. The client restarts; registration and settings are preserved.": "Обновления загружаются с git.iomatex.com. Клиент перезапустится; регистрация и настройки сохранятся.",
|
"Updates come from git.iomatex.com. The client restarts; registration and settings are preserved.": "Обновления загружаются с git.iomatex.com. Клиент перезапустится; регистрация и настройки сохранятся.",
|
||||||
|
"Client update": "Обновление клиента",
|
||||||
|
"Client update system module": "Системный модуль обновления клиента",
|
||||||
|
"System module": "Системный модуль",
|
||||||
|
"Technical module that checks, verifies and safely installs client releases.": "Технический модуль, который проверяет, валидирует и безопасно устанавливает версии клиента.",
|
||||||
|
|
||||||
"Input/output relationship": "Связь входов и реле",
|
"Input/output relationship": "Связь входов и реле",
|
||||||
"Independent inputs and outputs": "Независимые входы и выходы",
|
"Independent inputs and outputs": "Независимые входы и выходы",
|
||||||
|
|
|
||||||
|
|
@ -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.33";
|
const UI_VERSION = "V 3.1.34";
|
||||||
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;
|
||||||
|
|
@ -1857,6 +1857,10 @@
|
||||||
<div class="meta compactMeta ${registrationRequired ? "registrationWarnGrid" : ""}">${renderItscreenInfoRows(payload || {}, itscreenService().version)}</div>
|
<div class="meta compactMeta ${registrationRequired ? "registrationWarnGrid" : ""}">${renderItscreenInfoRows(payload || {}, itscreenService().version)}</div>
|
||||||
</div>
|
</div>
|
||||||
`}
|
`}
|
||||||
|
<div class="list">
|
||||||
|
<div class="listTitle">${esc(t("Client update"))}</div>
|
||||||
|
<div id="itscreenClientUpdate">${renderClientUpdate()}</div>
|
||||||
|
</div>
|
||||||
<div class="list">
|
<div class="list">
|
||||||
<div class="listTitle">${esc(t("Flags"))}</div>
|
<div class="listTitle">${esc(t("Flags"))}</div>
|
||||||
<div class="pillRow">
|
<div class="pillRow">
|
||||||
|
|
@ -2454,7 +2458,7 @@
|
||||||
return (job.stages || [job.stage]).includes(stage);
|
return (job.stages || [job.stage]).includes(stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderStageVersion(card, compact = false) {
|
function renderStageVersion(card, compact = false, labels = {}) {
|
||||||
const release = card.release;
|
const release = card.release;
|
||||||
if (!release) return "";
|
if (!release) return "";
|
||||||
const updates = (state.healthServices && state.healthServices.updates) || {};
|
const updates = (state.healthServices && state.healthServices.updates) || {};
|
||||||
|
|
@ -2466,9 +2470,11 @@
|
||||||
: 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>`;
|
const versionLabel = labels.button || t("Version");
|
||||||
|
const sectionLabel = labels.section || t("Stage version");
|
||||||
|
const versionButton = `<button class="actionBtn secondary" type="button" onclick="window.__stageVersion('${esc(card.id)}')">${esc(versionLabel)}: ${esc(release.current || t("Unknown"))}</button>`;
|
||||||
return `<div class="list">
|
return `<div class="list">
|
||||||
${compact ? renderPanelTitle(t(card.title), `service:${card.id}`, "", versionButton) : `<div class="listTitle">${esc(t("Stage version"))}</div>
|
${compact ? renderPanelTitle(t(card.title), `service:${card.id}`, "", versionButton) : `<div class="listTitle">${esc(sectionLabel)}</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") },
|
||||||
|
|
@ -2481,6 +2487,7 @@
|
||||||
${!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>` : ""}
|
${!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>` : ""}
|
||||||
${stageInJob(job, release.stage) && job.state ? `<button class="actionBtn secondary" type="button" onclick="window.__stageInstallLog('${esc(release.stage)}', '${esc(job.unit || "")}')">${esc(t("Installation log"))}</button>` : ""}
|
${stageInJob(job, 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>
|
||||||
|
${labels.hint ? `<div class="formHint">${esc(labels.hint)}</div>` : ""}
|
||||||
${stageInJob(job, 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>` : ""}
|
${stageInJob(job, 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>` : ""}
|
||||||
${!release.can_install && reason ? `<div class="formHint" role="status">${esc(reason)}</div>` : ""}
|
${!release.can_install && reason ? `<div class="formHint" role="status">${esc(reason)}</div>` : ""}
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
@ -2497,7 +2504,12 @@
|
||||||
const content = renderServiceCardContent(card);
|
const content = renderServiceCardContent(card);
|
||||||
// All specialized cards retain their existing renderer and share one release control.
|
// All specialized cards retain their existing renderer and share one release control.
|
||||||
const end = content.lastIndexOf("</article>");
|
const end = content.lastIndexOf("</article>");
|
||||||
return end < 0 ? content : content.slice(0, end) + renderStageVersion(card) + content.slice(end);
|
const stageLabels = card.id === "itscreen" ? {
|
||||||
|
section: t("Client update system module"),
|
||||||
|
button: t("System module"),
|
||||||
|
hint: t("Technical module that checks, verifies and safely installs client releases.")
|
||||||
|
} : {};
|
||||||
|
return end < 0 ? content : content.slice(0, end) + renderStageVersion(card, false, stageLabels) + content.slice(end);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderServiceCardContent(card) {
|
function renderServiceCardContent(card) {
|
||||||
|
|
@ -5203,7 +5215,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadItscreenInitialData(options = {}) {
|
async function loadItscreenInitialData(options = {}) {
|
||||||
if (state.activeTab === "tscreen") loadClientUpdate(Date.now() - state.itscreen.updateCheckedAt > 900000 ? "check_only" : null);
|
if (["health", "tscreen"].includes(state.activeTab)) loadClientUpdate(Date.now() - state.itscreen.updateCheckedAt > 900000 ? "check_only" : null);
|
||||||
const force = !!options.force;
|
const force = !!options.force;
|
||||||
const maxAgeMs = Number.isFinite(options.maxAgeMs) ? options.maxAgeMs : 10000;
|
const maxAgeMs = Number.isFinite(options.maxAgeMs) ? options.maxAgeMs : 10000;
|
||||||
if (!force && state.itscreen.request) return state.itscreen.request;
|
if (!force && state.itscreen.request) return state.itscreen.request;
|
||||||
|
|
@ -5881,7 +5893,7 @@
|
||||||
|
|
||||||
function renderClientUpdateStatus() {
|
function renderClientUpdateStatus() {
|
||||||
const panel = document.getElementById("itscreenClientUpdate");
|
const panel = document.getElementById("itscreenClientUpdate");
|
||||||
if (panel && state.activeTab === "tscreen") panel.innerHTML = renderClientUpdate();
|
if (panel && ["health", "tscreen"].includes(state.activeTab)) panel.innerHTML = renderClientUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.__clientUpdate = async function () {
|
window.__clientUpdate = async function () {
|
||||||
|
|
@ -7098,7 +7110,7 @@
|
||||||
loadForActiveTab({ preserveEditing: true }).catch(() => {});
|
loadForActiveTab({ preserveEditing: true }).catch(() => {});
|
||||||
}, 15000);
|
}, 15000);
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
if (state.auth.authenticated && state.activeTab === "tscreen") loadClientUpdate();
|
if (state.auth.authenticated && ["health", "tscreen"].includes(state.activeTab)) loadClientUpdate();
|
||||||
}, 3000);
|
}, 3000);
|
||||||
setInterval(updateSessionMeter, 30000);
|
setInterval(updateSessionMeter, 30000);
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<link rel="stylesheet" href="/console.css?v=3.1.33&rev=edge-runtime-profile-1">
|
<link rel="stylesheet" href="/console.css?v=3.1.34&rev=edge-runtime-profile-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.33&rev=edge-runtime-profile-1"></script>
|
<script src="/console.i18n.js?v=3.1.34&rev=edge-runtime-profile-1"></script>
|
||||||
<script src="/console.js?v=3.1.33&rev=edge-runtime-profile-1"></script>
|
<script src="/console.js?v=3.1.34&rev=edge-runtime-profile-1"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"version": "3.1.33"
|
"version": "3.1.34"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue