Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui: no gateway key yet is said muted and inset in its card, as Recent calls says none (HarriesChen on Discord)

yetone5046e4fc8415
diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css
index fa472c37e..f2564a6c3 100644
--- a/internal/gui/assets/app.css
+++ b/internal/gui/assets/app.css
@@ -2836,6 +2836,8 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; }
.sheet .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1px 12px; }
.sheet .none { padding: 14px 2px; color: var(--muted); font-size: 12px; }
#gwModels .none { padding: 16px; color: var(--muted); font-size: 12px; text-align: center; }
+/* no gateway key yet: said in its card as Recent calls says it has none */
+#gatewayKeys .none { padding: 13px 14px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
#view-gateway .row-head .find { margin-right: 8px; }
/* a row of the add sheet: an icon and a name, no frame; a row already
added has a small green dot after its name rather than fading */
diff --git a/internal/gui/tests/README.md b/internal/gui/tests/README.md
index 64f46e96f..7a3d4b14f 100644
--- a/internal/gui/tests/README.md
+++ b/internal/gui/tests/README.md
@@ -41,6 +41,12 @@ a live gateway.
## Gateway Caller Keys
+`gateway-keys-empty.test.cjs` checks the Gateway page with no gateway key
+yet, as magpie web on a 390px phone: "No gateway keys yet" sits inside the
+list's card, inset from its edges, in the muted colour and size of Recent
+calls' empty line, in Chromium and WebKit, light and dark, and every
+language.
+
`gateway-caller-keys.test.cjs` checks the named caller-key list on the
Gateway page, including creation, copying, renaming, disabling, enabling,
rotation and deletion. It verifies key-level usage overview, request filtering and
diff --git a/internal/gui/tests/fixtures/caller-keys.cjs b/internal/gui/tests/fixtures/caller-keys.cjs
index 99b7e23ea..64d349f7b 100644
--- a/internal/gui/tests/fixtures/caller-keys.cjs
+++ b/internal/gui/tests/fixtures/caller-keys.cjs
@@ -14,6 +14,8 @@ function fixture(lang, theme, events, options = {}) {
{ id: "server", name: "Server", masked: "sk-magpie-key-…222222" },
{ id: "work", name: "Work", masked: "sk-magpie-key-…333333" },
];
+ // options.keys is the test's own list: [] for the empty Gateway keys
+ if (options.keys) keys = options.keys;
for (const k of keys) {
if (options.limits?.[k.id]) Object.assign(k, options.limits[k.id]);
if (options.keyHolds?.[k.id]) Object.assign(k, options.keyHolds[k.id]);
diff --git a/internal/gui/tests/gateway-keys-empty.test.cjs b/internal/gui/tests/gateway-keys-empty.test.cjs
new file mode 100644
index 000000000..d9474a4ff
--- /dev/null
+++ b/internal/gui/tests/gateway-keys-empty.test.cjs
@@ -0,0 +1,57 @@
+const assert = require("node:assert/strict");
+const { test } = require("node:test");
+const { chromium, webkit } = require("playwright");
+const { fixture } = require("./fixtures/caller-keys.cjs");
+
+// No gateway key yet (HarriesChen on Discord, 10-25): magpie web on a phone
+// drew "No gateway keys yet" in the body's text, 14px and dark, flush
+// against its card's edges. It is said in its card the way the same page's
+// Recent calls says it has none: muted, small, inset.
+const NONE = { en: "No gateway keys yet", zh: "尚无网关密钥", "zh-TW": "尚無閘道金鑰", ja: "ゲートウェイキーはまだありません", de: "Noch keine Zugangsschlüssel" };
+
+const look = (page) => page.evaluate(() => {
+ const none = document.querySelector("#gatewayKeys .none");
+ const calls = document.querySelector("#activity .none");
+ const card = none.parentElement.getBoundingClientRect();
+ const r = document.createRange();
+ r.selectNodeContents(none);
+ const text = r.getBoundingClientRect();
+ const cs = getComputedStyle(none), ref = getComputedStyle(calls);
+ return {
+ inCard: none.parentElement.matches("#gatewayKeys > .accts"),
+ text: none.textContent,
+ color: cs.color, refColor: ref.color,
+ size: cs.fontSize, refSize: ref.fontSize,
+ weight: cs.fontWeight,
+ inset: Math.min(text.left - card.left, card.right - text.right, text.top - card.top, card.bottom - text.bottom),
+ overflow: document.documentElement.scrollWidth - innerWidth,
+ };
+});
+
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) {
+ for (const theme of ["light", "dark"]) {
+ test(`${engine} ${lang} ${theme}: no gateway key is said like the page's other empty lists`, async (t) => {
+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
+ t.after(() => browser.close());
+ const page = await (await browser.newContext({ viewport: { width: 390, height: 844 }, reducedMotion: "reduce", colorScheme: theme })).newPage();
+ page.setDefaultTimeout(6000);
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ await page.route("**/*", fixture(lang, theme, [], { lan: true, web: true, keys: [] }));
+ await page.goto("http://magpie.test/?view=gateway");
+ await page.locator("#gatewayKeys .none").waitFor();
+ await page.locator("#activity .none").waitFor();
+ const s = await look(page);
+ assert.equal(s.inCard, true, "said inside the list's card");
+ assert.equal(s.text, NONE[lang]);
+ assert.equal(s.color, s.refColor, "muted, as Recent calls' empty line");
+ assert.equal(s.size, s.refSize, "the size of Recent calls' empty line");
+ assert.equal(s.weight, "400");
+ assert(s.inset >= 10, `inset from the card's edges, got ${s.inset}px`);
+ assert(s.overflow <= 0, "no sideways scroll at 390px");
+ assert.deepEqual(errors, []);
+ });
+ }
+ }
+}