routing: the groups page's Select and New group no longer touch

The groups page's toolbar row has gap 0, so Import, Select and the
filled New group sat edge to edge: Select's hover met New group's fill
(the owner's screenshot, 11-08). The buttons right of the spacer now
stand 4px apart, New group 8px.

Run at this head (rebased on 4fac4c863): group-new-head.test.cjs,
Chromium and WebKit, en and zh, 4/4 on mote. Its fixture has two groups
now, so Select shows as in the screenshot, and it checks each button
pair's distance. Broken by hand: with the CSS taken out, 4/4 red
("rt-gimportbtn | rt-gselect touch: 0px").

The 78 GUI files that reach the groups page, at the pre-rebase head on
mote at load 60-200: 938 pass, 134 red, 124 of them TimeoutErrors. Of
the 10 assertion failures, run alone one file at a time at this change and at
origin/main 8935abcf5: group-disabled-contrast passes, and
menu-input-scroll (#3402) and routing-intent-entry (#5392) are red the
same 12 on both. group-accounts, group-arrange and filter-ime, which
timed out in the full run, pass alone.
Not tried: the real app; the whole GUI suite.
This commit is contained in:
yetone
2026-11-09 09:27:37 +08:00
parent 4fac4c863b
commit a912cdc369
2 changed files with 18 additions and 1 deletions
@@ -284,6 +284,10 @@
.rt-gsec > .row-head:first-child .rt-gfilter { flex: 0 1 300px; width: auto; margin: 0; }
.rt-gsec > .row-head:first-child .rt-gcount { margin-left: 10px; white-space: nowrap; }
.rt-gsec > .row-head:first-child .rt-gfilter + .rt-gcount { margin-left: 10px; }
/* its buttons on the right apart, so one's hover never meets the next,
and New group, the filled one, a little further */
.rt-gsec > .row-head:first-child > .grow ~ * + * { margin-left: 4px; }
.rt-gsec > .row-head:first-child > .grow ~ .rt-gnew { margin-left: 8px; }
/* the way back to Routing (gBack): beside the sidebar only when the page was opened from Routing */
.rt-gsec > .row-head:first-child .rt-gback { flex: none; margin-right: 8px; white-space: nowrap; }
body.side-nav #view-groups:not(.rt-gfrom) .rt-gback { display: none; }
+14 -1
View File
@@ -21,6 +21,8 @@ const models = [
];
const info = (ids) => ids.map((id) => ({ id, ready: true }));
const found = { id: "auto-m", name: "Model M", members: ["a/m", "b/m"], auto: true, ready: true, memberInfo: info(["a/m", "b/m"]) };
// a second group, so Select sits beside New group as with any two
const found2 = { ...found, id: "auto-n", name: "Model N" };
const words = {
en: { btn: "New group", tip: "Make a routing group of any models you like — agents pick it as one model" },
@@ -48,7 +50,7 @@ function serve(lang) {
return json({ mine: true, now: new Date().toISOString(), seq: 30, totals: { requests: 30, rerouted: 0, errors: 0 }, routes });
}
if (url.pathname === "/api/gateway/history") return json({ cut: false, days: [], routes: [] });
if (url.pathname === "/api/groups") return json({ models, pools: [], deciders: [], found: true, groups: [found] });
if (url.pathname === "/api/groups") return json({ models, pools: [], deciders: [], found: true, groups: [found, found2] });
if (url.pathname === "/api/providers") return json({ providers: [], presets: [], excluded: [], gateway: { running: true, window: true, url: "http://127.0.0.1:3999" } });
if (url.pathname.startsWith("/api/")) return json({});
const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
@@ -91,6 +93,17 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert(hb && hb.y >= 0 && hb.y + hb.height <= vh, "New group is in sight");
const border = await head.evaluate((e) => { const c = getComputedStyle(e); return c.borderLeftWidth !== c.borderRightWidth || c.borderLeftColor !== c.borderRightColor; });
assert.equal(border, false, "no left-border accent");
// the toolbar's buttons stand apart: Select and the filled New group
// touched (11-08)
assert.equal(await page.locator(".rt-gsec > .row-head .rt-gselect").count(), 1, "Select is there");
const gaps = await page.evaluate(() => {
const bs = [...document.querySelectorAll("#view-groups .rt-gsec > .row-head:first-child > button")].filter((b) => b.offsetParent);
return bs.slice(1).map((b, i) => ({ pair: bs[i].className + " | " + b.className, gap: b.getBoundingClientRect().left - bs[i].getBoundingClientRect().right }));
});
assert(gaps.length >= 2, JSON.stringify(gaps));
for (const g of gaps) assert(g.gap >= 4, `${g.pair} touch: ${g.gap}px`);
const last = gaps[gaps.length - 1];
assert(/rt-gselect/.test(last.pair) && last.gap >= 8, `New group ${last.gap}px from Select`);
await head.click();
const ed = page.locator(".rt-gsec .rt-gedit");