Problem/Motivation
The dashboard includes a "View calls" link intended to open the AI Usage Log
filtered to a specific editor. The ai_usage_log view has no uid
argument handler, so the uid appended to the link path is silently ignored and
the log lists every user on the site. The log also paginates at 50 rows, which
is more than a per-editor view needs.
Steps to reproduce
- Open
/admin/reports/ai-meteringwith multiple users having usage rows. - Click "View calls" on any specific editor row.
- The AI Usage Log opens and shows calls from all users, not just that editor.
Environment
- Drupal version: 11.3.11
- ai_metering version: 1.0.0-alpha1
- AI provider module + version: any
- AI feature module tested: N/A
Proposed resolution
Expose a uid argument handler on the ai_metering_usage.uid column
in hook_views_data(), add a uid contextual argument to the
ai_usage_log view, and update the "View calls" link on the dashboard
to use the path form (/admin/reports/ai-metering/log/UID) so it
filters to the selected editor. Lower the pager from 50 to 10 rows.
Deliver as hook_update_N() so existing sites pick up the argument
and pager change without losing any view customisations.
Remaining tasks
- Add
argument(andfilter) handlers for uid inhook_views_data(). - Add the uid contextual argument to the view config.
- Update the dashboard "View calls" link to the path form.
- Lower the pager to 10 rows.
- Add
hook_update_N()(idempotent, leaves customised views untouched). - Verify filtering and pager; review.
User interface changes
Yes , "View calls" now opens the AI Usage Log filtered to the selected editor; pager shows 10 rows.
API changes
N/A
Data model changes
N/A
AI assistance
N/A
Comments
Comment #2
codeitwisely commentedComment #9
codeitwisely commented