Merge pull request #62 from naturallaw777/copilot/move-update-system-button
[WIP] Move Update System button to left sidebar
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// ── Event listeners ───────────────────────────────────────────────
|
// ── Event listeners ───────────────────────────────────────────────
|
||||||
|
|
||||||
if ($updateBtn) $updateBtn.addEventListener("click", openUpdateModal);
|
// if ($updateBtn) $updateBtn.addEventListener("click", openUpdateModal); // moved to sidebar in tiles.js
|
||||||
if ($btnCloseModal) $btnCloseModal.addEventListener("click", closeUpdateModal);
|
if ($btnCloseModal) $btnCloseModal.addEventListener("click", closeUpdateModal);
|
||||||
if ($btnReboot) $btnReboot.addEventListener("click", doReboot);
|
if ($btnReboot) $btnReboot.addEventListener("click", doReboot);
|
||||||
if ($btnSave) $btnSave.addEventListener("click", saveErrorReport);
|
if ($btnSave) $btnSave.addEventListener("click", saveErrorReport);
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ let _rebuildIsEnabling = true;
|
|||||||
const $tilesArea = document.getElementById("tiles-area");
|
const $tilesArea = document.getElementById("tiles-area");
|
||||||
const $sidebarSupport = document.getElementById("sidebar-support");
|
const $sidebarSupport = document.getElementById("sidebar-support");
|
||||||
const $sidebarFeatures = document.getElementById("sidebar-features");
|
const $sidebarFeatures = document.getElementById("sidebar-features");
|
||||||
const $updateBtn = document.getElementById("btn-update");
|
// No longer needed — Update System moved to sidebar
|
||||||
const $updateBadge = document.getElementById("update-badge");
|
// const $updateBtn = document.getElementById("btn-update");
|
||||||
|
// const $updateBadge = document.getElementById("update-badge");
|
||||||
const $internalIp = document.getElementById("ip-internal");
|
const $internalIp = document.getElementById("ip-internal");
|
||||||
const $externalIp = document.getElementById("ip-external");
|
const $externalIp = document.getElementById("ip-external");
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,20 @@ function buildTiles(services, categoryLabels) {
|
|||||||
|
|
||||||
function renderSidebarSupport(supportServices) {
|
function renderSidebarSupport(supportServices) {
|
||||||
$sidebarSupport.innerHTML = "";
|
$sidebarSupport.innerHTML = "";
|
||||||
|
|
||||||
|
// ── Update System button (above Tech Help)
|
||||||
|
var sidebarUpdateBtn = document.createElement("button");
|
||||||
|
sidebarUpdateBtn.className = "sidebar-support-btn";
|
||||||
|
sidebarUpdateBtn.id = "sidebar-btn-update";
|
||||||
|
sidebarUpdateBtn.innerHTML =
|
||||||
|
'<span class="sidebar-support-icon">🔄</span>' +
|
||||||
|
'<span class="sidebar-support-text">' +
|
||||||
|
'<span class="sidebar-support-title">Update System</span>' +
|
||||||
|
'<span class="sidebar-support-hint" id="sidebar-update-hint">Check for updates</span>' +
|
||||||
|
'</span>';
|
||||||
|
sidebarUpdateBtn.addEventListener("click", function() { openUpdateModal(); });
|
||||||
|
$sidebarSupport.appendChild(sidebarUpdateBtn);
|
||||||
|
|
||||||
for (var i = 0; i < supportServices.length; i++) {
|
for (var i = 0; i < supportServices.length; i++) {
|
||||||
var svc = supportServices[i];
|
var svc = supportServices[i];
|
||||||
var btn = document.createElement("button");
|
var btn = document.createElement("button");
|
||||||
@@ -170,7 +184,18 @@ async function checkUpdates() {
|
|||||||
try {
|
try {
|
||||||
var data = await apiFetch("/api/updates/check");
|
var data = await apiFetch("/api/updates/check");
|
||||||
var hasUpdates = !!data.available;
|
var hasUpdates = !!data.available;
|
||||||
if ($updateBadge) $updateBadge.classList.toggle("visible", hasUpdates);
|
var sidebarUpdateBtn = document.getElementById("sidebar-btn-update");
|
||||||
if ($updateBtn) $updateBtn.classList.toggle("has-updates", hasUpdates);
|
var sidebarUpdateHint = document.getElementById("sidebar-update-hint");
|
||||||
|
if (sidebarUpdateBtn) {
|
||||||
|
if (hasUpdates) {
|
||||||
|
sidebarUpdateBtn.style.borderColor = "#2ec27e";
|
||||||
|
sidebarUpdateBtn.style.backgroundColor = "rgba(46, 194, 126, 0.08)";
|
||||||
|
if (sidebarUpdateHint) sidebarUpdateHint.textContent = "Updates available!";
|
||||||
|
} else {
|
||||||
|
sidebarUpdateBtn.style.borderColor = "";
|
||||||
|
sidebarUpdateBtn.style.backgroundColor = "";
|
||||||
|
if (sidebarUpdateHint) sidebarUpdateHint.textContent = "System is up to date";
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,6 @@
|
|||||||
<span class="title">Sovran_SystemsOS Hub</span>
|
<span class="title">Sovran_SystemsOS Hub</span>
|
||||||
<div class="header-buttons">
|
<div class="header-buttons">
|
||||||
<span class="role-badge" id="role-badge">Loading…</span>
|
<span class="role-badge" id="role-badge">Loading…</span>
|
||||||
<button class="btn btn-update" id="btn-update" title="Run system update">
|
|
||||||
<span class="update-badge" id="update-badge"></span>
|
|
||||||
Update System
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user