The console links to the nodes page, and a lost session leaves it

Three navigation faults, all found from the service request log rather than by looking
at the page:

- The console had no link to the nodes page at all. It was a standalone file I created
  and never wired in, so leaving the nodes page meant there was no way back except the
  browser. It is in the nav now, and every href on the console was checked against the
  running service rather than assumed.
- VIEWS omitted 'projects' although the section and its nav link both exist, so clicking
  Projects silently fell through to the dashboard. A link that looks live and does
  nothing is worse than no link. Flagged in an earlier session as not-my-problem and left
  alone; it was two characters.
- A 401 left the nodes page sitting there saying the session had ended, with nothing on
  the page that could work without one. It now redirects to the console, which is what
  the console does itself.

The empty organization dropdown was this too: with no session the organizations request
is 401, the list is empty, and the form is disabled with the new banner - which is
correct behaviour for a genuine no-organizations system and a misleading one for an
expired session. Redirecting first is what tells those two apart at the point where it
matters.

547 passed, 29 skipped.
This commit is contained in:
umbra audio
2026-10-03 16:16:04 -07:00
parent 14eba11ffe
commit 0a4c400022
3 changed files with 14 additions and 6 deletions

View File

@@ -1955,7 +1955,11 @@
/* ---------------------------------------------------------- view router */
var VIEWS = ['dashboard', 'accounts', 'organizations', 'audit'];
// 'projects' is here because the section and its nav link both exist. It was absent,
// so clicking Projects fell through to the dashboard without saying so - a link that
// looks live and does nothing, which is worse than no link. The hash router only
// recognises what is in this list.
var VIEWS = ['dashboard', 'accounts', 'organizations', 'projects', 'audit'];
function viewFromLocation() {
var hash = String(global.location.hash || '').replace(/^#/, '');

View File

@@ -509,11 +509,14 @@
},
function (error) {
if (error && error.status === 401) {
// Distinguished from every other failure because it is the one the operator
// can fix: the session ended, and the page looks broken rather than expired.
setNodeListHint(
'Your session has ended. Sign in again and reload this page.'
);
// Redirect rather than explain. A page that says "your session has ended" and
// leaves you there is a dead end: the organization list, the node list and
// the form all need a session, so there is nothing on this page that can work
// until you sign in again. The console does the same thing.
//
// It also explains the earlier symptom: with no session, the organization
// dropdown is empty, which is what was reported.
global.location.href = '../index.html';
return;
}
say(api.describeError(error), 'error');

View File

@@ -34,6 +34,7 @@
<a class="admin-nav-link" href="#organizations" data-view-link="organizations"><span aria-hidden="true">◈</span>Organizations</a>
<a class="admin-nav-link" href="#projects" data-view-link="projects"><span aria-hidden="true">◇</span>Projects</a>
<a class="admin-nav-link" href="#audit" data-view-link="audit"><span aria-hidden="true">≡</span>Audit log</a>
<a class="admin-nav-link" href="./nodes.html"><span aria-hidden="true">◉</span>Nodes</a>
<a class="admin-nav-link" href="../settings.html"><span aria-hidden="true">⚿</span>Your account</a>
</nav>
<div class="admin-sidebar-footer">