Commit Graph
1 Commits
Author SHA1 Message Date
yetone 57dc64ba12 usage: the Overview's lists rank by tokens, cost, calls or name (onducoder on X)
onducoder asked for a ranking of Usage › Overview's Agents, Models,
Gateway keys and Accounts by what each used. Each list's heading now
ends in a quiet pick (the order's name and a chevron) that opens the app
menu: Tokens (the default, the server's order), Cost, Calls or Name.
By tokens the list stays in the server's order (most tokens first,
the cache left out) unless "with cache" is on, when the cache counts
too; other orders fall back to tokens, then calls. By cost, a row
with no price goes last; by name, a row with no name goes last. Each
list keeps its own order in localStorage (magpie.usageSort), and a
folded list hides its pick. The code is in the
Usage plugin (page.js, its i18n.js); "Calls" is a core word, since other
files say it. The core script doesn't grow (TestCoreScriptBudget passes).

gateway-caller-keys and usage-accounts read the heading's .label, since
the heading's text now includes the pick; mobile-web takes the picks out
until BASE_REF has them.

Run: usage-sort.test.cjs (new; chromium and webkit, en zh zh-TW ja de,
1100 and 420 wide). On mica, with the next two commits, these files at
this head and at origin/main 783b69b8c: gui-de gui-ja gui-zh-tw i18n-keys
mobile-web phone-no-sideways usage-agents-hide usage-cards-hide
usage-count-client usage-fold usage-hidden-way-back usage-hit-rate
usage-ledger usage-range-times usage-speed-all-models, plus usage-sort,
gateway-caller-keys, usage-accounts and usage-overview-fold at this head
(333 tests). Red at both, and filed: phone-no-sideways (#5869),
usage-agents-hide (#3414), usage-cards-hide (#6294), usage-fold
(#3415), usage-hidden-way-back (#6295), usage-ledger (#5048),
usage-range-times (#6499), usage-speed-all-models (#5834). Everything
else passes. A first version re-sorted the server's list on the default
order too, which moved rows in usage-hit-rate and usage-count-client's
fixtures; the default keeps the server's order now, and both pass.
usage-*, panel-usage*, phone-* and gui-* ran on mote earlier;
TestCoreScriptBudget ok on mote at 783b69b8c. Rebased on 92e760f3d:
gui-de gui-ja gui-zh-tw i18n-keys mobile-web usage-sort
usage-overview-fold gateway-caller-keys usage-accounts usage-hit-rate
usage-count-client model-key-tag library-subagents-import, 187/187 on
mica; TestCoreScriptBudget is red there on main's own app.js (#6518,
1269382 > 1268961), the same without this change, which adds nothing to
the core.
Broken by hand: against origin/main's assets usage-sort is red (22
cases); with usageSorted returning the list unchanged, 11/11 order cases
fail.
Not tried: the real app, Linux WebKitGTK. The full GUI suite run on
mote was stopped part-way (its copy was replaced by a second run of
mine); its reds outside these files are main's (e.g. #6543, #5869).
2026-11-14 09:31:24 +08:00