feat(usage): lift provider/model filters to dashboard-wide scope

The provider/model filters only lived inside the request-log table, so
there was no way to see "how much did app X spend on source Y" across
the whole dashboard. Promote them to the top bar next to the app
filter, applying globally to the hero summary, trend chart, request
logs, and both stats tabs.

Backend: the five stats queries (summary, summary-by-app, trends,
provider stats, model stats) accept optional provider_name/model
filters, applied to both the detail and daily-rollup branches (the
rollup PK already carries provider_id/model/pricing_model). Sources
match by exact display name via provider_name_coalesce, so session
placeholder rows like "Claude (Session)" are selectable; models match
by effective pricing model (pricing_model falling back to model), the
same grouping key the model-stats tab uses. Request-log filtering
switches from LIKE to these exact semantics.

Frontend: two truncating dropdowns list only sources/models that have
data in the current range, with the model list cascading from the
selected source. Dynamic option values are prefix-encoded so a source
literally named "all" cannot collide with the sentinel, query keys
fall back to null instead of "all", and the option queries follow the
dashboard refresh interval (otherwise their default 30s polling drags
same-key stats queries along even with refresh disabled). The
request-log filter bar keeps only the log-specific status-code select.
Labels read "sources" rather than "providers" because direct-connect
session buckets sit alongside real providers. i18n updated across
zh/en/ja/zh-TW.
This commit is contained in:
Jason
2026-06-11 16:14:20 +08:00
parent c701068f0c
commit a75f479576
15 changed files with 871 additions and 281 deletions
+4 -3
View File
@@ -1441,10 +1441,11 @@
"modelIdPlaceholder": "e.g., claude-3-5-sonnet-20241022",
"displayNamePlaceholder": "e.g., Claude 3.5 Sonnet",
"appType": "App Type",
"allApps": "All Apps",
"statusCode": "Status Code",
"searchProviderPlaceholder": "Search provider...",
"searchModelPlaceholder": "Search model...",
"allSources": "All Sources",
"allModels": "All Models",
"filterBySource": "Filter by source",
"filterByModel": "Filter by model",
"timeRange": "Time Range",
"customRange": "Calendar Filter",
"customRangeHint": "Supports both date and time",
+4 -3
View File
@@ -1441,10 +1441,11 @@
"modelIdPlaceholder": "例: claude-3-5-sonnet-20241022",
"displayNamePlaceholder": "例: Claude 3.5 Sonnet",
"appType": "アプリ種別",
"allApps": "すべてのアプリ",
"statusCode": "ステータスコード",
"searchProviderPlaceholder": "プロバイダーを検索...",
"searchModelPlaceholder": "モデルを検索...",
"allSources": "すべてのソース",
"allModels": "すべてのモデル",
"filterBySource": "ソースで絞り込む",
"filterByModel": "モデルで絞り込む",
"timeRange": "期間",
"customRange": "カレンダーフィルター",
"customRangeHint": "日付と時刻の両方に対応",
+4 -3
View File
@@ -1413,10 +1413,11 @@
"modelIdPlaceholder": "例如: claude-3-5-sonnet-20241022",
"displayNamePlaceholder": "例如: Claude 3.5 Sonnet",
"appType": "應用程式類型",
"allApps": "全部應用程式",
"statusCode": "狀態碼",
"searchProviderPlaceholder": "搜尋供應商...",
"searchModelPlaceholder": "搜尋模型...",
"allSources": "全部來源",
"allModels": "全部模型",
"filterBySource": "依來源篩選",
"filterByModel": "依模型篩選",
"timeRange": "時間範圍",
"customRange": "日曆篩選",
"customRangeHint": "支援日期與時間",
+4 -3
View File
@@ -1441,10 +1441,11 @@
"modelIdPlaceholder": "例如: claude-3-5-sonnet-20241022",
"displayNamePlaceholder": "例如: Claude 3.5 Sonnet",
"appType": "应用类型",
"allApps": "全部应用",
"statusCode": "状态码",
"searchProviderPlaceholder": "搜索供应商...",
"searchModelPlaceholder": "搜索模型...",
"allSources": "全部来源",
"allModels": "全部模型",
"filterBySource": "按来源筛选",
"filterByModel": "按模型筛选",
"timeRange": "时间范围",
"customRange": "日历筛选",
"customRangeHint": "支持日期与时间",