fix(webui): settings slice 1: the failed settings read and failedView share one copy of the line every failed read ends with, so the shipped-strings pin in shell.test finds it once again (#1873, lane settings-s1)

This commit is contained in:
jason.woltje committed 2026-11-19 14:04:14 -06:00
1 parent 4cbf3f07b0
commit c9d64a341e
1 file changed
+4 -2
+4 -2
View File
@@ -1718,7 +1718,9 @@
const refusal = err => err.status === 403 || ['not-configured', 'no-bus-host', 'queue-refused'].includes(err.code);
// After a refusal nothing read before is shown anywhere: not in a view, the palette or the Inbox count.
function forget() { window.MosaicChat?.forget(); last.clear(); inboxCount = null; messageCount = null; }
const failedView = (err, path) => `${head(path === '/queue' ? 'Queue' : failTitle(err))}<div class="banner ${refusal(err) ? 'ref' : 'err'}" role="alert"><p>${refusal(err) ? `<b>refused: <code>${txt(err.code)}</code>.</b> ` : ''}${why(err, err.code === 'queue-refused')} Console shows nothing rather than a guess. Nothing was written.</p>${retry}</div>${empty('Nothing to show.', refusal(err) ? 'The view stays empty until the problem above is fixed.' : err.module ? 'Read again.' : 'Read again, or come back when the bus answers.')}`;
// One shipped copy of the line every failed read ends with (failedView and settingsFailed).
const NO_GUESS = 'Console shows nothing rather than a guess. Nothing was written.';
const failedView = (err, path) => `${head(path === '/queue' ? 'Queue' : failTitle(err))}<div class="banner ${refusal(err) ? 'ref' : 'err'}" role="alert"><p>${refusal(err) ? `<b>refused: <code>${txt(err.code)}</code>.</b> ` : ''}${why(err, err.code === 'queue-refused')} ${NO_GUESS}</p>${retry}</div>${empty('Nothing to show.', refusal(err) ? 'The view stays empty until the problem above is fixed.' : err.module ? 'Read again.' : 'Read again, or come back when the bus answers.')}`;
// #1873 settings slice 1 (D7): an organization page under Settings that cannot be read keeps the
// Settings nav, so the instance pages (Appearance, Model setup, Triage, Console) stay one link
// away. When the organization's bus is down the page says so in plain words and offers Restart,
@@ -1735,7 +1737,7 @@
const why = window.MosaicConsole?.orgDownReason?.(id, label, v => { const p = document.querySelector(`[data-org-down="${CSS.escape(id)}"] [data-org-down-why]`); if (p) { p.innerHTML = whyText(v); p.hidden = !p.innerHTML; } }) ?? null;
return settingsShell(page, `<section class="panel org-down" data-org-down="${txt(id)}"><div class="banner err" role="alert"><p><b>${state}, so ${txt(name)} can't be read.</b> Start it again to see and change this page. Nothing was written.</p><p data-org-down-why${why ? '' : ' hidden'}>${whyText(why)}</p>${restart ? `<p>${restart}</p>` : '<p class="small">Ask the instance owner to restart it.</p>'}</div><p class="small">This instance's own pages still work: <a href="#/settings/appearance">Appearance</a>, <a href="#/settings/model-proxy">Model setup</a>${triageOwner ? ', <a href="#/settings/triage">Triage</a>' : ''} and <a href="#/settings/console">Console</a>.</p></section>`);
}
return settingsShell(page, `<div class="banner ${refusal(err) ? 'ref' : 'err'}" role="alert"><p><b>${txt(failTitle(err))}.</b> ${refusal(err) ? `<code>${txt(err.code)}</code>. ` : ''}${why(err, err.code === 'queue-refused')} Console shows nothing rather than a guess. Nothing was written.</p>${retry}</div>`);
return settingsShell(page, `<div class="banner ${refusal(err) ? 'ref' : 'err'}" role="alert"><p><b>${txt(failTitle(err))}.</b> ${refusal(err) ? `<code>${txt(err.code)}</code>. ` : ''}${why(err, err.code === 'queue-refused')} ${NO_GUESS}</p>${retry}</div>`);
}
const staleBanner = err => `<div class="banner err s1-stale" role="alert"><p><b>The last read failed.</b> ${why(err)} This is what was read before, ${when(readAt)}. Nothing was changed.</p>${retry}</div>`;
// Freshness line in the command bar for bus pages.