refactor(web): drop obsolete overview lines, fold actions into state card

The state card now duplicates everything the legacy overview
paragraphs reported, so the redundant block between the card and the
Customize details was visible-but-stale: SSH/Telnet status, the two
Backup status paragraphs, Remote Services line, and the AfterTouch
Local Root CA Trusted line.

Removed wholesale, plus the original-config-pane and toggleOriginalConfig
that the Show Original Config button drove. Kept "Trust CA Now" and
"Download CA cert" (per user request), relocating both into the state
card's CA / TLS cell as inline actions next to the verdict — the
verdict text now writes to a #state-ca-line sub-span so re-renders
don't clobber the buttons.

Also gated the HTTPS Connection Test pane on summary.ssh_success: the
backend's TestConnection uploads a temp CA file and runs curl on the
device via SSH, so the panel makes no sense when SSH isn't reachable.
A telnet-poke + service-side observation alternative is on the roadmap
but not implemented yet.

Stripped the dead JS branches that wrote to ssh-status, ca-trust-status,
remote-services-status/found, original-config-status, no-original-config-status,
original-config-content, original-config-pane, and backup-config-btn.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tobias Gesellchen
2026-05-11 00:37:11 +02:00
co-authored by Claude Opus 4.7
parent b7175289c2
commit c5362be11b
2 changed files with 39 additions and 107 deletions
+16 -62
View File
@@ -548,7 +548,22 @@
</tr>
<tr style="border-top: 1px solid #eee">
<td style="padding: 6px 8px; width: 170px; vertical-align: top; color: #555">CA / TLS</td>
<td id="state-ca" style="padding: 6px 8px; vertical-align: top"></td>
<td id="state-ca" style="padding: 6px 8px; vertical-align: top">
<span id="state-ca-line"></span>
<span style="margin-left: 12px; white-space: nowrap">
<button
id="trust-ca-btn"
type="button"
style="display: none; background-color: #607d8b; color: white; border: none; padding: 2px 8px; font-size: 0.85em"
>Trust CA Now</button>
<a
href="/setup/ca.crt"
download="soundtouch-ca.crt"
style="margin-left: 6px; font-size: 0.85em"
title="Download CA cert to import into other clients"
>Download CA cert</a>
</span>
</td>
</tr>
</tbody>
</table>
@@ -575,10 +590,6 @@
</div>
</div>
<p>SSH Connection: <span id="ssh-status"></span></p>
<p>Telnet (Port 17000): <span id="telnet-status"></span>
<span id="telnet-banner" style="font-size: 0.85em; color: #666; margin-left: 6px"></span>
</p>
<div
id="preflight-warnings"
style="display: none; margin: 10px 0; padding: 8px 12px; background-color: #fff8e1; border-left: 4px solid #ffb300; font-size: 0.9em"
@@ -586,53 +597,6 @@
<strong>Cross-check warnings:</strong>
<ul id="preflight-warnings-list" style="margin: 4px 0 0 1em; padding: 0"></ul>
</div>
<p id="original-config-status" style="display: none">
Backup: ✅ Found .original config at
<code
>/opt/Bose/etc/SoundTouchSdkPrivateCfg.xml.original</code
>
<button onclick="toggleOriginalConfig()">
Show Original Config
</button>
</p>
<p id="no-original-config-status" style="display: none">
Backup: ❌ Not found
<button id="backup-config-btn">
Backup Config Now
</button>
</p>
<p>
Remote Services Enabled:
<span id="remote-services-status"></span>
<span
id="remote-services-found"
style="font-size: 0.8em; color: #666"
></span>
</p>
<p>
AfterTouch Local Root CA Trusted:
<span id="ca-trust-status"></span>
<button
id="trust-ca-btn"
style="
display: none;
background-color: #607d8b;
color: white;
border: none;
padding: 2px 8px;
font-size: 0.8em;
margin-left: 10px;
"
>
Trust CA Now
</button>
<a
href="/setup/ca.crt"
download="soundtouch-ca.crt"
style="margin-left: 10px; font-size: 0.85em"
title="Download CA cert to import into other clients"
>Download CA cert</a>
</p>
<div
id="connection-test"
@@ -1050,16 +1014,6 @@
></div>
</div>
<div
id="original-config-pane"
style="display: none; margin-bottom: 20px"
>
<span class="config-header"
>Original Config (Backup)</span
>
<pre id="original-config-content"></pre>
</div>
<div
id="service-options"
style="margin-bottom: 20px; display: none"
+23 -45
View File
@@ -1758,9 +1758,6 @@ async function showSummary(deviceId) {
if (accountIdEl && summary.account_id) accountIdEl.innerText = summary.account_id;
}
document.getElementById("ssh-status").innerText = summary.ssh_success ? "✅ Success" : "❌ Failed";
document.getElementById("ssh-status").style.color = summary.ssh_success ? "green" : "red";
renderMigrationState(summary);
renderPlan(summary);
renderTelnetPreflight(summary);
@@ -1784,11 +1781,6 @@ async function showSummary(deviceId) {
migrationStatus.style.color = summary.is_migrated ? "green" : "red";
migrationStatus.style.fontWeight = "bold";
document.getElementById("original-config-status").style.display = summary.original_config ? "block" : "none";
document.getElementById("no-original-config-status").style.display = summary.original_config ? "none" : "block";
document.getElementById("original-config-content").innerText = summary.original_config || "";
document.getElementById("original-config-pane").style.display = "none";
if (summary.parsed_current_config) {
document.getElementById("service-options").style.display = "block";
document.getElementById("orig-marge").innerText = summary.parsed_current_config.margeServerUrl;
@@ -1799,31 +1791,23 @@ async function showSummary(deviceId) {
document.getElementById("service-options").style.display = "none";
}
const remoteStatus = document.getElementById("remote-services-status");
const remoteFound = document.getElementById("remote-services-found");
if (summary.ssh_success) {
if (summary.remote_services_enabled) {
remoteStatus.innerText = summary.remote_services_persistent ? "✅ Yes" : "⚠️ Yes (non-persistent)";
remoteStatus.style.color = summary.remote_services_persistent ? "green" : "orange";
} else {
remoteStatus.innerText = "❌ No";
remoteStatus.style.color = "red";
}
remoteFound.innerText = summary.remote_services_found && summary.remote_services_found.length > 0 ? "(" + summary.remote_services_found.join(", ") + ")" : "";
// Trust CA Now button now lives inside the state card's CA / TLS
// cell. Show only when SSH is reachable AND the CA isn't already
// trusted on the device.
const trustBtn = document.getElementById("trust-ca-btn");
if (trustBtn) {
const canTrust = summary.ssh_success && !summary.ca_cert_trusted;
trustBtn.style.display = canTrust ? "inline-block" : "none";
trustBtn.onclick = () => trustCA(deviceId, ip);
}
const caTrustStatus = document.getElementById("ca-trust-status");
caTrustStatus.innerText = summary.ca_cert_trusted ? "✅ Yes" : "❌ No";
caTrustStatus.style.color = summary.ca_cert_trusted ? "green" : "red";
document.getElementById("trust-ca-btn").style.display = summary.ca_cert_trusted ? "none" : "inline-block";
document.getElementById("trust-ca-btn").onclick = () => trustCA(deviceId, ip);
} else {
remoteStatus.innerText = "❓ Unknown";
remoteStatus.style.color = "gray";
remoteFound.innerText = "";
const caTrustStatus = document.getElementById("ca-trust-status");
caTrustStatus.innerText = "❓ Unknown";
caTrustStatus.style.color = "gray";
// The HTTPS Connection Test runs `curl` on the device via SSH —
// upload-temp-CA + run-curl — so the panel is irrelevant when
// SSH isn't reachable. The implicit telnet-poke + observation
// alternative is on the roadmap but not implemented yet.
const connectionTestPane = document.getElementById("connection-test");
if (connectionTestPane) {
connectionTestPane.style.display = summary.ssh_success ? "block" : "none";
}
const currentConfigElem = document.getElementById("current-config");
@@ -1888,10 +1872,6 @@ async function showSummary(deviceId) {
removeRemoteBtn.onclick = () => removeRemoteServices(deviceId, ip);
removeRemoteBtn.disabled = !summary.ssh_success || !summary.remote_services_enabled;
const backupBtn = document.getElementById("backup-config-btn");
backupBtn.onclick = () => backupConfig(deviceId, ip);
backupBtn.disabled = !summary.ssh_success || !!summary.original_config;
document.getElementById("migration-summary").style.display = "block";
document.getElementById("migration-summary").scrollIntoView();
} catch (error) {
@@ -2403,11 +2383,6 @@ async function testDNSRedirection(deviceId) {
}
}
function toggleOriginalConfig() {
const pane = document.getElementById("original-config-pane");
pane.style.display = pane.style.display === "none" ? "block" : "none";
}
// defaultTelnetURLs returns the canonical four URLs derived from a
// service base URL. Mirrors setup.defaultTelnetURLs (Go) — keep them in
// sync if either side changes.
@@ -2759,11 +2734,14 @@ function renderMigrationState(summary) {
}
// --- CA / TLS axis ---
const caCell = document.getElementById("state-ca");
if (caCell) {
caCell.replaceChildren();
// The cell hosts both the verdict text and two action affordances
// (Trust CA Now button + Download CA cert link). We only rewrite
// the verdict span so the buttons stay put across re-renders.
const caLine = document.getElementById("state-ca-line");
if (caLine) {
caLine.replaceChildren();
const v = caVerdict(summary);
caCell.appendChild(stateLine(v.icon, v.text, v.note));
caLine.appendChild(stateLine(v.icon, v.text, v.note));
}
// --- Preconditions ---