gui: Busy models last puts its choices under its words in a narrow window

In the app window (not the web page, whose narrow rows wrap already) the
six choices of Settings > Network > Busy models last took the whole row at
390px, and squeezed the words beside them to 0px: one word a line, the row
2,379px tall. The whole Settings page grew by that much, and
allow-ips.test.cjs's en case went red in both engines (Remove moved the
page 3160 -> 3127), first at 8d8df0639 (v0.1.2547). Bisected: green at
8d8df0639^, red at 8d8df0639.

The row now wraps: the words keep 220px or the row's width, and the
choices go under them, wrapping themselves where even that is too narrow
(slide() already glides a wrapped strip's thumb).

model-load.test.cjs's "busy models go last" now runs at 390 (was 420) and
in the window as well as on the web page, and checks the words keep their
width and the row stays under 200px.

Run on mote at this tree:
- model-load + allow-ips, both engines, 390 and 900, en zh zh-TW ja de:
  96/96 pass.
- the 12 other GUI files that open Settings > Network (api-key-theme,
  browser-access, bare-ids, cors-origins, github-token(-refused),
  gateway-port, lan-public, lan-docker, proxy-test, settings-proxy-*):
  136/136 pass.
Broken by hand: the new CSS taken out, the window cases go red in every
language at 390, in both engines (10 of 40), the web cases stay green.
Not tried: the real window app at that width (its minimum is wider than
a phone; the panel is where a narrow Settings is met).
This commit is contained in:
yetone
2026-11-01 17:12:36 +08:00
parent df0320156b
commit 77e8535887
2 changed files with 18 additions and 3 deletions
+7
View File
@@ -3718,6 +3718,13 @@ input.words.compact-num { flex: none; width: 76px; font-variant-numeric: tabular
.row.pref.rule-row { flex-wrap: wrap; row-gap: 8px; }
.row.pref.rule-row .who { flex: 1 1 100%; }
.row.pref.rule-row .sub { white-space: normal; }
/* Busy models last: six choices don't fit beside their words in a phone-wide
window, where they squeezed the words to a word a line (2.3k px tall), so
they go under them, wrapping where even that is too narrow */
#busyLoadRow { flex-wrap: wrap; row-gap: 8px; }
#busyLoadRow .who { flex: 1 1 220px; }
#busyLoadSegs { margin-left: auto; max-width: 100%; }
#busyLoadSegs > .segs { max-width: 100%; flex-wrap: wrap; }
/* the address a refused allow list would shut out, added in one click */
.row.pref.rule-row .who .allow-fix { display: block; max-width: 100%; margin: 4px 0 0 -7px; overflow: hidden; text-overflow: ellipsis; color: var(--accent); }
.row.pref.cors-origin .name { white-space: normal; overflow-wrap: anywhere; }
+11 -3
View File
@@ -103,7 +103,7 @@ async function open(engine, width, t, name) {
}
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const width of [420, 900]) {
for (const width of [390, 900]) {
for (const lang of Object.keys(want)) {
const w = want[lang];
test(`${engine} ${width} ${lang}: a model's load shows by it`, async (t) => {
@@ -139,12 +139,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.deepEqual(errors, []);
});
test(`${engine} ${width} ${lang}: busy models go last, or not`, async (t) => {
const page = await open(engine, width, t, `${lang}-busy-load`);
// in the window as well as on the web page, whose narrow rows wrap by
// themselves (body.web): only the window's squeezed the words
for (const web of [true, false]) test(`${engine} ${width} ${lang} ${web ? "web page" : "window"}: busy models go last, or not`, async (t) => {
const page = await open(engine, width, t, `${lang}-${web ? "web" : "window"}-busy-load`);
const errors = [], posted = [];
page.on("pageerror", (e) => errors.push(e.message));
await page.route("**/*", server(lang, posted));
await watchSettingsReads(page);
if (!web) await page.route("**/boot.js", (r) => r.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light"};` }));
await page.goto("http://magpie.test/?view=settings&tab=network");
await settingsDrawn(page);
const segs = page.locator("#busyLoadSegs .opt");
@@ -159,6 +162,11 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert(await page.locator("#view-settings").evaluate((v) => v.scrollWidth <= v.clientWidth + 1), "the settings scroll sideways");
const rb = await row.boundingBox(), sb = await page.locator("#busyLoadSegs").boundingBox();
assert(sb.x + sb.width <= rb.x + rb.width + 1, "the switch runs out of its row");
// the choices never squeeze the words beside them: at a phone's width
// they once left the words a word a line, the row 2.3k px tall
const who = await row.locator(".who").boundingBox();
assert(who.width >= Math.min(220, rb.width - 30), `the words are squeezed to ${Math.round(who.width)}px`);
assert(rb.height < 200, `the row is ${Math.round(rb.height)}px tall`);
await wheelTo(page, segs.nth(3), 200);
const before = await view(page);