Problem/Motivation
The dashboard charts show whatever 10 rows are on the current table page. That's a random slice on a site with hundreds of editors or roles, and it changes with every page flip. Since the charts share the page's max_age: 0 setting, they're also rebuilt on every request.
Proposed resolution
Extract each dashboard's charts into its own block plugin, sourced from a fixed top 5 (editors or roles) ranked by total tokens this month, matching the by-role table's existing ranking, independent of table pagination. A block per dashboard, not one shared block, avoids branching on which page it's on.
Both blocks must read the month query argument (YYYY-MM) and add url.query_args:month to their cache contexts, so the month filter still updates the chart. blockAccess() must replicate the dashboard route's permission, and cache must vary by user.permissions, so placing either in a region can't expose usage data to the wrong role.
AI assistance
Yes.
Issue fork ai_metering-3613099
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
codeitwisely commentedComment #6
codeitwisely commented