fix(admin): draw Settings before the dashboard answers and keep Settings reachable on short windows

Settings waited for /server/dashboard (archive statistics, volume space) before it drew,
so a large archive or a slow mount kept the whole form empty for About's two rows. The
form now draws as soon as /server/settings answers; database and uptime show a dash and
fill in when the dashboard answers, without a redraw, so focus and edits stay. They stay
off /server/info, which is anonymous.

In the wide layout the sidebar never scrolled, so on short windows the docked Settings
entry and the account were cut off. The page list above them now scrolls, with room for
the focus rings, and the whole sidebar scrolls only when even the docked part does not
fit, expanded and collapsed alike; the narrow top bar is unchanged.

The bug report form now points at admin panel > Settings > About, since About is no
longer a sidebar entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-10-26 23:23:31 +01:00
1 parent a34b33d50b
commit 5035a5c392
5 files changed
+29 -9

No files matched your search

+4
View File
@@ -80,6 +80,10 @@ h2 { font-size: 14px; font-weight: 600; }
.nav a { position: relative; }
/* Exactly the widths the narrow layout below leaves (fractional widths at 125 % scaling included). */
@media not all and (max-width: 900px) {
/* Short windows: the pages above scroll, so Settings and the account stay docked in view; the whole sidebar scrolls
only when even those do not fit. The padding keeps the links' focus rings inside the scrolling list. */
.sidebar, .nav-group:not(.bottom) { overflow-y: auto; scrollbar-width: thin; }
.nav-group:not(.bottom) { flex: 1 1 0; align-content: start; padding: 4px; margin: -4px; }
.shell.collapsed { grid-template-columns: 56px minmax(0, 1fr); }
.shell.collapsed .sidebar { padding-inline: 8px; }
.shell.collapsed .sidebar-toggle { align-self: center; margin-inline-start: 0; }
+20 -5
View File
@@ -21,8 +21,10 @@ const MB = 1e6;
const MIB = 1024 * 1024;
export async function render(root, { api, info, setMeta, actions }) {
// Only the About group's database and uptime: without them those rows show a dash.
// Only the About group's database and uptime, filled in when the dashboard answers: the form never waits for its
// archive statistics, and without them those rows keep a dash.
const status = api.get("/api/v1/server/dashboard").then((d) => ({ ...d, at: Date.now() }), () => null);
let dashboard = null;
let settings;
try {
settings = await api.get("/api/v1/server/settings");
@@ -30,7 +32,6 @@ export async function render(root, { api, info, setMeta, actions }) {
root.innerHTML = `<div class="panel empty">${escapeHtml(errorText(err))}</div>`;
return;
}
const dashboard = await status;
setMeta("");
// In the header, like the other pages' main action, so toasts never cover it.
actions.innerHTML = `<button class="btn primary" type="submit" form="settings-form" data-i18n="Admin.Common.Save" data-i18n-title="Admin.Common.Save.Tip"></button>`;
@@ -99,12 +100,11 @@ export async function render(root, { api, info, setMeta, actions }) {
* and Network groups above; the uptime counts on from when it was read.
*/
function about() {
const uptime = dashboard ? formatDuration(dashboard.uptimeSeconds + (Date.now() - dashboard.at) / 1000) : "—";
const rows = [
["Admin.About.Version", `<span class="num" dir="ltr">${escapeHtml(info?.version ?? "—")}</span>`],
["Admin.About.Api", `<span class="num">${escapeHtml(info?.apiVersion ?? "—")}</span>`],
["Admin.About.Database", `<span dir="ltr">${escapeHtml(dashboard?.database ?? "—")}</span>`],
["Admin.About.Uptime", escapeHtml(uptime)],
["Admin.About.Database", `<span id="about-database" dir="ltr">${escapeHtml(database())}</span>`],
["Admin.About.Uptime", `<span id="about-uptime">${escapeHtml(uptime())}</span>`],
];
return `
<section class="panel about" aria-labelledby="about-title">
@@ -114,6 +114,14 @@ export async function render(root, { api, info, setMeta, actions }) {
</section>`;
}
function database() {
return dashboard?.database ?? "—";
}
function uptime() {
return dashboard ? formatDuration(dashboard.uptimeSeconds + (Date.now() - dashboard.at) / 1000) : "—";
}
/** The certificate and key files are used only in Own certificate mode; elsewhere they are off and say so. */
function pemFiles(form) {
const pem = form.elements.tlsMode.value === "pem";
@@ -174,6 +182,13 @@ export async function render(root, { api, info, setMeta, actions }) {
root.querySelector(".about").scrollIntoView({ block: "start" });
root.querySelector("#about-title").focus({ preventScroll: true });
}
// Only the two rows change, so the focus and the form's edits stay; a page left meanwhile is not touched.
status.then((d) => {
dashboard = d;
if (!d || !root.isConnected) return;
root.querySelector("#about-database").textContent = database();
root.querySelector("#about-uptime").textContent = uptime();
});
}
function cap(s) {