From 7ea1e6a4b354d36828563af543075234e7328182 Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 14 Nov 2026 13:04:37 +0800 Subject: [PATCH] usage: the tray panel and the TUI leave out what the Usage page hides onkashiko on X: a provider whose allowance card was hidden in the main window (Usage > Overview, "Hide from Overview") still showed in the menu bar's panel. The panel's Allowances tab had only its own Arrange list (panelUsageHidden) and read the full cards. Now the panel leaves out a card whose cardHideKey is in usageCardsHidden and the rows in usageWindowsHidden (withoutHiddenRows), as Overview does; a menu bar cell's card still shows (panelPeek). A subscription whose every card the page hides counts in the foot's "{n} hidden" and shows as hidden in Arrange; Show there also drops its keys from usageCardsHidden, since the panel follows the page. All of it is panelPageCut in the Usage plugin's page.js, which every window loads, so the core scripts get no bigger (TestCoreScriptBudget unchanged). Hiding from the panel alone still leaves the page as it is. The panel reads settings again each time it is shown (loadBack), so a hide or unhide in the main window reaches it with no restart. Siblings: magpie tui's Usage page leaves out the same cards and rows (usageShown, read at every quota read). The menu bar's cells and tooltip show only the cards picked in Settings, so they keep a hidden card as before; routing, caps and counting are unchanged. Run: - panel-page-hidden.test.cjs (new): chromium + webkit, en/zh/zh-TW/ja/de, 10/10 green; red on the old app.js/panelarrange.js (cards still drawn). - TestUsagePageLeavesOutWhatTheAppHides (new): green; red on the old pages.go (balance, account and row still listed). - GUI: the 128 files that read the panel, Usage or tray code, chromium + webkit, every language, on mote: 17 files red, rerun alone at concurrency 1 here 123/449 red and at origin/main 015860f2d 122/449, the same tests but tray-cell-click's chromium en, which is red alone on main too (#5215); the rest noted on #5475. tray-cell-click + panel-arrange + panel-page-hidden together before the last rebase (no GUI file changed in it): 21 of 22, the one red tray-cell-click's (#5215). At this head (after the move into page.js): panel-page-hidden, panel-arrange, panel-balance-order and i18n-keys green; the reds in key-balance-card (de), panel-fold, tray-cell-click (zh) and usage-cards-hide are each in the origin/main 015860f2d record above. - Full suite (go test -tags nogui -count=1 -timeout 45m ./...) on mica under suite.lock at 734f06b64 (this change before the move into page.js): 97 packages ok; internal/gui red only on TestCoreScriptBudget (fixed by the move), internal/gateway red from "too many open files in system" at mica's load ~65. At this head on mote: internal/gateway, internal/gui, internal/tui, internal/settings and internal/redact (the one commit rebased over) ok; gofmt -l clean; go vet, GOOS=linux go vet -tags nogui and GOOS=windows go vet ./... clean; go build ok. - Rebased onto origin/main 667ac8bd6 (5faed634d): internal/gui (budget included), internal/tui and internal/settings ok on mote; panel-page-hidden + panel-arrange 18 of 18. Not tried: the real tray panel by hand on a live install. --- docs/reference.md | 6 +- docs/subsystems/gui-shell.md | 6 +- internal/gui/assets/app.js | 9 +- internal/gui/assets/panelarrange.js | 18 +-- internal/gui/assets/plugins/usage/page.js | 29 ++++- internal/gui/tests/panel-page-hidden.test.cjs | 108 ++++++++++++++++++ internal/settings/settings.go | 11 +- internal/tui/pages.go | 2 +- internal/tui/usage_hidden.go | 50 ++++++++ internal/tui/usage_hidden_test.go | 65 +++++++++++ 10 files changed, 280 insertions(+), 24 deletions(-) create mode 100644 internal/gui/tests/panel-page-hidden.test.cjs create mode 100644 internal/tui/usage_hidden.go create mode 100644 internal/tui/usage_hidden_test.go diff --git a/docs/reference.md b/docs/reference.md index 940e26b4f..b0385a259 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -3206,7 +3206,11 @@ press *Arrange* at the foot of the panel's tab and move the rows there. The same *Arrange* hides a subscription from the panel's tab (*Hide*, *Show* puts it back), and the tab's foot says how many are hidden. Hiding is the panel's only: routing, caps, the Usage page and the menu bar's own cells -still have it, and a menu bar cell for it still opens its card. Both are +still have it, and a menu bar cell for it still opens its card. A card or +quota row hidden on the Usage page (its card's *Hide from Overview*) is left +out of the panel's tab too, and of `magpie tui`'s Usage page; a +subscription hidden there whole shows as hidden in the panel's *Arrange*, +whose *Show* brings it back on the Usage page too. Both are kept in magpie's settings (`usageOrder`, `panelUsageHidden`). Which allowances the menu bar itself shows beside its icon is picked in Settings. The same list has *Tokens and cost today* and *Tokens and cost, last 7 diff --git a/docs/subsystems/gui-shell.md b/docs/subsystems/gui-shell.md index d36a182ca..9a09799d9 100644 --- a/docs/subsystems/gui-shell.md +++ b/docs/subsystems/gui-shell.md @@ -662,9 +662,9 @@ covers it in both engines, every language and a narrow window. - There are no native `