agents: More in Plugins is in sight with Install another agent folded
The owner: 插件中还有更多,不应该折叠在安装更多Agent里.e8e9245ecput the row naming the agents Plugins has at the end of Install another agent, inside its fold, so with the commands folded (as they are once any agent is here) nobody saw it. It now follows the section whether that is folded or open, 6px under the header; the header counts the install commands only, and with no command left the row stands alone with no header over it. Budgets: app.js 1,311,735 and the core 1,530,861 (+54 each), no room added. Run at this head (rebased onddf31ca30), on mote: - agent-plugin-agents, agent-cli-missing, agent-prefs, agent-stale-copies, agent-tweak-fold, agent-unreachable, agent-update-all, agent-visibility-saving, click-scroll, page-width, page-width-steady, i18n-keys, one file at a time, both engines and the files' languages: 294 of 297, the 3 reds a chromium launch timing out at 180s and one zh-TW 420 click waiting for the header under load 95; those two files run again alone: 54 of 54. - An earlier run of every agent-* file plus those, 4 at a time at load 100, timed out in 36 places across the files above; the run above is the record. - go test ./internal/gui -run Budget: ok. Broken by hand: with the row back inside the fold, agent-plugin-agents goes red in every language and width. Not tried: the real app on Windows and Linux.
This commit is contained in:
@@ -730,6 +730,7 @@ body.window .row.agent .who .ag-cli { flex: 0 1 auto; overflow: hidden; }
|
||||
/* the agents plugins add: one row, its way to Plugins */
|
||||
.ag-install-plugins { width: 100%; align-items: center; font: inherit; color: var(--accent); text-align: left; cursor: pointer; transition: background .2s; }
|
||||
.ag-install-plugins:hover { background: var(--accent-soft); }
|
||||
.ag-install-head + .ag-install-plugins { margin-top: 6px; }
|
||||
.ag-install-plugins:focus-visible { outline: 1.5px solid var(--fg-2); outline-offset: 1px; }
|
||||
.ag-install-plugins .ag-install-who { flex: none; padding-top: 0; }
|
||||
.ag-install-plugins .puzzle { flex: none; width: 18px; height: 18px; display: grid; place-items: center; }
|
||||
|
||||
@@ -2602,14 +2602,14 @@ function paintInstalls() {
|
||||
head.type = "button";
|
||||
head.setAttribute("aria-expanded", String(open));
|
||||
head.dataset.unrolls = ""; // it stays put, and its commands open beneath it
|
||||
head.append(el("span", "", t("Install another agent ({n})", { n: items.length + pluginAgents.length })), el("span", "chev", svg(CHEV, 10, 1.8)));
|
||||
head.append(el("span", "", t("Install another agent ({n})", { n: items.length })), el("span", "chev", svg(CHEV, 10, 1.8)));
|
||||
head.onclick = (e) => {
|
||||
e.stopPropagation();
|
||||
installsOpen = !open;
|
||||
paintInstalls();
|
||||
$("#agentsInstall .ag-install-head")?.focus({ preventScroll: true });
|
||||
};
|
||||
const parts = [head];
|
||||
const parts = items.length ? [head] : [];
|
||||
if (open) {
|
||||
if (items.length) parts.push(el("p", "ag-install-note", installNote(items)));
|
||||
for (const x of items) {
|
||||
@@ -2634,9 +2634,10 @@ function paintInstalls() {
|
||||
r.append(who, cmds);
|
||||
parts.push(r);
|
||||
}
|
||||
// the agents plugins add, installed from Plugins as every plugin is
|
||||
if (pluginAgents.length) parts.push(pluginAgentsRow());
|
||||
}
|
||||
// the agents plugins add, installed from Plugins as every plugin is: in
|
||||
// sight with the commands folded (the owner: not folded away with them)
|
||||
if (pluginAgents.length) parts.push(pluginAgentsRow());
|
||||
box.replaceChildren(...parts);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,10 +1,11 @@
|
||||
// Run with Node's test runner and Playwright on the module path; see README.md.
|
||||
// The owner: 因为我们支持Agent插件了,这里是不是也应该显示插件中有更多?
|
||||
// Install another agent counts the agents a suggested plugin adds, not
|
||||
// installed here, beside the ones with an install command, and ends with
|
||||
// one row naming them that opens Plugins at its Agents. With no install
|
||||
// command left, the section is there for the plugins' agents alone; with
|
||||
// no plugin agent left, it has no such row. In the window, wide and
|
||||
// Install another agent ends with one row naming the agents a suggested
|
||||
// plugin adds, not installed here, that opens Plugins at its Agents. The
|
||||
// owner: 插件中还有更多,不应该折叠在安装更多Agent里. So the row is in
|
||||
// sight with the commands folded, and the header counts the commands
|
||||
// only. With no install command left, the row is there alone, no header;
|
||||
// with no plugin agent left, there is no such row. In the window, wide and
|
||||
// narrow, in every language, both engines. No backend: the API is faked.
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs/promises");
|
||||
@@ -73,8 +74,16 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
const inst = page.locator("#agentsInstall");
|
||||
const head = inst.locator(".ag-install-head");
|
||||
const count = (n) => said(page, lang, "Install another agent ({n})", { n });
|
||||
await page.waitForFunction((want) => document.querySelector("#agentsInstall .ag-install-head")?.textContent === want, await count(5));
|
||||
await page.waitForFunction((want) => document.querySelector("#agentsInstall .ag-install-head")?.textContent === want, await count(2));
|
||||
await page.waitForFunction(() => document.querySelector("#agentsInstall .ag-install-plugins"));
|
||||
// folded, the plugins' row is in sight under the header
|
||||
assert.equal(await head.getAttribute("aria-expanded"), "false");
|
||||
assert.equal(await inst.locator(".ag-install-row").count(), 1, "folded, only the plugins' row");
|
||||
assert(await inst.locator(".ag-install-plugins").isVisible(), "the plugins' row is folded away");
|
||||
const gap = await inst.evaluate((s) => s.querySelector(".ag-install-plugins").getBoundingClientRect().top - s.querySelector(".ag-install-head").getBoundingClientRect().bottom);
|
||||
assert(gap >= 4 && gap <= 10, "the plugins' row sits " + gap + "px under the header");
|
||||
await head.click();
|
||||
await inst.locator(".ag-install-note").waitFor();
|
||||
// the commands first, then one row for the plugins' agents
|
||||
const rows = inst.locator(".ag-install-row");
|
||||
assert.equal(await rows.count(), 3);
|
||||
@@ -121,8 +130,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
p2.on("pageerror", (e) => errors.push(e.message));
|
||||
await p2.route("**/*", server(lang, ctl));
|
||||
await p2.goto("http://magpie.test/");
|
||||
await p2.waitForFunction((want) => document.querySelector("#agentsInstall .ag-install-head")?.textContent === want, await said(p2, lang, "Install another agent ({n})", { n: 3 }));
|
||||
await p2.locator("#agentsInstall .ag-install-head").click();
|
||||
await p2.locator("#agentsInstall .ag-install-plugins").waitFor();
|
||||
assert.equal(await p2.locator("#agentsInstall .ag-install-head").count(), 0, "a header over no commands");
|
||||
assert.equal(await p2.locator("#agentsInstall .ag-install-row").count(), 1);
|
||||
assert.equal(await p2.locator("#agentsInstall .ag-install-note").count(), 0, "a note about commands with none");
|
||||
await p2.context().close();
|
||||
|
||||
Reference in New Issue
Block a user