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.

Command icon 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

codeitwisely created an issue. See original summary.

  • codeitwisely committed adcbec0b on 1.0.x
    Issue #3613099 by codeitwisely: Extract dashboard charts into cacheable...
codeitwisely’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

codeitwisely’s picture

Status: Fixed » Closed (fixed)