Problem/Motivation

Two issues in the editor breakdown table on the AI Metering dashboard:

  1. The Details column shows no link. log_base_url is computed in the controller but is not declared in hook_theme(), so the value never reaches the template and the {% if log_base_url %} guard is always false.
  2. The sort buttons target the wrong columns. The data-col indices were not updated when the Provider column was added, so clicking "Calls" sorts by Provider, "Cost" sorts by Tokens, and "Quota" sorts by Cost.

Steps to reproduce

  1. Install ai_metering and open /admin/reports/ai-metering with at least one usage row.
  2. Check the Details column — no link is visible.
  3. Click the Calls sort button — the Provider column sorts instead.
  4. Click the Cost sort button — the Tokens column sorts instead.

Environment

  • Drupal version: 11.3.11
  • ai_metering version: 1.0.0-alpha1
  • AI provider module + version: any (e.g. ai_provider_anthropic 1.x)
  • AI feature module tested: N/A

Proposed resolution

Declare log_base_url in the ai_metering_dashboard theme variables so the Details link reaches the template.
Correct the data-col indices on the sort buttons and table headers to match the current column order (Provider is index 1, Calls is 2, Cost is 4, Quota is 5).

Remaining tasks

  • Add log_base_url to the ai_metering_dashboard theme variables in hook_theme().
  • Correct the data-col indices in the template.
  • Verify the Details link appears and each sort button sorts its own column.
  • Review.

User interface changes

Yes, the Details link now appears in each editor row; sort buttons target the correct columns.

API changes

N/A

Data model changes

N/A

AI assistance

N/A

Comments

codeitwisely created an issue. See original summary.

codeitwisely’s picture

Assigned: Unassigned » codeitwisely

  • facfb750 committed on 1.0.x-3604227-add-log-base-url-to-hook-theme
    Issue #3604227 by codeitwisely: Declare log_base_url in hook_theme so...

  • 02f229f9 committed on 1.0.x-3604227-add-log-base-url-to-hook-theme
    Issue #3604227 by codeitwisely: Declare log_base_url in hook_theme so...

  • codeitwisely committed f3e3c10b on 1.0.x
    Issue #3604227: Declare log_base_url in hook_theme so the View calls...

  • codeitwisely committed f3e3c10b on 1.0.x-3604256-pricing-source-plugin
    Issue #3604227: Declare log_base_url in hook_theme so the View calls...

  • codeitwisely committed f3e3c10b on 1.0.x-3604238-test-litellm-rate-path
    Issue #3604227: Declare log_base_url in hook_theme so the View calls...

  • codeitwisely committed f3e3c10b on 1.0.x-3604229-skip-wrapper-provider-double-count
    Issue #3604227: Declare log_base_url in hook_theme so the View calls...

  • codeitwisely committed f3e3c10b on 1.0.x-3604228-uid-filter-in-usage-log
    Issue #3604227: Declare log_base_url in hook_theme so the View calls...

  • codeitwisely committed f3e3c10b on 1.0.x-3604255-token-details-column
    Issue #3604227: Declare log_base_url in hook_theme so the View calls...

  • codeitwisely committed f3e3c10b on 1.0.x-3604240-toolbar-icon
    Issue #3604227: Declare log_base_url in hook_theme so the View calls...

  • codeitwisely committed f3e3c10b on 1.0.x-3604346-by-role-dashboard
    Issue #3604227: Declare log_base_url in hook_theme so the View calls...
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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.