Issue #3586274: Merge Use cases/Scope columns and add cascading scope filter

Description

Implements the finalized UX from the 17 June review (see issue), following up #3586219 (closed).

Columns

  • Merge the Use cases and Scope columns into a single Scopes column. Pills are ordered as on the edit page (scope plugins are weight-sorted, so Use Cases lead).

Filters

  • Remove the standalone Use cases filter.
  • Replace the single scope filter with a cascade:
    • First select: scope name (ordered as the edit page), defaulting to All scopes.
    • Second select: values for the chosen scope, defaulting to All. With "All scopes" selected it lists every value (as before); choosing a specific scope restricts the value list to that scope.
  • Matching: an empty value applies no scope filter; with "All scopes" a value matches any scope; with a specific scope the value must belong to that scope.

Rows now expose data-context-scopes (all labels, for the text search) and data-context-scope-map (labels keyed by scope, for the cascade). The per-scope value lists are passed to JS via drupalSettings so the value select can repopulate when the scope name changes.

Testing instructions

  1. Create context items with different scope values (e.g. a use case and a language).
  2. Visit /admin/config/ai/context/items.
  3. Confirm one Scopes column shows all pills, use cases first.
  4. In the scope filter, pick a scope name and confirm the value select narrows to that scope's values; pick a value and confirm rows filter (parent/child hierarchy preserved).
SIMPLETEST_BASE_URL=http://localhost vendor/bin/phpunit web/modules/contrib/ai_context/tests/src/Functional/AiContextItemListTest.php

AI usage

This change was generated by an AI assistant under my review. I am responsible for the code and can explain every decision.

Merge request reports

Loading